zoukankan      html  css  js  c++  java
  • 【积累】创建无标题栏,无边框,无菜单栏的单文档

    只有客户区的单文档

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

    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);
    }
    

    作者:Ljhero
    出处:http://ljhero.cnblogs.com/
    本作品采用署名-非商业性使用 3.0协议进行许可。欢迎转载,演绎,但是必须保留本文的署名Ljhero,且不能用于商业目的。

  • 相关阅读:
    Navicat 12 的安装和破解
    Intellij ide 2017.2新建javaweb项目,并且部署
    javaSE 打印九九乘法表
    jquery.validate remote 和 自定义验证方法
    MySQL命令行导出数据库
    从cookie中取值$.cookie()
    23个MySQL常用查询语句
    正则表达式限制文本框只能输入数字,小数点,英文字母,汉字
    jquery从零开始学----选择器
    文件上传利器SWFUpload使用指南
  • 原文地址:https://www.cnblogs.com/ljhero/p/1964715.html
Copyright © 2011-2022 走看看