Click here to Skip to main content
16,022,752 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,
How can draw arc in mfc? i try to use ArcTo(...) function but it didn't work.:confused:
Here is my code:
BOOL CModlessDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
	CClientDC d(this);
	d.ArcTo(20,30,30,45,20,60,45,20);
	return TRUE;  // return TRUE  unless you set the focus to a control 
}

please help.
regard
Posted

Have a look at this link, they give some good info:

http://www.ucancode.net/faq/CDC_Arc_Pie_Chord.htm[^]

By the way, shouldn't you be drawing in the paint event? You now simply draw it once and will be erased (or not show up at all) if not redrawn in the paint event. Did you also try to draw some other shapes? Did you also define and use a Pen and Brush accordingly?

Good luck!
 
Share this answer
 
v2
As E.F. Nijboer said, if you have drawn your ellipse only on the OnInitDialog method, you have no chance to see it on the dialog: when OnInitDialog is called, the dialog is not yet visible, then after your initialization code the OnPain is called and your drawings are lost!

Here[^] there is the MSDN documentation about ArcTo...
 
Share this answer
 
Comments
zahraZa 19-Aug-10 16:24pm    
Reason for my vote of 3
useful

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900