创建无标题栏,无边框,无菜单栏的单文档

要创建只有客户区的窗口,主要是窗口框架创建前更改默认的窗口风格:

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{

	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	if(cs.hMenu!=NULL)     
	{     
		::DestroyMenu(cs.hMenu);
		cs.hMenu      =      NULL;
     } 
	//去掉菜单栏

	cs.x=100;   //改变初始位置 
	cs.y=100; 
	cs.cx=642;     //改变初始大小 
          cs.cy=482;
 
	cs.style=WS_POPUP;//改变弹出风格,无标题栏
	//cs.dwExStyle=WS_EX_ACCEPTFILES ;
	return TRUE;
}


去掉工具栏只要把OnCreate函数中默认创建工具栏的代码注释掉进行了:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

/*	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);
*/


	return 0;
}

去掉边框这要在View类中的PreCreateWindow函数中改变窗口风格中不含边线框风格:
BOOL CUIdemoView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

     cs.style   &=~WS_BORDER;//去掉边框。
	return CView::PreCreateWindow(cs);
}

 

你可能感兴趣的:(null,delete,Class,文档,工具,styles)