VC界面问题(高分)

jerrytse 2002-09-04 12:04:04
1、如何改变窗体的背景颜色呢?
2、如何使CPropertySheet派生类与CPropertyPage派生类配合使用的时候,能够在Page外不留下Sheet的边框,只显示sheet下面的按钮栏呢?(就像安装程序的向导一样)
...全文
70 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
urbanboy 2002-09-05
  • 打赏
  • 举报
回复
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here

// TODO: Return a different brush if the default is not desired
if(nCtlColor==CTLCOLOR_DLG)
//pDC->SetTextColor(RGB(255,0,0));
{HBRUSH brush=CreateSolidBrush(RGB(181,196,52));
return brush;
}
HBRUSH CLD_3701View::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here

// TODO: Return a different brush if the default is not desired
if(nCtlColor==CTLCOLOR_DLG)
{HBRUSH brush=CreateSolidBrush(RGB(181,196,52));
pDC->SetTextColor(RGB(0,0,0));
pDC->SetBkColor(RGB(181,196,52));
return brush;
}
kvls 2002-09-04
  • 打赏
  • 举报
回复
2、可以用CTabCtrl取代CPropertySheet,设置风格就行了。CPropertySheet也可以设置其风格做成象向导那样,不过相比显得要复杂一点,具体的编程很多网站上都有介绍的
WadeHan 2002-09-04
  • 打赏
  • 举报
回复
gz
Jacky_Wu 2002-09-04
  • 打赏
  • 举报
回复
响应ONERASEBGND消息就可以改变背景颜色
ZHENG017 2002-09-04
  • 打赏
  • 举报
回复
1.在OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 处理。
2。设置page的边框属性为none.
ColderRain 2002-09-04
  • 打赏
  • 举报
回复
1; 在PreCreateWindow中注册窗口类

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.lpszClass=
AfxRegisterWndClass(CS_DBLCLKS | CS_HREDRAW
| CS_VREDEAW,
NULL,
::CreateSolidBrush(RGB(255,0,0)));

return TRUE;
}
txdxun 2002-09-04
  • 打赏
  • 举报
回复
up
clin2y 2002-09-04
  • 打赏
  • 举报
回复
gz
jerrytse 2002-09-04
  • 打赏
  • 举报
回复
我想问一下,有专门的向导吗?
向导不就是SetWizardMode()以后的Sheet吗?

对话框的颜色改变我知道,但是CMainFrame呢?
wuxuan 2002-09-04
  • 打赏
  • 举报
回复
http://www.codeguru.com/propertysheet/wizprop.shtml
wuxuan 2002-09-04
  • 打赏
  • 举报
回复
第二个问题,那你为什么不使用向导呢,要用SHEET呢.
wuxuan 2002-09-04
  • 打赏
  • 举报
回复
如何改变对话框的背景色?
(VCKBASE发表于2001-8-10 10:36:20)

[解决方法]
在Windows中,每个窗口的背景色都是由其中的刷子(brush)的填充色确定的.要使对话框的背景色改变只要改变对话框窗口所对应的刷子的填充色即可.

[实现程序]
假设你有了名为My的对话框工程,建立WM_CTLCOLOR消息的相应函数.
class CMyDlg : public CDialog
{
public:
CBrush m_brush;
........................
}

BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
m_brush.CreateSolidBrush(RGB(255,255,255));
return TRUE; // return TRUE unless you set the focus to a control
}

HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here
return m_brush;
// TODO: Return a different brush if the default is not desired
//return hbr;
}

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧