📄 subject_17633.htm
字号:
<p>
序号:17633 发表者:codecrazy 发表日期:2002-10-13 23:23:23
<br>主题:运行的时候出错
<br>内容:logpen.lopnWidth.y<BR>我知道了没有值<BR>我写了以下的<BR>void CShape::SetPen(CPen *pen)<BR>{<BR> LOGPEN logpen;<BR> pen->GetLogPen( &logpen );<BR> m_color=logpen.lopnColor;<BR> m_nPenWidth=logpen.lopnWidth.x;<BR> m_style=logpen.lopnStyle;<BR><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>
回复者:ax 回复日期:2002-10-14 00:51:15
<br>内容:LOGPEN lp;<BR>CPen p(PS_SOLID,0,RGB(255,0,0));<BR>p.GetLogPen(&lp);<BR>int x = lp.lopnWidth.x;<BR>这样没错,估计你的pen为NULL
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:凯凯 回复日期:2002-10-14 08:26:57
<br>内容:你要函数的开头加一段代码检查一下,传进来的指针是否为NULL。这也是必要的编程风格。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:徐景周 回复日期:2002-10-14 09:34:05
<br>内容:你的logpen 是本地变量吧,没有初始化,怎么能获取其参数来画呢
<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>回复者:黄飚 回复日期:2002-10-14 10:10:54
<br>内容:Each graphic-object class in the class library has a constructor that allows you to create graphic objects of that class, which you must then initialize with the appropriate create function, such as CreatePen.<BR><BR>Each graphic-object class in the class library has a cast operator that will cast an MFC object to the associated Windows handle. The resulting handle is valid until the associated object detaches it. Use the object’s Detach member function to detach the handle. <BR><BR>
<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 + -