积极答复者
关于MFC的一个问题,大家帮忙看一下

问题
答案
-
你可以参照这篇文章:MFC实现打开、保存文件对话框和浏览文件夹对话框
全部回复
-
能够说具体点吗?因为我试了一下,出现了一个都什么错误
Code Snippetvoid CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}这是本来的函数体
我如果要自己写的话是应该从哪里开始写
-
ashi198866 写: 能够说具体点吗?因为我试了一下,出现了一个都什么错误
Code Snippetvoid CMyDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}这是本来的函数体
我如果要自己写的话是应该从哪里开始写
在// Draw the icon后面加上你要重绘的内容就好啦
-
你可以参照这篇文章:MFC实现打开、保存文件对话框和浏览文件夹对话框