怎样在自画菜单中绘制渐变的颜色 好象有个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自己响应消息就可以了 一个关于ajax的问题,帮忙看下是什么情况 初学PHP,请教大家嵌套很多单引号 双引号 大括号 要怎么写? 悲催,遇上这样的主机商 【散分】终于红星了~ 像phpmyadmin 那样压缩下载,而不存在压缩文件! 再来一剂编码问题。。。饿 关于die()的问题!!! 数据库查询后的判断空与否的问题 phpmywind 修改上传图片路径. while嵌套while循环,为什么只循环了外边的while 为何判断不出到底是目录还是文件? 奇怪的错误,谁来看看。
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);
}
}
}