我们可以在基于对话框的 MFC Visual Studio 2010 中绘制形状(直线、圆形等)吗?
我想实现一个示波器来通过基于对话框的MFC Visual C++显示一些不同的频率,但是当我谷歌搜索太多时,我发现在Visual C++中绘制形状的唯一方法是使用SDI或MDI! 我想知道是否有一种方法可以通过基于对话框的 mfc 绘制频率图。 如果有人知道任何参考资料,如果他/她介绍给我,我将非常感激。
I want to implement an oscilloscope to display some different frequency via dialog-based MFC visual c++, but as I googling too much , I found out that the only way to drawing shapes in visual c++ is to use SDI or MDI !
I want to know if there is a way to drawing my frequency chart by dialog-based mfc.
if anyone know any reference , I really appreciate it if he/she introduce it to me .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以使用 MFC 在对话框中绘图。
简而言之,在对话框上放置一个“静态”(或图像,我不确定)资源,覆盖/派生该类并处理 WM_PAINT 消息以绘制图形/示波器。
看看 http://www.codeproject.com/KB/miscctrl/High -speedCharting.aspx 是一个很好的例子。
Yes you can draw in dialogs with MFC.
In short, drop a "static" (or image, I'm not certain) resource on the dialog, override/derive the class and handle the WM_PAINT message to draw the graph/oscilloscope.
have a look at http://www.codeproject.com/KB/miscctrl/High-speedCharting.aspx for an excellent example.
您可以使用 GDI 绘制任何内容,如果您打算重复使用示波器,您甚至可以为示波器实现自定义控件,否则您可以仅使用静态/图片框架作为容器。
对于可以有很多更新的东西,比如示波器,你可能需要对你绘制的表面进行双重缓冲,否则你会被撕裂。可以在此处找到使用 GDI 的简短概述。
MFC 有其自己的 GDI 数据结构和函数的等效项,
you can draw onto anything using GDI, you can even implement a custom control for your oscilloscope if you plan on reusing it, else you can just use a static/picture frame to act as a container.
for something that can have many updates, like an oscilloscope, you'd probably need to double buffer the surface you draw on, else you'll get tearing. a short overview of using GDI can be found here.
MFC has its own equivalents of the GDI data structures and functions, see this.