|
-
October 4th, 2004, 02:47 AM
#1
Drawing in dialog box
i am a newbie and so have simple problem. i am using MFC in my app.
how could i draw on dialog box... i want to draw small rectangles in it and add functionality to them.
thanks
-
October 4th, 2004, 02:52 AM
#2
Re: Drawing in dialog box
-
October 4th, 2004, 02:57 AM
#3
Re: Drawing in dialog box
what kind of functionality??
If you want to select objects and so on, you have to use a special draw object for this (as far as I know)... If you just want to draw them, you can use this code:
Code:
CPaintDC dc(this); // device context for painting
int x = 50, y = 50; // add your own coordinates here
int iSize = 10; // add the size you want
brush.CreateSolidBrush(RGB(150, 50, 50)); // you own color here, this is red
dc.SelectObject(brush);
dc.Ellipse(x - iSize, y - iSize, x + iSize, y + iSize);
brush.DeleteObject();
-
October 4th, 2004, 03:05 AM
#4
Re: Drawing in dialog box
 Originally Posted by Tischnoetentoet
what kind of functionality??
If you want to select objects and so on, you have to use a special draw object for this (as far as I know)... If you just want to draw them, you can use this code:
Code:
CPaintDC dc(this); // device context for painting
int x = 50, y = 50; // add your own coordinates here
int iSize = 10; // add the size you want
brush.CreateSolidBrush(RGB(150, 50, 50)); // you own color here, this is red
dc.SelectObject(brush);
dc.Ellipse(x - iSize, y - iSize, x + iSize, y + iSize);
brush.DeleteObject();
NOTE: Do not delete a drawing object (pen or brush) while it is still selected into a DC.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|