• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Welcome to ErranLi's Blog!

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 175090
            • 排名 - 151

            最新評論

            閱讀排行榜

            這里實現了對話筐的換膚,測試效果還可以。


            ///////////////////////////////////////////////////
            //
            //  CDialogSK : dialog skin
            //
            //  writer: erran
            //
            //  time: 2006-03-24
            //
            ///////////////////////////////////////////////////

            #i nclude "BaseSK.h"      /// EVC下實現WinCE軟件換膚之函數TransparentBitBlt
            #i nclude "BitmapSK.h"   /// EVC下實現WinCE軟件換膚之換膚基礎類CBitmapSK  

            class CDialogSK: public CDialog
            {

            public:
             // constructor and Destructor
             CDialogSK();
             CDialogSK(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
             CDialogSK(UINT nIDTemplate, CWnd* pParentWnd = NULL);
             ~CDialogSK();

            protected:
             // common constructor
             Constructor(); 
             // Destructor,Release the bitmap
             Destructor();

            protected:
             //window title text
             CString m_titleText;

            protected:
             //interface bitmap
             CBitmapSK m_bmpLeft;  //dialog border left bitmap
             CBitmapSK m_bmpRight; //dialog border right bitmap
             CBitmapSK m_bmpBottom;//dialog border bottom bitmap
             CBitmapSK m_bmpTitle;   //two bitmap, dlg active and disactive
             CBitmapSK m_bmpTitleBtn;//max min close btn bitmap
             CBitmapSK m_bmpBkDlg; //dialog back ground bitmap
            protected:
             //transparent color of bitmap
             COLORREF m_transColorLeft;
             COLORREF m_transColorRight;
             COLORREF m_transColorBottom;
             COLORREF m_transColorTitle;
             COLORREF m_transColorTitleBtn;
             COLORREF m_transColorBackDlg;

            protected:

             //window border width and height
             // the border can not more than the border bmp size
             int m_borderLeftWidth;
             int m_borderRightWidth;
             int m_borderBottomHeight;
             int m_titleHeight;
             //offset in the bitmap
             int m_offsetLeft1, m_offsetLeft2;
             int m_offsetRight1, m_offsetRight2;
             int m_offsetBottom1, m_offsetBottom2;
             int m_offsetTitle1, m_offsetTitle2;

            public:
             //window style
             BOOL m_titlable;
             BOOL m_sizable;
             BOOL m_minable;
             BOOL m_maxable;
             BOOL m_sysmenu;

             BOOL m_isActive;

            public:
             BOOL m_winTransable;

            public:
             //msg
             void OnPaint();
             BOOL OnEraseBkgnd(CDC* pDC);

            public:
             // draw skin (x,y) is this dialog region
             BOOL DrawRight(CDC *pDC, int x, int y, int height, int state);
             BOOL DrawLeft(CDC *pDC, int x, int y, int height, int state);
             BOOL DrawBottom(CDC *pDC, int x, int y, int width, int state);
             BOOL DrawTitle(CDC *pDC, int x, int y, int width, int state);

             BOOL DrawFrame(CDC *pDC, int x, int y,int width, int height, int state);
             BOOL DrawBkDlg(CDC *pDC, int x, int y,int width, int height, int state); 
             
             BOOL DrawButton( CDC * pDC, int i, int state );

            };

             

            #i nclude "stdafx.h"
            #i nclude "DialogSK.h"

            /////////////////////////////////////////////////////////////////////////////
            // CDialogSK dialog


            CDialogSK::CDialogSK()
            :CDialog()
            {
            }

            CDialogSK::CDialogSK(LPCTSTR lpszTemplateName, CWnd* pParentWnd/*= NULL*/)
            :CDialog(lpszTemplateName, pParentWnd)
            {
            }

            CDialogSK::CDialogSK(UINT nIDTemplate, CWnd* pParentWnd/*/= NULL*/)
            :CDialog(nIDTemplate, pParentWnd)
            {
             
            }

            CDialogSK::~CDialogSK()
            {
            }

            CDialogSK::Constructor()
            {
               /*測試用
             m_bmpLeft.LoadBitmapEx(NULL, IDB_LEFT); 
             m_bmpRight.LoadBitmapEx(NULL, IDB_RIGHT);
             m_bmpBottom.LoadBitmapEx(NULL, IDB_BOTTOM);
             m_bmpTitle.LoadBitmapEx(NULL, IDB_TOP); 
              
             m_titleHeight = m_bmpTitle.Height()/2;
             m_borderLeftWidth = m_bmpLeft.Width()/2;
             m_borderRightWidth = m_bmpRight.Width()/2;
             m_borderBottomHeight = m_bmpBottom.Height()/2;

             m_offsetLeft1 = 10;
             m_offsetLeft2 = 10;
             m_offsetRight1 = 10;
             m_offsetRight2 = 10;
             m_offsetBottom1 = 10;
             m_offsetBottom2 = 10;
             m_offsetTitle1 = 10;
             m_offsetTitle2 = 10;
               */

            }

            CDialogSK::Destructor()
            {
            }


            BOOL CDialogSK::DrawRight(CDC *pDC, int x, int y, int height, int state)

             int bmpwidth, bmpheight;
             m_bmpRight.Size(bmpwidth, bmpheight);

             //bitmap rect
             RECT srctop, srcmid, desmid, srcdown;

             if (state == 0)
             {
              srctop = CRect(0, 0, m_borderRightWidth, m_offsetRight1);
              srcmid = CRect(0, m_offsetRight1, m_borderRightWidth, m_offsetRight2);
              srcdown = CRect(0, m_offsetRight2, m_borderRightWidth, bmpheight);
             }
             else
             {
              srctop = CRect(m_borderRightWidth, 0, bmpwidth, m_offsetRight1);
              srcmid = CRect(m_borderRightWidth, m_offsetRight1, bmpwidth, m_offsetRight2);
              srcdown = CRect(m_borderRightWidth, m_offsetRight2, bmpwidth, bmpheight);
             }

             desmid = CRect(x, y+m_offsetRight1, x+m_borderRightWidth, y+height-bmpheight+m_offsetRight2);

             m_bmpRight.Draw(pDC, x, y, &srctop);
             m_bmpRight.Fill(pDC, &desmid, &srcmid);
             m_bmpRight.Draw(pDC, x, y+height-bmpheight+m_offsetRight2, &srcdown);

             return TRUE;
            }

            BOOL CDialogSK::DrawLeft(CDC *pDC, int x, int y, int height, int state)

             int bmpwidth, bmpheight;
             m_bmpLeft.Size(bmpwidth, bmpheight);

             //bitmap rect
             RECT srctop, srcmid, desmid, srcdown;

             if (state == 0)
             {
              srctop = CRect(0, 0, m_borderLeftWidth, m_offsetLeft1);
              srcmid = CRect(0, m_offsetLeft1, m_borderLeftWidth, m_offsetLeft2);
              srcdown = CRect(0, m_offsetLeft2, m_borderLeftWidth, bmpheight);
             }
             else
             {
              srctop = CRect(m_borderLeftWidth, 0, bmpwidth, m_offsetRight1);
              srcmid = CRect(m_borderLeftWidth, m_offsetLeft1, bmpwidth, m_offsetLeft2);
              srcdown = CRect(m_borderLeftWidth, m_offsetLeft2, bmpwidth, bmpheight);
             }

             desmid = CRect(x, y+m_offsetLeft1, x+m_borderLeftWidth, y+height-bmpheight+m_offsetLeft2);

             m_bmpLeft.Draw(pDC, x, y, &srctop);
             m_bmpLeft.Fill(pDC, &desmid, &srcmid);
             m_bmpLeft.Draw(pDC, x, y+height-bmpheight+m_offsetLeft2, &srcdown);

             return TRUE;
            }

            BOOL CDialogSK::DrawBottom(CDC *pDC, int x, int y, int width, int state)
            {
             int bmpwidth, bmpheight;
             m_bmpBottom.Size(bmpwidth, bmpheight);

             RECT srcleft, srcmid, desmid, srcright;

             if (state == 0)
             {
              srcleft = CRect(0, 0, m_offsetBottom1, m_borderBottomHeight);
              srcmid = CRect(m_offsetBottom1, 0, m_offsetBottom2, m_borderBottomHeight);
              srcright = CRect(m_offsetBottom2, 0, bmpwidth, m_borderBottomHeight);
             }
             else
             {
              srcleft = CRect(0, m_borderBottomHeight, m_offsetBottom1, bmpheight);
              srcmid = CRect(m_offsetBottom1, m_borderBottomHeight, m_offsetBottom2, bmpheight);
              srcright = CRect(m_offsetBottom2, m_borderBottomHeight, bmpwidth, bmpheight);
             }
              
             desmid = CRect(x+m_offsetBottom1, y, x+width-bmpwidth+m_offsetBottom2, y+m_borderBottomHeight);

             m_bmpBottom.Draw(pDC, x, y, &srcleft);
             m_bmpBottom.Fill(pDC, &desmid, &srcmid);
             m_bmpBottom.Draw(pDC, x+width-bmpwidth+m_offsetBottom2, y, &srcright);

             return TRUE;
            }

            BOOL CDialogSK::DrawTitle(CDC *pDC, int x, int y, int width, int state)

             int bmpwidth, bmpheight;
             m_bmpTitle.Size(bmpwidth, bmpheight);

             RECT srcleft, srcmid, desmid, srcright;

             if (state == 0)
             {
              srcleft = CRect(0, 0, m_offsetTitle1, m_titleHeight);
              srcmid = CRect(m_offsetTitle1, 0, m_offsetTitle2, m_titleHeight);
              srcright = CRect(m_offsetTitle2, 0, bmpwidth, m_titleHeight);
             }
             else
             {
              srcleft = CRect(0, m_titleHeight, m_offsetTitle1, bmpheight);
              srcmid = CRect(m_offsetTitle1, m_titleHeight, m_offsetTitle2, bmpheight);
              srcright = CRect(m_offsetTitle2, m_titleHeight, bmpwidth, bmpheight);
             }

             desmid = CRect(x+m_offsetTitle1, y, x+width-bmpwidth+m_offsetTitle2, y+m_titleHeight);

             m_bmpTitle.Draw(pDC, x, y, &srcleft);
             m_bmpTitle.Fill(pDC, &desmid, &srcmid);
             m_bmpTitle.Draw(pDC, x+width-bmpwidth+m_offsetTitle2, y, &srcright);

             return TRUE;
            }

            BOOL CDialogSK::DrawFrame(CDC *pDC, int x, int y,int width, int height, int state)
            {
             DrawTitle(pDC, x+m_borderLeftWidth, y, width-m_borderLeftWidth-m_borderRightWidth, state); 
             DrawLeft(pDC, x, y, height, state);
             DrawRight(pDC, x+width-m_borderRightWidth, y, height, state);
             DrawBottom(pDC, x+m_borderLeftWidth, y+height-m_borderBottomHeight, width-m_borderLeftWidth-m_borderRightWidth, state); 
             
             return TRUE;
            }

            BOOL CDialogSK::DrawBkDlg(CDC *pDC, int x, int y,int width, int height, int state)
            {
             int bmpwidth, bmpheight;
             m_bmpBkDlg.Size(bmpwidth, bmpheight);
              
             RECT des, src;
             des = CRect(x,y, x+width, y+height);
             src = CRect(0, 0, bmpwidth, bmpheight);

             m_bmpBkDlg.Fill(pDC, &des, &src);

             return TRUE;
            }

            BOOL CDialogSK::OnEraseBkgnd(CDC* pDC)

             CRect rtClient = CClientRect(m_hWnd);
              
             DrawFrame(pDC, rtClient.left, rtClient.top, rtClient.Width(), rtClient.Height(),0);
             DrawBkDlg(pDC, rtClient.left+m_borderLeftWidth, rtClient.top+m_titleHeight,
                   rtClient.Width()-m_borderLeftWidth-m_borderRightWidth,
                   rtClient.Height()-m_titleHeight-m_borderBottomHeight,
                         0);


             return TRUE;

            }

            呵呵,就這么多了,這里不方便貼圖,要不可以看到效果的,呵呵,歡迎指教。

            posted on 2006-12-26 21:49 erran 閱讀(1347) 評論(0)  編輯 收藏 引用 所屬分類: WinCE
            狠狠人妻久久久久久综合蜜桃| 久久久久久久久久久| 伊人久久大香线蕉影院95| 国产午夜精品久久久久九九电影| 亚洲精品无码久久久| 国产精品久久波多野结衣| 无夜精品久久久久久| 国产韩国精品一区二区三区久久| 亚洲v国产v天堂a无码久久| 国产精品久久久天天影视| 日韩欧美亚洲综合久久| 2021国产成人精品久久| 中文字幕热久久久久久久| 国产精品成人99久久久久| 久久久久亚洲AV无码网站| 亚洲欧美国产精品专区久久| 久久99国产精品二区不卡| 五月丁香综合激情六月久久| 欧美亚洲日本久久精品| 9999国产精品欧美久久久久久| 一本一本久久aa综合精品| 亚洲午夜福利精品久久| 久久精品成人一区二区三区| 国产精品久久久天天影视| 亚洲AV无码久久精品成人| 久久久午夜精品| 久久久久亚洲精品男人的天堂 | 2021久久国自产拍精品| 久久精品成人欧美大片| 2020久久精品亚洲热综合一本| 久久精品国产精品亚洲下载 | 国产成人精品久久免费动漫 | 伊人久久大香线焦AV综合影院| 性做久久久久久免费观看| 久久99久久成人免费播放| 国产精品久久久久久久午夜片| 99久久精品国产一区二区三区| www亚洲欲色成人久久精品| 久久精品国产黑森林| 色8激情欧美成人久久综合电| 日产久久强奸免费的看|