怎样在自画菜单中绘制渐变的颜色 好象有个API,记不清了,查查再回复 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CMenu::DrawGradRect(CDC *pDC, CRect rect, COLORREF cr1, COLORREF cr2, BOOL bHor){ int r1 = GetRValue(cr1); int g1 = GetGValue(cr1); int b1 = GetBValue(cr1); int r2 = GetRValue(cr2); int g2 = GetGValue(cr2); int b2 = GetBValue(cr2); if(bHor) { float dr = ((float)(r2 - r1))/(float)(rect.Width()); float dg = ((float)(g2 - g1))/(float)(rect.Width()); float db = ((float)(b2 - b1))/(float)(rect.Width()); for(int i = rect.left; i < rect.right; i ++) { int r = r1 + (int)(dr*((float)(i - rect.left))); int g = g1 + (int)(dg*((float)(i - rect.left))); int b = b1 + (int)(db*((float)(i - rect.left))); CPen pen(PS_SOLID, 1, RGB(r, g, b)); CPen *old = pDC->SelectObject(&pen); pDC->MoveTo(i, rect.top); pDC->LineTo(i, rect.bottom); pDC->SelectObject(old); } } else { float dr = ((float)(r2 - r1))/(float)(rect.Height()); float dg = ((float)(g2 - g1))/(float)(rect.Height()); float db = ((float)(b2 - b1))/(float)(rect.Height()); for(int i = rect.top; i < rect.bottom; i ++) { int r = r1 + (int)(dr*((float)(i - rect.top))); int g = g1 + (int)(dg*((float)(i - rect.top))); int b = b1 + (int)(db*((float)(i - rect.top))); CPen pen(PS_SOLID, 1, RGB(r, g, b)); CPen *old = pDC->SelectObject(&pen); pDC->MoveTo(rect.left, i); pDC->LineTo(rect.right, i); pDC->SelectObject(old); } }} 使用新的Paltform SDK吧,里面有这样的类,称为GDI+的东西 我给的这个函数就是画背景的哦DrawGradRect自己响应消息就可以了 求高人帮助啊!一个作业,关于数据库的! 正则表达式如何把1之后的东西全部清掉? zend studio 5.5.1 如何让鼠标下的关键字高亮显示? 服务器返回中文乱码问题 关于显示数据库里的标题 小弟在修改程序时,遇到菜鸟级的问题,请求帮助 我对php4中说的换行有疑问? 偶四个三角了,对于一个非计算机专业的学生来说,来之不易啊.散分! PHP 根据选择改变网址的参数 mysql 储存数据的数量达到亿后,该怎么优化呢 为何判断不出到底是目录还是文件? 奇怪的错误,谁来看看。
COLORREF cr2, BOOL bHor)
{
int r1 = GetRValue(cr1);
int g1 = GetGValue(cr1);
int b1 = GetBValue(cr1); int r2 = GetRValue(cr2);
int g2 = GetGValue(cr2);
int b2 = GetBValue(cr2); if(bHor)
{
float dr = ((float)(r2 - r1))/(float)(rect.Width());
float dg = ((float)(g2 - g1))/(float)(rect.Width());
float db = ((float)(b2 - b1))/(float)(rect.Width());
for(int i = rect.left; i < rect.right; i ++)
{
int r = r1 + (int)(dr*((float)(i - rect.left)));
int g = g1 + (int)(dg*((float)(i - rect.left)));
int b = b1 + (int)(db*((float)(i - rect.left)));
CPen pen(PS_SOLID, 1, RGB(r, g, b));
CPen *old = pDC->SelectObject(&pen);
pDC->MoveTo(i, rect.top);
pDC->LineTo(i, rect.bottom);
pDC->SelectObject(old);
}
}
else
{
float dr = ((float)(r2 - r1))/(float)(rect.Height());
float dg = ((float)(g2 - g1))/(float)(rect.Height());
float db = ((float)(b2 - b1))/(float)(rect.Height());
for(int i = rect.top; i < rect.bottom; i ++)
{
int r = r1 + (int)(dr*((float)(i - rect.top)));
int g = g1 + (int)(dg*((float)(i - rect.top)));
int b = b1 + (int)(db*((float)(i - rect.top)));
CPen pen(PS_SOLID, 1, RGB(r, g, b));
CPen *old = pDC->SelectObject(&pen);
pDC->MoveTo(rect.left, i);
pDC->LineTo(rect.right, i);
pDC->SelectObject(old);
}
}
}