📄 subject_49876.htm
字号:
<p>
序号:49876 发表者:张永祥 发表日期:2003-08-14 16:52:09
<br>主题:初级菜的呼唤,你在那里,
<br>内容:各路大X:<BR>拜托我有一问题:<BR> 用VC向导建立一对话框程序,然后在上面放置一PICTURE控件,我想让程序运行时在PICTURE控件理画随意两条直线。于是就代码如下:void CHxianDlg::OnPaint() <BR>{<BR><BR>CRect rect;<BR>CWnd *PWND;<BR>PWND=GetDlgItem(IDC_STATIC);//得到picture控件的指针<BR>PWND->GetClientRect(&rect);//得picture控件窗口的视区域;<BR>CPaintDC dd(PWND);<BR>dd.MoveTo(0,rect.Height());<BR>dd.LineTo(rect.Width(),rect.Height());<BR><BR><BR><BR> if (IsIconic())<BR> {<BR> CPaintDC dc(this); // device context for painting<BR><BR> SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<BR><BR> // Center icon in client rectangle<BR> int cxIcon = GetSystemMetrics(SM_CXICON);<BR> int cyIcon = GetSystemMetrics(SM_CYICON);<BR> CRect rect;<BR> GetClientRect(&rect);<BR> int x = (rect.Width() - cxIcon + 1) / 2;<BR> int y = (rect.Height() - cyIcon + 1) / 2;<BR><BR> // Draw the icon<BR> dc.DrawIcon(x, y, m_hIcon);<BR> }<BR> else<BR> {<BR> CDialog::OnPaint();<BR> }<BR> }<BR><BR>可是在运行后总说unknow character,调试不明白。请指点。<BR>我想实现在对话框中画线,呜呜。。。太难哩。。。。<BR><BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:lin 回复日期:2003-08-15 09:23:59
<br>内容:unknow character 是指代码中有全角的标点或字符,你仔细看看就行<BR><BR>在Dialog画线不需要用Picture(用也可以),在OnPaint中利用dc作图即可<BR>CPaintDC dc(this); // device context for painting 移到外面来<BR>if (IsIconic())<BR> {<BR> <BR><BR> SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<BR><BR> // Center icon in client rectangle<BR> int cxIcon = GetSystemMetrics(SM_CXICON);<BR> int cyIcon = GetSystemMetrics(SM_CYICON);<BR> CRect rect;<BR> GetClientRect(&rect);<BR> int x = (rect.Width() - cxIcon + 1) / 2;<BR> int y = (rect.Height() - cyIcon + 1) / 2;<BR><BR> // Draw the icon<BR> dc.DrawIcon(x, y, m_hIcon);<BR> }<BR> else<BR> {<BR> //d.c...<BR> //cd<BR> dc.MoveTo(0,0);<BR> dc.LineTo(100,100);<BR> CDialog::OnPaint();<BR> }<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:keke2008 回复日期:2003-08-15 13:01:50
<br>内容:unknow character是在输入是不小心用到输入法,有时从别的地方借鉴的源码,直接用就会unknow character
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -