I would like to create MS Paint program by using MFC CDialog. I have problem in creating paint canvas. I don't want to draw directly on CDialog. I would like to put something on CDialog as a paint canvas. I mean, I would like to draw lines on white canvas. I tried the following methods.
1. I used mousemove events and pen on CDialog. I can draw and paint on CDialog. But I don't want to draw directly on CDialog.
2. I created GroupBox on CDialog to use as a canvas. By using CRect, I filled the GroupBox by white color. At that time, that rectangle was colored by white. It is what I need. Then, I use mousemove events and pen to draw on GroupBox. But, I can't draw lines on white rectangle. I can't see any lines that I draw.
3. I created GroupBox Class based on CStatic Class. Use OnEraseBkgnd(CDC* pDC) event, to fill GroupBox with white color. Then I add OnMouseMove, OnLButtonDown events there to handle mouse events. Then I added that class to CDialog. But, the problem is mouse events don't work for GroupBox. Am I right?
Summarizing, my requirement is to create a paint canvas and draw on it. But I don't know how to do it. Could anyone give me guidelines on it? Thanks in advanced.