如何在MFC MDI应用程序中的同一应用程序窗口中显示多个文件? [英] How can display multiple files in same application window in MFC MDI application?

查看:136
本文介绍了如何在MFC MDI应用程序中的同一应用程序窗口中显示多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个MFC MDI应用程序,用于查看图像和一个视图和文档类。

我需要在同一个应用程序窗口中显示最多四个图像文件。此外,用户可以提供动态选择显示的图像文件的数量(即,有时用户将需要显示;在完整应用窗口区域中只有一个图像文件,其他时间可能需要同时在屏幕的四个象限中显示四个图像文件)和动态更改图像文件显示的位置(例如,有时用户必须交换显示在应用程序窗口的右下象限和左上象限等的图像文件)。



拆分器窗口技术是拆分应用程序窗口的最佳方法吗?

如何动态(在运行应用程序时)控制显示在不同拆分窗格中的图像文件?

如何在打开图像文件时将图像文件分配到拆分窗口的特定窗格?

I have developed an MFC MDI application for image viewing with one view and document class.
I need to display upto four image files in the same application window. Also the user can have provision to dynamically select number of images files displaying( ie sometimes user will need to display; only one image file in full application window area other time may need to simultaneously display four image files in four quadrants of the screen) and dynamically change position of images files displaying(for example sometimes the user have to interchange image files displayed in right-bottom quadrant and top-left quadrant of application window etc).

Is splitter window technique is the best way to split the application window?
How can I dynamically (on running of application)control image files displaying in different split panes?
How can I assign an image file to a specific pane of the split window while opening an image file?

推荐答案

实际上如何执行物理操作并不重要要执行此操作,您必须通过Handle of存储和访问数据某种形式。



句柄可以是文件句柄(临时文件),全局内存句柄(内存中的所有数据)或指向存储类对象的指针流或数据库(流/数据库中的所有数据)



然后每个视图必须仅使用句柄显示,绘制和编辑。



要传递图像,只需传递手柄并发出重绘命令。



如果你看一下Visual Studio本身就可以了确切地说,当您打开文件时,它会将文件读入内存句柄。然后,您可以自由编辑或使用屏幕上的文本执行任何操作,除非您选择在将内存数据写回物理文件时保存,否则它对文件不执行任何操作。
It actually doesn't matter how you do the physicals on screen to do it you have to have the data stored and accessed by a Handle of some form.

The handle could be a file handle (temp files), a global memory handle (all the data in memory) or a pointer to storage class object like a stream or database (all the data in the stream/database)

Then each view must display, draw and edit only using the handle.

To pass an image you simply pass the handle and issue a redraw command.

If you look at Visual Studio itself it does exactly that when you open a file it reads the file into a memory handle. You are then free to edit or do whatever you want with the text on screen and it does nothing to the file unless you choose to save it when it will write the memory data back down to the physical file.

这篇关于如何在MFC MDI应用程序中的同一应用程序窗口中显示多个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆