设置窗体背景色,可是控件的背景色还是原来的灰色的,很难看,该怎么修改?
BOOL CsssDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
// Create a pruple brush.
CBrush Brush (RGB (128 , 0 , 128) );
// Select the brush into the device context .
CBrush* pOldBrush=pDC->SelectObject(&Brush);
// Get the area that needs to be erased .
CRect reClip;
pDC->GetClipBox(&reClip);
//Paint the area.
pDC-> PatBlt (reClip.left , reClip.top , reClip.Width ( ) , reClip.Height( ) , PATCOPY );
//Unselect brush out of device context .
pDC->SelectObject(pOldBrush );
// Return nonzero to half fruther processing .
return TRUE;
//return CDialog::OnEraseBkgnd(pDC);
}
//*************************以上是设置窗体背景色的代码**********************************
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
// Create a pruple brush.
CBrush Brush (RGB (128 , 0 , 128) );
// Select the brush into the device context .
CBrush* pOldBrush=pDC->SelectObject(&Brush);
// Get the area that needs to be erased .
CRect reClip;
pDC->GetClipBox(&reClip);
//Paint the area.
pDC-> PatBlt (reClip.left , reClip.top , reClip.Width ( ) , reClip.Height( ) , PATCOPY );
//Unselect brush out of device context .
pDC->SelectObject(pOldBrush );
// Return nonzero to half fruther processing .
return TRUE;
//return CDialog::OnEraseBkgnd(pDC);
}
//*************************以上是设置窗体背景色的代码**********************************
...全文
相关推荐
Winform透明窗体/蒙板效果
设置窗体的背景色,比如`Color.Gray`,这将是蒙版的颜色。4. 将`TopMost`属性设为`true`,确保蒙版窗体始终位于其他窗体之上。5.
C#窗体皮肤与颜色个性化设置实战指南
在现代桌面应用程序开发中,用户界面的美观性与交互体验已成为衡量软件质量的重要标准之一。C#作为.NET平台的核心语言,其Windows Forms和WPF两大UI框架为开发者提供了丰富的视觉定制能力。本章将系统性地介绍C#窗体皮肤与颜色设置的基本概念、技术背景及其在实际开发中的重要价值。我们将从控件外观的本质出发,解析颜色属性(如BackColorForeColor)、背景图像、字体样式等基础元素如何共同构成窗体的视觉风格。
基于对话框编程,设置窗体的背景颜色,改善窗体美观C#.zip
要设置窗体的背景颜色,我们需要访问窗体的`BackColor`属性。`BackColor`属性允许我们指定窗体的背景色,其值为`System.Drawing.Color`类型。
C#Button窗体常用属性及事件详解
- **Enabled**:设置按钮是否可被用户交互。当设置为`false`时,按钮呈灰色,无法点击。
易语言灰色按钮激活
例如,如果按钮对象名为“btnGray”,你可以使用“设置对象属性”命令,将“btnGray”的“前景色”或“背景色”设置为正常状态的颜色,从而使其从灰色变为可点击的颜色。2.


界面
