zoukankan      html  css  js  c++  java
  • Windows程序设计 读书笔记 子窗口控制(控件)。

    一、LONG GetWindowLong( HWND hWnd, // handle to window int nIndex // offset of value to retrieve);

    nIndex --- 注意查MSDN。

    二、系统颜色。用系统颜色作为控件颜色,可以使软件界面跟系统更加和谐。

    三、自绘子窗口。

    void CWindowsDisignDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
    {
        // TODO: Add your message handler code here and/or call default
        
        if (nIDCtl == IDC_BUTTON18)
        {        
            FillRect(lpDrawItemStruct->hDC,
                    &lpDrawItemStruct->rcItem,(HBRUSH)GetStockObject(LTGRAY_BRUSH));

            if (lpDrawItemStruct->itemState & ODS_SELECTED)
            {
                FillRect(lpDrawItemStruct->hDC,
                    &lpDrawItemStruct->rcItem,(HBRUSH)GetStockObject(DKGRAY_BRUSH));
            }
            
            if (lpDrawItemStruct->itemState & ODS_FOCUS)
            {
                FillRect(lpDrawItemStruct->hDC,
                &lpDrawItemStruct->rcItem,(HBRUSH)GetStockObject(GRAY_BRUSH));
            }

        ::DrawText(lpDrawItemStruct->hDC,"自绘按钮自绘按钮自绘按钮自绘按钮",32,
                &lpDrawItemStruct->rcItem,DT_CENTER | DT_WORDBREAK | DT_NOCLIP | DT_EXPANDTABS) ;

        }
        else
            CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
    }

    四、为子窗口设置窗口过程:

      SetWindowLong(hwnd,GWL_WNDPROC,(LONG)ChildWndProc);

      LRSULT CALLBACK ChildWndProc(HWND,UINT message,WPARAM,LPARAM);

    五、获取系统环境变量:

      GetEnvironmentStrings

      FreeEnvironmentStrings

      GetEnvironmentVariable

  • 相关阅读:
    jQuery动画速成
    elementui更改导航栏样式
    Python反射
    Linux基础--基本命令
    Linux基础--简介
    DRF
    Socket与Websocket初识
    五星宏辉游戏项目小结
    Redis详解(8)--redis-cluster
    Redis详解(7)--主从复制
  • 原文地址:https://www.cnblogs.com/aoyihuashao/p/1716068.html
Copyright © 2011-2022 走看看