• <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++博客 :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              106 Posts :: 1 Stories :: 97 Comments :: 0 Trackbacks

            常用鏈接

            留言簿(12)

            搜索

            •  

            積分與排名

            • 積分 - 175000
            • 排名 - 151

            最新評(píng)論

            閱讀排行榜

            這里實(shí)現(xiàn)了對(duì)話(huà)筐的換膚,測(cè)試效果還可以。


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

            #i nclude "BaseSK.h"      /// EVC下實(shí)現(xiàn)WinCE軟件換膚之函數(shù)TransparentBitBlt
            #i nclude "BitmapSK.h"   /// EVC下實(shí)現(xiàn)WinCE軟件換膚之換膚基礎(chǔ)類(lèi)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()
            {
               /*測(cè)試用
             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 閱讀(1345) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): WinCE
            99久久精品日本一区二区免费| 国产精品伊人久久伊人电影| 免费观看久久精彩视频| 久久综合九色综合久99| 久久99精品国产麻豆宅宅| 久久精品草草草| 国产亚洲精久久久久久无码77777| 99久久成人国产精品免费| 精品国产乱码久久久久软件| 欧美伊香蕉久久综合类网站| 一本一本久久A久久综合精品 | 亚洲欧美一区二区三区久久| 国内精品久久久久影院日本| 亚洲精品午夜国产va久久| 国产ww久久久久久久久久| 欧洲精品久久久av无码电影 | 久久国产精品99精品国产987| 久久精品国产男包| 久久久精品人妻无码专区不卡| www.久久热| 亚洲av日韩精品久久久久久a| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 国产三级久久久精品麻豆三级| 久久久久久久91精品免费观看| 很黄很污的网站久久mimi色| 精品久久久久久无码中文字幕一区| 久久综合亚洲鲁鲁五月天| 久久精品国产欧美日韩| 亚洲综合久久综合激情久久| 国内精品久久人妻互换| 久久亚洲精品成人av无码网站| 久久精品国产男包| 中文字幕无码久久人妻| 久久毛片免费看一区二区三区| 久久一本综合| 亚洲国产成人久久综合一区77 | 久久国产精品99久久久久久老狼| 久久久精品国产sm调教网站 | 欧美久久综合九色综合| 人人狠狠综合久久亚洲高清| 少妇被又大又粗又爽毛片久久黑人 |