如何改变view的颜色? 3x 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //////////////////// Handle WM_CTLCOLOR: set background color//HBRUSH CMyView::CtlColor(CDC* pDC, UINT nCtlColor){ pDC->SetBkColor(m_color); return m_brush;}.cppIMPLEMENT_DYNCREATE(CMyView, CEditView)BEGIN_MESSAGE_MAP(CMyView, CEditView) ON_WM_CTLCOLOR_REFLECT().hafx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); BOOL CXXView::PreCreateWindow(CREATESTRUCT& cs){int i=3;/////////////////////i:0-7试试 cs.lpszClass=AfxRegisterWndClass( CS_HREDRAW|CS_VREDRAW ,0,(HBRUSH)::GetStockObject(i),0);/// return CView::PreCreateWindow(cs);}颜色有限 http://tzsvc.xiloo.com/skill/window/86.htm 请教楼上大虾:我的子切分不成功?CMainFrame::OnCreateClient(...){ //预期效果:______________ | | | | |______| | | | | | | |_____|______| //主切分:OK m_wndSplitter.CreateStatic(this,1,2); //....... //子切分:Failed m_wndSplitter_child.CreateStatic(&m_wndSplitter,2,1,WS_CHILD | WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,1)); m_wndSplitter_child.CreateView(0,0,RUNTIME_CLASS(CSdiMvSplitView), CSize(100,250),pContext); m_wndSplitter_child.CreateView(1,0,RUNTIME_CLASS(CSdiMvSplitView), CSize(100,250),pContext); //附:我的视CSdiMvSplitView,拆分条定义于CMainFrame中 //CSplitterWnd m_wndSplitter; //CSplitterWnd m_wndSplitter_child;} Windows向窗口发送一个WM_ERASEBKGND消息通知该窗口擦除背景,可以使用ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回TRUE以防止Windows擦除窗口。//Paint area that needs to be erased.BOOL CSampleView : : OnEraseBkgnd (CDC* pDC){// Create a pruple brush.CBrush Brush (RGB (128 , 0 , 128) )// Select the brush into the device context .CBrush* pOldBrush = pDC—>SelcetObject (&brush)// Get the area that needs to be erased .CRect reClippDC—>GetCilpBox (&rcClip)//Paint the area.pDC—> PatBlt (rcClip.left , rcClip.top , rcClip.Width ( ) , rcClip.Height( ) , PATCOPY )//Unselect brush out of device context .pDC—>SelectObject (pOldBrush )// Return nonzero to half fruther processing .return TRUE} 用NSIS制作安装程序时如何把某个文件复制到C:\Documents and Settings\All Users\「开始」菜单\程序\启动 目录下 vc error 求助 RPC over UDP __stdcall的问题 基本理论不会,高手或者会的来说一下~ 女朋友过生日,散分 Grid怎么能编辑其中的内容 是高手的进来看看! MFC连接数据库问题。 请问,如果我想看以前的贴子怎么看啊?还有如何看用户注册信息? 端口扫描问题 请问谁有<精通VC++图像处理>这本书中的CDib类多谢了
// Handle WM_CTLCOLOR: set background color
//
HBRUSH CMyView::CtlColor(CDC* pDC, UINT nCtlColor)
{
pDC->SetBkColor(m_color);
return m_brush;
}.cpp
IMPLEMENT_DYNCREATE(CMyView, CEditView)BEGIN_MESSAGE_MAP(CMyView, CEditView)
ON_WM_CTLCOLOR_REFLECT().h
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
{int i=3;/////////////////////i:0-7试试
cs.lpszClass=AfxRegisterWndClass(
CS_HREDRAW|CS_VREDRAW
,0,(HBRUSH)::GetStockObject(i),0);///
return CView::PreCreateWindow(cs);
}颜色有限
CMainFrame::OnCreateClient(...)
{
//预期效果:______________
| | |
| |______|
| | |
| | |
|_____|______|
//主切分:OK
m_wndSplitter.CreateStatic(this,1,2); //....... //子切分:Failed
m_wndSplitter_child.CreateStatic(&m_wndSplitter,2,1,WS_CHILD |
WS_VISIBLE,m_wndSplitter.IdFromRowCol(0,1));
m_wndSplitter_child.CreateView(0,0,RUNTIME_CLASS(CSdiMvSplitView),
CSize(100,250),pContext);
m_wndSplitter_child.CreateView(1,0,RUNTIME_CLASS(CSdiMvSplitView),
CSize(100,250),pContext); //附:我的视CSdiMvSplitView,拆分条定义于CMainFrame中
//CSplitterWnd m_wndSplitter;
//CSplitterWnd m_wndSplitter_child;
}
ClassWizard重载该消息的缺省处理程序来擦除背景(实际是画),并返回
TRUE以防止Windows擦除窗口。
//Paint area that needs to be erased.
BOOL CSampleView : : OnEraseBkgnd (CDC* pDC)
{
// Create a pruple brush.
CBrush Brush (RGB (128 , 0 , 128) )// Select the brush into the device context .
CBrush* pOldBrush = pDC—>SelcetObject (&brush)// Get the area that needs to be erased .
CRect reClip
pDC—>GetCilpBox (&rcClip)
//Paint the area.
pDC—> PatBlt (rcClip.left , rcClip.top , rcClip.Width ( ) , rcClip.Height( ) , PATCOPY )//Unselect brush out of device context .
pDC—>SelectObject (pOldBrush )// Return nonzero to half fruther processing .
return TRUE
}