![](image/doc.gif)
laoli_no1:为什么我用你的源代码编译不能通过?
E:\Downloads\cpuratecontrol\CPURateControl\CPURateControlCtl.cpp(238) : error C2664: 'void __cdecl CString::Format(const unsigned short *,...)' : cannot convert parameter 1 from 'char [6]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\Downloads\cpuratecontrol\CPURateControl\CPURateControlCtl.cpp(256) : error C2664: 'CreateFontW' : cannot convert parameter 14 from 'char [6]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
CPURateControl.ocx - 2 error(s), 1 warning(s)
(发表于2006-2-24 20:28:00)
![](image/doc.gif)
yexiaozhou2003:你好,你的工程是否使用了UNICODE模式?
在编译器选项下面,把_UNICODE 改为 _MBCS即可。
(发表于2006-2-26 23:00:00)
![](image/doc.gif)
timlyee:这个孔件非常不错,但有个确定 线数是固定的
一旦孔件高度改变就乱了,把代码要稍微修改下,简单实现如下:
int h = m_rect.Height()-30;
for(int i=0;i<=h;i+=3)
{
memDC.MoveTo(m_rect.left+15,m_rect.bottom-15-i);
memDC.LineTo(m_rect.Width()/2-2,m_rect.bottom-15-i);
memDC.MoveTo(m_rect.Width()/2+2,m_rect.bottom-15-i);
memDC.LineTo(m_rect.right-15,m_rect.bottom-15-i);
}
..........中间代码省略.............
h = h*iUsedRate/100;
for(int m=0;m
{
memDC.MoveTo(m_rect.left+15,m_rect.bottom-15-m);
memDC.LineTo(m_rect.Width()/2-2,m_rect.bottom-15-m);
memDC.MoveTo(m_rect.Width()/2+2,m_rect.bottom-15-m);
memDC.LineTo(m_rect.right-15,m_rect.bottom-15-m);
}
(发表于2006-3-14 14:24:00)
yexiaozhou2003:感谢网友timlyee的意见,这个控件线数就是固定的,没有继续完善。可以根据对控件的调整,获取当前控件大小,然后自动生成合适的线数。感谢你的意见和代码。
(发表于2006-4-11 17:16:00)
..........................................................................
--------------------next---------------------