我试图从edit控件中得到坐标,然后用setpixel在对话框中画出点void CdrawDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
int x,y;
char ch1[10],ch2[10]; GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10); x=atoi(ch1);
y=atoi(ch2); CDC* pdc=GetDC();
pdc->SetPixel(x,y,RGB(255,0,0));
ReleaseDC(pdc);
}
运行结果发现根本画不出点啊,请问是什么原因呢?谢谢啦
{
// TODO: 在此添加控件通知处理程序代码
int x,y;
char ch1[10],ch2[10]; GetDlgItem(IDC_EDIT1)->GetWindowText(ch1,10);
GetDlgItem(IDC_EDIT2)->GetWindowText(ch2,10); x=atoi(ch1);
y=atoi(ch2); CDC* pdc=GetDC();
pdc->SetPixel(x,y,RGB(255,0,0));
ReleaseDC(pdc);
}
运行结果发现根本画不出点啊,请问是什么原因呢?谢谢啦
建议你用一个小的填充圆或者填充的方框来表示!
可以用pdc->FillRect来做!
方框的大小,根据需要来调节多大!
2#:话说你是怎么搞定的?使用基于单文档的mfc么?