1

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 .

Saeed Taheri
  • 41
  • 1
  • 4
  • 8

2 Answers2

4

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.

Max
  • 3,128
  • 1
  • 24
  • 24
  • thanks alot Max and thank you for link ! I am very new to windows programming specially to visual c++, can you please explain more about working with static resource . how can I override/derive class? I am so sorry for my stupid question. I really appreciate your help. – Saeed Taheri Jul 06 '11 at 14:56
2

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.

Necrolis
  • 25,836
  • 3
  • 63
  • 101