且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在MFC MDI应用程序中的同一应用程序窗口中显示多个文件?

更新时间:2021-11-22 21:15:42

实际上如何执行物理操作并不重要要执行此操作,您必须通过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.

>