| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> yong C++ pin chang Vista mei wei : jie mian de mao bo li xiao guo

yong C++ pin chang Vista mei wei : jie mian de mao bo li xiao guo

2008-06-01 02:12:02 编辑來源:互联网 评论
 
 
 
本文为【用C++品尝Vista美味:界面的毛玻璃效果】的拼音翻译版
  jian jie
  ben wen jiang yan shi zai ji yu Windows Vista de pu tong Windows ying yong cheng xu ji dui hua kuang cheng xu zhong , ru he li yong C++ lai sheng cheng Aero mao bo li xiao guo , ci chu shi yong de shi Beta 2 ban ben de Vista ji Windows SDK, ye xu zai hou xu de ban ben zhong , yi xie API zai xi jie shang hui you suo bian hua 。 ling wai , wen zhong mei you shi yong MFC, quan bu li zi yong WTL 7.5 sheng cheng , qi ke zai http://wtl.sourceforge.net/ xia zai de dao , sui ran ci chu shi yong de shi Visual C++ 2003, dan Visual C++ 2005 ye lei si 。
  Aero zhu ti ji mao bo li xiao guo , shi sui tong Vista" zhuo mian chuang kou zhi li (DWM)" er lai de xin te xing , ye shi wei ruan shi chang tui guang de yi ge chong xin , zai ying yong cheng xu zhong ji cheng mao bo li xiao guo , dang da kai Aero zhu ti shi , cheng xu kan shang qu hui xian de fei chang yu zhong bu tong -- hen ku , dui ba 。
  Aero zhu ti zhong de mao bo li xiao guo
  dang yi Aero wei zhu ti shi ,Vista hui gen ju ji suan ji xian ka jin xing pan ding shi fou kai qi mao bo li xiao guo , ci shi zhuo mian you DWM jin xing hui zhi , er DWM shi yong yi ge composition jin cheng lai xuan ran zhuo mian , qi hui zai ding ceng chuang kou de fei ke hu qu zi dong shi yong Aero zhu ti yuan su ( you dian lei si yu Windows xp)。 hua you shuo hui lai , ye bu shi zong hui tian jia zhe xie mao bo li xiao guo de , jia ru ji suan ji yun xing yu " dian chi mo shi ", huo yong hu jue ding guan bi tou ming xiao guo , na me fei ke hu qu jiu bu hui you mao bo li xiao guo le , ru xia tu suo shi 。
用C++品尝Vista美味:界面的毛玻璃效果

  jia ru zai kong zhi mian ban de ke shi xiao guo zhong da kai le tou ming bo li xiao guo , na fei ke hu qu kan shang qu jiu xiang xia tu zhe yang :
用C++品尝Vista美味:界面的毛玻璃效果

  qing liu yi , ji shi ben de bian kuang cheng xian lv se tiao , zhe shi qiang zhi tou guo lai de yan se , bing qie ye ke yi tou guo biao ti lan kan dao zhuo mian de yi xie tu biao 。
  wo men zai bian xie dai ma de shi hou , yao hai zhi xu liu yi composition shi fou da kai , er bu shi she zhi le shen me mao bo li xiao guo , yin wei DWM hui chu li mao bo li xiao guo hui zhi de bu fen 。
  xiang mu kai shi
  di yi ge shi li cheng xu shi bu dai shi chuang kou 、 gong ju tiao 、 zhuang tai tiao de SDI ying yong cheng xu , zai yun xing wan WTL AppWizard zhi hou , di yi jian shi jiu shi she zhi stdafx.h zhong de #define, yi bian li yong Vista de xin te xing 。Vista de Windows ban ben wei 6, qie Vista zhong IE de ban ben wei 7, she zhi wan cheng hou ying xiang xia mian zhe yang :
  #define WINVER 0x0600
  #define _WIN32_WINNT 0x0600
  #define _WIN32_IE 0x0700
  jie xia lai bao han ATL yu WTL de tou wen jian :
  #define _WTL_NO_WTYPES // bu yao zai WTL tou wen jian zhong ding yi CRect/CPoint/CSize
  #include <atlbase.h>
  #include <atltypes.h>// gong xiang de CRect/CPoint/CSize
  #include <atlapp.h>
  extern CAppModule _Module;
  #include <atlwin.h>
  #include <atlframe.h>
  #include <atlmisc.h>
  #include <atlcrack.h>
  #include <atltheme.h>// XP/Vista zhu ti zhi chi
  #include <dwmapi.h>// DWM API
  jia ru xiu gai wan cheng zhi hou jiu bian yi , jiang hui cong atltheme.h zhong de dao 4 ge cuo wu 。 li ru , yi xia shi bu hui bian yi tong guo de CTheme::GetThemeTextMetrics() dai ma :
  HRESULT GetThemeTextMetrics(..., PTEXTMETRICW pTextMetric)
  {
  ATLASSERT(m_hTheme != NULL);
  // zhu chong : yin wei uxtheme.h tou wen jian , suo yi zhuan huan wei PTEXTMETRIC。
  // ti huan diao PTEXTMETRICW shi bu dui de
  return ::GetThemeTextMetrics(m_hTheme, ..., (PTEXTMETRIC) pTextMetric);
  }
  zai GetThemeTextMetrics() API zhong de zhuan huan , shi dui Platform SDK de uxtheme.h zhong cuo wu de xiu zheng , ran er ,Windows SDK que mei you zhe ge cuo wu , suo yi zhe ge zhuan huan dao zhi le yi ge cuo wu , ke shan chu han shu zhong de zhe ge zhuan huan , qi ta san ge ye tong yang 。 tian jia bian kuang de mao bo li xiao guo
  tong guo ba mao bo li xiao guo cong fei ke hu qu kuo zhan dao ke hu qu , jiu ke wan cheng tian jia cheng xu de mao bo li xiao guo , zhe ge API shi DwmExtendFrameIntoClientArea()。DwmExtendFrameIntoClientArea() jie shou liang ge shen shu : wo men kuang jia chuang kou de HWND he yi ge yong yu shuo ming mao bo li xiao guo kuo zhan dao chuang kou si mian duo yuan de MARGINS jie gou 。 ke zai OnCreate() zhong tiao yong zhe ge API:
  LRESULT CMainFrame::OnCreate(LPCREATESTRUCT lpcs)
  {
  // zai di bu tian jia bo li xiao guo
  MARGINS mar = {0};
  mar.cyBottomHeight = 100;
  DwmExtendFrameIntoClientArea ( m_hWnd, &mar );
  return 0;
  }
  dan jia ru yun xing cheng xu , kan bu dao you ren he bian hua :
用C++品尝Vista美味:界面的毛玻璃效果

  
  
   zhe shi yin wei mao bo li xiao guo yi kao yu chuang kou de tou ming du , wei xian shi chu bo li xiao guo , qu yu zhong xiang su ( zai ben li zhong wei ke hu qu di bu de 100 xiang su ) de alpha zhi bi xu she zhi wei 0。 zui jian dan de fang fa shi yong yi ge hei hua shua lai hui zhi zhe ge qu yu , ta hui ba xiang su de yan se zhi ( hong 、 lv 、 lan he alpha) she wei 0, ke zai OnEraseBkgnd() zhong wan cheng :
  BOOL CMainFrame::OnEraseBkgnd ( HDC hdc )
  {
  CDCHandle dc = hdc;
  CRect rcClient;
  GetClientRect(rcClient);
  dc.FillSolidRect(rcClient, RGB(0,0,0));
  return true;
  }
  xiu gai zhi hou , kuang jia chuang kou kan qi lai xiang zhe yang :
用C++品尝Vista美味:界面的毛玻璃效果

  di bu de 100 xiang su xian zai shi mao bo li xiao guo le 。
  zai mao bo li qu yu tian jia wen ben
  zai chuang kou zhong tian jia mao bo li xiao guo shi bi jiao jian dan de bu fen , dan yao ba zi ji de jie mian yuan su (UI) tian jia dao mao bo li zhi shang , jiu you dian nan du le 。 yin wei bi xu yi zhi bao chi xiang su de alpha zhi , suo yi jiu yao yong dao na xie ke yi li jie bing shi dang she zhi alpha de hui tu API。 huai xiao xi shi ,GDI han shu cha bu duo quan bu bu li hui alpha-- wei yi sheng xia de API ze wei dai you SRCCOPY guang shan cao zuo de BilBlt() han shu le , yin ci , cheng xu bi xu shi yong GDI+ huo zhu ti API lai jin xing hui tu , zhe xie API dou shi shi ke bu wang alpha de 。
  zai Vista zhong , you guan mao bo li de xiao guo yi ban yong zai biao shi cheng xu zhuang tai de qu yu ( qu dai le tong yong kong jian zhong de zhuang tai lan ), li ru ,Windows Media Player 11 jiu zai chuang kou di bu de mao bo li qu yu xian shi bo fang kong zhi yu dang qian ge qu xin xi :
用C++品尝Vista美味:界面的毛玻璃效果

  yi xia , jiang yan shi zen yang zai mao bo li qu yu shang hui zhi wen ben , bing zen yang zai wen ben shang tian jia fa guang xiao guo , yi bian wen ben zai ren he bei jing shang dou fang bian yue du 。 shi yong zheng que de zi ti
  Vista yi jing che di fang qi shi yong MS Sans Serif yu Tahoma zi ti , zhuan er ba Segoe UI zuo wei mo ren de UI zi ti 。 wo men de cheng xu ye ying gai shi yong Segoe UI zi ti , suo yi , jiang hui zai ji yu dang qian zhu ti de qing kuang xia chuang jian yi ge zi ti 。 jia ru zhu ti bei jin yong ( ru yong hu zheng zai shi yong Windows jing dian yan se fang an ), na wo men jiu shi yong SystemParametersInfo() API。
  shou xian , xu yao zai CMainFrame zhong tian jia zhu ti zhi chi , zhe yi dian fei chang jian dan , yin wei WTL yi jing you yi ge yong yu chu li zhu ti de lei :CThemeImpl。 wo men ke ba CThemeImpl tian jia dao ji xu lie biao , bing ba xiao xi lian jie zhi CThemeImpl, yi bian zai dang qian zhu ti gai bian shi , cheng xu ke yi de dao xiang ying de tong zhi 。
  class CMainFrame :
  public CFrameWindowImpl<CMainFrame>,
  public CMessageFilter,
  public CThemeImpl<CMainFrame>
  {
  // ...
  BEGIN_MSG_MAP(CMainFrame)
  CHAIN_MSG_MAP(CThemeImpl<CMainFrame>)
  // ...
  END_MSG_MAP()
  PRotected:
  CFont m_font; // yong yu hui zhi wen ben de zi ti
  };
  zai CMainFrame de gou zao han shu zhong , wo men tiao yong le CThemeImpl::SetThemeClassList(), qi zhi ding le wo men zheng zai shi yong na yi ge zhu ti de chuang kou lei 。 dui yi ban chuang kou lai shuo ( ji bu shi pu tong kong jian de chuang kou ), ming cheng wei "globals"。
  CMainFrame::CMainFrame()
  {
  SetThemeClassList ( L"globals" );
  }
  zui hou , zai OnCreate() zhong , cong zhu ti zhong du qu zi ti xin xi , bing chuang jian yi ge zi ti zi yong :
  LRESULT CMainFrame::OnCreate ( LPCREATESTRUCT lpcs )
  {
  // ...
  // jue ding zai wen ben zhong shi yong na yi zhong zi ti
  LOGFONT lf = {0};
  if ( !IsThemeNull() )
  GetThemeSysFont ( TMT_MSGBOXFONT, &lf );
  else
  {
  NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };
  SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),&ncm, false );
  lf = ncm.lfMessageFont;
  }
  m_font.CreateFontIndirect ( &lf );
  return 0;
  }
  hui zhi wen ben
  zai mao bo li xiao guo shang hui zhi wen ben she ji yi xia bu zhou :
  · chuang jian yi ge yong yu shuang huan chong hui zhi de nei cun DC。
  · chuang jian yi ge 32 wei se shen de DIB, bing xuan ru DC。
  · yong DrawThemeTextEx() ba wen ben hui zhi zai nei cun zhong de DIB shang 。
  · yong BitBit() ba wen ben fu zhi dao ping mu 。
  yin wei wo men de hui zhi dai ma jiang hui yin wei composition shi fou da kai er you suo bu tong , suo yi xu yao zai hui zhi qi jian jian cha composition zhuang tai 。 jian cha zhuang tai de API wei DwmIsCompositionEnabled(), jia ru API zhi xing shi bai , zai fan hui zhi zhong jiu bu hui zhi shi chu da kai zhuang tai , dan CMainFrame zhong you yi ge bao zhuang hao de han shu IsCompositionEnabled(), fei chang yi yu shi yong :
  bool CMainFrame::IsCompositionEnabled() const
  {
  HRESULT hr;
  BOOL bEnabled;
  hr = DwmIsCompositionEnabled(&bEnabled);
  return SUCCEEDED(hr) && bEnabled;
  
  
   }
  xian zai , rang wo men zai jian cha yi bian OnEraseBkgnd(), kan kan mei ge bu zhou shi fou dou wan cheng le 。 zhe ge cheng xu shi yi ge shi zhong cheng xu , suo yi xian yong GetTimeFormat() huo qu dang qian shi jian :
  BOOL CMainFrame::OnEraseBkgnd(HDC hdc)
  {
  CDCHandle dc = hdc;
  CRect rcClient, rcText;
  GetClientRect ( rcClient );
  dc.FillSolidRect ( rcClient, RGB(0,0,0) );
  rcText = rcClient;
  rcText.top = rcText.bottom - 100;
  // huo qu dang qian shi jian
  TCHAR szTime[64];
  GetTimeFormat(LOCALE_USER_DEFAULT,0,NULL,NULL,szTime,_countof(szTime));
  ……
  }
  jia ru composition da kai , wo men jiu jin xing he cheng hui zhi bu zhou , xian she zhi hao yi ge nei cun DC:
  if ( IsCompositionEnabled() )
  {
  // she zhi yi ge wo men jiang hui zhi de nei cun DC he wei tu
  CDC dcMem;
  CBitmap bmp;
  BITMAPINFO dib = {0};
  dcMem.CreateCompatibleDC ( dc );
  jie xia lai , tian chong BITMAPINFO jie gou yi de dao yi ge 32 wei se shen wei tu , qie yu mao bo li qu yu de gao kuan xiang tong 。 ci chu xu chong dian liu yi de shi , wei tu gao du ( ji BITMAPINFOHEADER de biHeight cheng yuan ) wei fu shu , zhe shi yin wei tong chang qing kuang xia BMP shi an zhao cong xia zhi shang de shun xu cun chu zai nei cun zhong de , dan DrawThemeTextEx() xu yao de wei tu shun xu shi cong shang zhi xia , suo yi yao ba gao du she wei fu shu 。
  dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  dib.bmiHeader.biWidth = rcText.Width();
  dib.bmiHeader.biHeight = -rcText.Height();
  dib.bmiHeader.biplanes = 1;
  dib.bmiHeader.biBitCount = 32;
  dib.bmiHeader.biCompression = BI_RGB;
  bmp.CreateDIBSection (dc,&dib,DIB_RGB_COLORS,NULL,NULL,0);
  xian zai , wo men de tu xing dui xiang jiu chuang jian hao le , ke yi kai shi hui zhi wen ben le 。
  // she zhi hao DC
  dcMem.SelectBitmap ( bmp );
  dcMem.SelectFont ( m_font );
  // hui zhi wen ben
  DTTOPTS dto = { sizeof(DTTOPTS) };
  const UINT uFormat = DT_SINGLELINEDT_CENTERDT_VCENTERDT_NOPREFIX;
  CRect rcText2 = rcText;
  dto.dwFlags = DTT_COMPOSITEDDTT_GLOWSIZE;
  dto.iGlowSize = 10;
  rcText2 -= rcText2.TopLeft(); // xiang tong de rect, dan zuo shang jiao wei (0,0)
  DrawThemeTextEx ( m_hTheme, dcMem, 0, 0, CT2CW(szTime), -1,
  uFormat, rcText2, &dto );
  DTTOPTS jie gou kong zhi le wen ben zen yang bei hui zhi , zai biao zhi zhong wo men zhi ming le yao hui zhi " he cheng wen ben ", bing rang wen ben you yi ge fa guang xiao guo 。 zui hou , ba nei cun zhong de wei tu tie dao ping mu shang :
  // jiang wen ben hui zhi dao ping mu shang 。
  BitBlt ( dc, rcText.left, rcText.top, rcText.Width(), rcText.Height(), dcMem, 0, 0, SRCCOPY );
  } // end if (IsCompositionEnabled())
  jia ru composition wei da kai , wo men yong GDI han shu hui zhi wen ben :
  else
  {
  const UINT uFormat = DT_SINGLELINEDT_CENTERDT_VCENTERDT_NOPREFIX;
  // she zhi hao DC
  dc.SetTextColor ( RGB(255,255,255) );
  dc.SelectFont ( m_font );
  dc.SetBkMode ( TRANSPARENT );
  // hui zhi wen ben
  dc.DrawText ( szTime, -1, rcText, uFormat );
  }
  return true; // wo men hui zhi le zheng ge bei jing
  }
  xia mian jiu shi " he cheng wen ben " de mo yang :
用C++品尝Vista美味:界面的毛玻璃效果

  wei yan shi fa guang xiao guo , xia mian shi tong yi bei jing shang de yi duan wen ben , dan mei you fa guang xiao guo :
用C++品尝Vista美味:界面的毛玻璃效果

  chu li composition xiang guan de tong zhi
  dang DWM de composition zhuang tai da kai huo guan bi shi , xi tong hui xiang suo you ding ceng chuang kou guang bo yi ge WM_DWMCOMPOSITIONCHANGED xiao xi ; jia ru composition wei da kai , xu yao zai ci tiao yong DwmExtendFrameIntoClientArea() yi gao zhi DWM, wo men chuang kou de na yi bu fen ying wei mao bo li xiao guo :
  LRESULT CMainFrame::OnCompositionChanged(...)
  {
  if ( IsCompositionEnabled() )
  {
  MARGINS mar = {0};
  mar.cyBottomHeight = 100;
  
  
   DwmExtendFrameIntoClientArea ( m_hWnd, &mar );
  }
  return 0;
  }
  zai dui hua kuang cheng xu zhong ying yong mao bo li xiao guo
  zai dui hua kuang cheng xu zhong tian jia mao bo li xiao guo de guo cheng , yu shang mian kuang jia chuang kou de li zi fei chang xiang si , dan xu yao dui dai ma zuo yi xie shao wei de gai dong 。 zai shi li dui hua kuang cheng xu zhong wei ding ceng chuang kou tian jia le mao bo li xiao guo , xia mian , xiang dui qian yi li zi zuo le xiu gai huo tian jia de dai ma , jiang yi hei ti zi biao chu 。
  she zhi dui hua kuang
  ru zhi qian yi yang , yao gao zhi CThemeImpl wo men yao shi yong na ge chuang kou lei zhu ti , bing tiao yong DwmExtendFrameIntoClientArea() wei chuang kou bian kuang tian jia mao bo li xiao guo 。
  CMainDlg::CMainDlg()
  {
  SetThemeClassList ( L"globals" );
  }
  BOOL CMainDlg::OnInitDialog ( HWND hwndFocus, LPARAM lParam )
  {
  // shan chu le xiang dao sheng cheng de mou xie chu shi hua dai ma
  // wei ding ceng chuang kou tian jia mao bo li xiao guo
  if ( IsCompositionEnabled() )
  {
  MARGINS mar = {0};
  mar.cyTopHeight = 150;
  DwmExtendFrameIntoClientArea ( m_hWnd, &mar );
  }
  jie xia lai , gou jian wen ben zi ti 。 zhu chong , wo men xu yao xian shi tiao yong OpenThemeData(), er wei shen me zai qian mian de kuang jia chuang kou li zi zhong bu xu yao tiao yong ne , yin wei CThemeImpl zai ta de WM_CREATE chu li cheng xu zhong yi tiao yong le 。 fan guan dui hua kuang qu er dai zhi jie shou WM_INITDIALOG, er CThemeImpl wei chu li WM_INITDIALOG, suo yi jiu xu yao wo men zi ji tiao yong OpenThemeData() le 。 ling wai , zai dai ma zhong ye ba zi ti she zhi de geng da , zhi shi wei le yan shi geng da zi ti de fa guang xiao guo 。
  // jue ding shi yong na yi zhong zi ti
  LOGFONT lf = {0};
  OpenThemeData();
  if ( !IsThemeNull() )
  GetThemeSysFont ( TMT_MSGBOXFONT, &lf );
  else
  {
  NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };
  SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),&ncm, false );
  lf = ncm.lfMessageFont;
  }
  lf.lfHeight *= 3;
  m_font.CreateFontIndirect ( &lf );
  dui hua kuang de ding ceng chuang kou shang you yi ge da de jing tai wen ben kong jian , ye jiu shi wo men yao hui zhi shi jian de di fang 。 dai ma she zhi le kong jian de owner-draw feng ge , yin ci , wo men ke ba suo you de wen ben hui zhi dai ma dou fang zai OnDrawItem() zhong :
  // she zhi jing tai wen ben kong jian de owner-draw
  m_wndTimeLabel.Attach ( GetDlgItem(IDC_CLOCK) );
  m_wndTimeLabel.ModifyStyle ( SS_TYPEMASK, SS_OWNERDRAW );
  zui hou , tiao yong EnableThemeDialogTexture() yi bian dui hua kuang bei jing shi yong dang qian zhu ti lai hui zhi 。
  // qi ta chu shi hua dai ma
  EnableThemeDialogTexture ( ETDT_ENABLE );
  // she zhi ji shi qi de shi jian jian ge wei 1 miao , yi zai mei ge miao zhong nei dou neng geng xin shi zhong
  SetTimer ( 1, 1000 );
  return TRUE;
  }
  da kai mao bo li xiao guo
  ru qian mian yi yang , wo men xu yao yong hei se hua shua lai tian chong mao bo li qu yu , yi bian ying zao yi zhong tou shi xiao guo 。 yin wei nei zhi de dui hua kuang chuang kou chu li guo cheng hui xiang ying WM_ERASEBKGND xiao xi , lai chu li zhu ru fei ju xing huo ban tou ming kong jian , suo yi , wo men xu yao zai OnPaint() er bu shi OnEraseBkgnd() zhong zuo hui tu 。
  void CMainDlg::OnPaint ( HDC hdc )
  {
  CPaintDC dc(m_hWnd);
  CRect rcGlassArea;
  if ( IsCompositionEnabled() )
  {
  GetClientRect ( rcGlassArea );
  rcGlassArea.bottom = 150;
  dc.FillSolidRect(rcGlassArea, RGB(0,0,0));
  }
  }
  hui zhi wen ben
  zai OnTimer() zhong , huo qu dang qian shi jian , bing yi ci she zhi jing tai kong jian de wen ben :
  void CMainDlg::OnTimer ( UINT uID, TIMERPROC pProc )
  {
  // huo qu dang qian shi jian
  TCHAR szTime[64];
  GetTimeFormat ( LOCALE_USER_DEFAULT, 0, NULL, NULL,szTime, _countof(szTime) );
  m_wndTimeLabel.SetWindowText ( szTime )
  }
  SetWindowText() han shu hui shi jing tai kong jian chong hui , dao zhi OnDrawItem() han shu de tiao yong 。OnDrawItem() han shu zhong de dai ma yu qian mian kuang jia chuang kou li zi zhong de lei si , zai ci bu zai zhui shu , yi xia shi cheng xu wai guan :
用C++品尝Vista美味:界面的毛玻璃效果

  zai mao bo li xiao guo shang hui zhi tu xing
  xian qian yi ti dao , zai mao bo li qu yu zhong jin xing hui tu xu yao yong dao ke shi bie alpha de API, ru GDI+ han shu 。 xia mian de li zi yong dao GDI+ zhong de Image lei zai dui hua kuang de zuo shang jiao hui zhi le yi ge Logo, ru tu shi :
用C++品尝Vista美味:界面的毛玻璃效果

  zhe ge Logo shi cong yu exe wen jian zai tong yi mu lu de mylogo.png wen jian zhong du qu de , qing zhu chong , yin wei shi yong le GDI+ hui zhi Logo, suo yi Logo si zhou de tou ming du yi bei bao liu , bing qie kan shang qu xian shi de hen zheng que 。
  
  
  
  shi zheng ge chuang kou mao bo li hua
  wo men huan ke yi rang zheng ge chuang kou kan shang qu dou xiang kuai mao bo li , yi xia you yi duan jian duan dai ma , zhi xu ba MARGINS jie gou de di yi ge cheng yuan she wei -1 jiu xing le :
  MARGINS mar = {-1};
  DwmExtendFrameIntoClientArea ( m_hWnd, &mar );
  jia ru zai wo men de dui hua kuang cheng xu zhong jia ru zhe duan dai ma , na me cheng xu zui zhong jiang kan shang qu xiang zhe yang :
用C++品尝Vista美味:界面的毛玻璃效果

  liu yi guan cha ,4 ge an niu shang de wen ben yan se xian shi bu zheng que , bing qie mei ge an niu wai wei dou you yi ge bu tou ming de ju xing 。 tong chang lai shuo , tou ming xing yu zi chuang kou bu hui pei he de fei chang hao , jia ru xiang yao yi ge quan wei mao bo li xiao guo de dui hua kuang , na me kong jian bu fen jiu xu yao yi yi ge bu tou ming de bei jing lai hui zhi , ru "Windows Mobility Center" cheng xu :
用C++品尝Vista美味:界面的毛玻璃效果

  jie lun
  zai cheng xu zhong tian jia mao bo li xiao guo ke shi cheng xu zai shi jiao shang xian de fei chang yu zhong bu tong , er qie neng ti gong yi ge bi tong yong kong jian zhong zhuang tai lan geng hao de zhuang tai xian shi qu yu , ben wen zhu yao shi qi dao yi ge pao zhuan yin yu de zuo yong , ye you zhu yu da jia zai shi yong ben di C++ tian jia mao bo li xiao guo shi , dui DWM API you yi ge chu bu de le jie 。【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
jian jie    ben wen jiang yan shi zai ji yu Windows Vista de pu tong Windows ying yong cheng xu ji dui hua kuang cheng xu zhong , ru he li yong C++ lai sheng cheng Aero mao bo li xiao guo , ci chu shi yong de shi Beta 2 ban ben de Vista ji Windows SDK, ye xu zai hou xu de ban ben zhong , yi xie API zai xi jie shang hui you suo bian hua 。 ling wai , wen zhong mei you shi yong MFC, quan bu li zi yong WTL 7.5 sheng cheng , qi ke zai http://wtl.sourceforge.net/ xia zai de dao , sui ran ci chu shi yong de shi Visual C++ 2003, dan Visual C++ 2005 ye lei si 。   Aero zhu ti ji mao bo li xiao guo , shi sui tong Vista" zhuo mian chuang kou zhi li (DWM)" er lai de xin te xing , ye shi wei ruan shi chang tui guang de yi ge chong xin , zai ying yong cheng xu zhong ji cheng mao bo li xiao guo , dang da kai Aero zhu ti shi , cheng xu kan shang qu hui xian de fei chang yu zhong bu tong -- hen ku , dui ba 。   Aero zhu ti zhong de mao bo li xiao guo    dang yi Aero wei zhu ti shi ,Vista hui gen ju ji suan ji xian ka jin xing pan ding shi fou kai qi mao bo li xiao guo , ci shi zhuo mian you DWM jin xing hui zhi , er DWM shi yong yi ge composition jin cheng lai xuan ran zhuo mian , qi hui zai ding ceng chuang kou de fei ke hu qu zi dong shi yong Aero zhu ti yuan su ( you dian lei si yu Windows xp)。 hua you shuo hui lai , ye bu shi zong hui tian jia zhe xie mao bo li xiao guo de , jia ru ji suan ji yun xing yu " dian chi mo shi ", huo yong hu jue ding guan bi tou ming xiao guo , na me fei ke hu qu jiu bu hui you mao bo li xiao guo le , ru xia tu suo shi 。 [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323422985314.jpg[/img][/url]    jia ru zai kong zhi mian ban de ke shi xiao guo zhong da kai le tou ming bo li xiao guo , na fei ke hu qu kan shang qu jiu xiang xia tu zhe yang : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423000542.jpg[/img][/url]    qing liu yi , ji shi ben de bian kuang cheng xian lv se tiao , zhe shi qiang zhi tou guo lai de yan se , bing qie ye ke yi tou guo biao ti lan kan dao zhuo mian de yi xie tu biao 。    wo men zai bian xie dai ma de shi hou , yao hai zhi xu liu yi composition shi fou da kai , er bu shi she zhi le shen me mao bo li xiao guo , yin wei DWM hui chu li mao bo li xiao guo hui zhi de bu fen 。    xiang mu kai shi    di yi ge shi li cheng xu shi bu dai shi chuang kou 、 gong ju tiao 、 zhuang tai tiao de SDI ying yong cheng xu , zai yun xing wan WTL AppWizard zhi hou , di yi jian shi jiu shi she zhi stdafx.h zhong de #define, yi bian li yong Vista de xin te xing 。Vista de Windows ban ben wei 6, qie Vista zhong IE de ban ben wei 7, she zhi wan cheng hou ying xiang xia mian zhe yang : #define WINVER 0x0600 #define _WIN32_WINNT 0x0600 #define _WIN32_IE 0x0700    jie xia lai bao han ATL yu WTL de tou wen jian : #define _WTL_NO_WTYPES // bu yao zai WTL tou wen jian zhong ding yi CRect/CPoint/CSize #include <atlbase.h> #include <atltypes.h>// gong xiang de CRect/CPoint/CSize #include <atlapp.h> extern CAppModule _Module; #include <atlwin.h> #include <atlframe.h> #include <atlmisc.h> #include <atlcrack.h> #include <atltheme.h>// XP/Vista zhu ti zhi chi #include <dwmapi.h>// DWM API    jia ru xiu gai wan cheng zhi hou jiu bian yi , jiang hui cong atltheme.h zhong de dao 4 ge cuo wu 。 li ru , yi xia shi bu hui bian yi tong guo de CTheme::GetThemeTextMetrics() dai ma : HRESULT GetThemeTextMetrics(..., PTEXTMETRICW pTextMetric) {  ATLASSERT(m_hTheme != NULL);  // zhu chong : yin wei uxtheme.h tou wen jian , suo yi zhuan huan wei PTEXTMETRIC。  // ti huan diao PTEXTMETRICW shi bu dui de  return ::GetThemeTextMetrics(m_hTheme, ..., (PTEXTMETRIC) pTextMetric); }    zai GetThemeTextMetrics() API zhong de zhuan huan , shi dui Platform SDK de uxtheme.h zhong cuo wu de xiu zheng , ran er ,Windows SDK que mei you zhe ge cuo wu , suo yi zhe ge zhuan huan dao zhi le yi ge cuo wu , ke shan chu han shu zhong de zhe ge zhuan huan , qi ta san ge ye tong yang 。 tian jia bian kuang de mao bo li xiao guo    tong guo ba mao bo li xiao guo cong fei ke hu qu kuo zhan dao ke hu qu , jiu ke wan cheng tian jia cheng xu de mao bo li xiao guo , zhe ge API shi DwmExtendFrameIntoClientArea()。DwmExtendFrameIntoClientArea() jie shou liang ge shen shu : wo men kuang jia chuang kou de HWND he yi ge yong yu shuo ming mao bo li xiao guo kuo zhan dao chuang kou si mian duo yuan de MARGINS jie gou 。 ke zai OnCreate() zhong tiao yong zhe ge API: LRESULT CMainFrame::OnCreate(LPCREATESTRUCT lpcs) {  // zai di bu tian jia bo li xiao guo  MARGINS mar = {0};  mar.cyBottomHeight = 100;  DwmExtendFrameIntoClientArea ( m_hWnd, &mar );  return 0; }    dan jia ru yun xing cheng xu , kan bu dao you ren he bian hua : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423000716.jpg[/img][/url]    zhe shi yin wei mao bo li xiao guo yi kao yu chuang kou de tou ming du , wei xian shi chu bo li xiao guo , qu yu zhong xiang su ( zai ben li zhong wei ke hu qu di bu de 100 xiang su ) de alpha zhi bi xu she zhi wei 0。 zui jian dan de fang fa shi yong yi ge hei hua shua lai hui zhi zhe ge qu yu , ta hui ba xiang su de yan se zhi ( hong 、 lv 、 lan he alpha) she wei 0, ke zai OnEraseBkgnd() zhong wan cheng : BOOL CMainFrame::OnEraseBkgnd ( HDC hdc ) {  CDCHandle dc = hdc;  CRect rcClient;  GetClientRect(rcClient);  dc.FillSolidRect(rcClient, RGB(0,0,0));  return true; }    xiu gai zhi hou , kuang jia chuang kou kan qi lai xiang zhe yang : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423000862.jpg[/img][/url]    di bu de 100 xiang su xian zai shi mao bo li xiao guo le 。    zai mao bo li qu yu tian jia wen ben    zai chuang kou zhong tian jia mao bo li xiao guo shi bi jiao jian dan de bu fen , dan yao ba zi ji de jie mian yuan su (UI) tian jia dao mao bo li zhi shang , jiu you dian nan du le 。 yin wei bi xu yi zhi bao chi xiang su de alpha zhi , suo yi jiu yao yong dao na xie ke yi li jie bing shi dang she zhi alpha de hui tu API。 huai xiao xi shi ,GDI han shu cha bu duo quan bu bu li hui alpha-- wei yi sheng xia de API ze wei dai you SRCCOPY guang shan cao zuo de BilBlt() han shu le , yin ci , cheng xu bi xu shi yong GDI+ huo zhu ti API lai jin xing hui tu , zhe xie API dou shi shi ke bu wang alpha de 。    zai Vista zhong , you guan mao bo li de xiao guo yi ban yong zai biao shi cheng xu zhuang tai de qu yu ( qu dai le tong yong kong jian zhong de zhuang tai lan ), li ru ,Windows Media Player 11 jiu zai chuang kou di bu de mao bo li qu yu xian shi bo fang kong zhi yu dang qian ge qu xin xi : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001003.jpg[/img][/url]    yi xia , jiang yan shi zen yang zai mao bo li qu yu shang hui zhi wen ben , bing zen yang zai wen ben shang tian jia fa guang xiao guo , yi bian wen ben zai ren he bei jing shang dou fang bian yue du 。 shi yong zheng que de zi ti   Vista yi jing che di fang qi shi yong MS Sans Serif yu Tahoma zi ti , zhuan er ba Segoe UI zuo wei mo ren de UI zi ti 。 wo men de cheng xu ye ying gai shi yong Segoe UI zi ti , suo yi , jiang hui zai ji yu dang qian zhu ti de qing kuang xia chuang jian yi ge zi ti 。 jia ru zhu ti bei jin yong ( ru yong hu zheng zai shi yong Windows jing dian yan se fang an ), na wo men jiu shi yong SystemParametersInfo() API。    shou xian , xu yao zai CMainFrame zhong tian jia zhu ti zhi chi , zhe yi dian fei chang jian dan , yin wei WTL yi jing you yi ge yong yu chu li zhu ti de lei :CThemeImpl。 wo men ke ba CThemeImpl tian jia dao ji xu lie biao , bing ba xiao xi lian jie zhi CThemeImpl, yi bian zai dang qian zhu ti gai bian shi , cheng xu ke yi de dao xiang ying de tong zhi 。 class CMainFrame : public CFrameWindowImpl<CMainFrame>, public CMessageFilter, public CThemeImpl<CMainFrame> {  // ...  BEGIN_MSG_MAP(CMainFrame)   CHAIN_MSG_MAP(CThemeImpl<CMainFrame>)   // ...  END_MSG_MAP()  PRotected:   CFont m_font; // yong yu hui zhi wen ben de zi ti };    zai CMainFrame de gou zao han shu zhong , wo men tiao yong le CThemeImpl::SetThemeClassList(), qi zhi ding le wo men zheng zai shi yong na yi ge zhu ti de chuang kou lei 。 dui yi ban chuang kou lai shuo ( ji bu shi pu tong kong jian de chuang kou ), ming cheng wei "globals"。 CMainFrame::CMainFrame() {  SetThemeClassList ( L"globals" ); }    zui hou , zai OnCreate() zhong , cong zhu ti zhong du qu zi ti xin xi , bing chuang jian yi ge zi ti zi yong : LRESULT CMainFrame::OnCreate ( LPCREATESTRUCT lpcs ) {  // ...  // jue ding zai wen ben zhong shi yong na yi zhong zi ti  LOGFONT lf = {0};  if ( !IsThemeNull() )   GetThemeSysFont ( TMT_MSGBOXFONT, &lf );  else  {   NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };   SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),&ncm, false );   lf = ncm.lfMessageFont;  }  m_font.CreateFontIndirect ( &lf );  return 0; }    hui zhi wen ben    zai mao bo li xiao guo shang hui zhi wen ben she ji yi xia bu zhou :   · chuang jian yi ge yong yu shuang huan chong hui zhi de nei cun DC。   · chuang jian yi ge 32 wei se shen de DIB, bing xuan ru DC。   · yong DrawThemeTextEx() ba wen ben hui zhi zai nei cun zhong de DIB shang 。   · yong BitBit() ba wen ben fu zhi dao ping mu 。    yin wei wo men de hui zhi dai ma jiang hui yin wei composition shi fou da kai er you suo bu tong , suo yi xu yao zai hui zhi qi jian jian cha composition zhuang tai 。 jian cha zhuang tai de API wei DwmIsCompositionEnabled(), jia ru API zhi xing shi bai , zai fan hui zhi zhong jiu bu hui zhi shi chu da kai zhuang tai , dan CMainFrame zhong you yi ge bao zhuang hao de han shu IsCompositionEnabled(), fei chang yi yu shi yong : bool CMainFrame::IsCompositionEnabled() const {  HRESULT hr;  BOOL bEnabled;  hr = DwmIsCompositionEnabled(&bEnabled);  return SUCCEEDED(hr) && bEnabled; }    xian zai , rang wo men zai jian cha yi bian OnEraseBkgnd(), kan kan mei ge bu zhou shi fou dou wan cheng le 。 zhe ge cheng xu shi yi ge shi zhong cheng xu , suo yi xian yong GetTimeFormat() huo qu dang qian shi jian : BOOL CMainFrame::OnEraseBkgnd(HDC hdc) {  CDCHandle dc = hdc;  CRect rcClient, rcText;  GetClientRect ( rcClient );  dc.FillSolidRect ( rcClient, RGB(0,0,0) );  rcText = rcClient;  rcText.top = rcText.bottom - 100;    // huo qu dang qian shi jian  TCHAR szTime[64];  GetTimeFormat(LOCALE_USER_DEFAULT,0,NULL,NULL,szTime,_countof(szTime));  …… }    jia ru composition da kai , wo men jiu jin xing he cheng hui zhi bu zhou , xian she zhi hao yi ge nei cun DC: if ( IsCompositionEnabled() ) {  // she zhi yi ge wo men jiang hui zhi de nei cun DC he wei tu  CDC dcMem;  CBitmap bmp;  BITMAPINFO dib = {0};  dcMem.CreateCompatibleDC ( dc );    jie xia lai , tian chong BITMAPINFO jie gou yi de dao yi ge 32 wei se shen wei tu , qie yu mao bo li qu yu de gao kuan xiang tong 。 ci chu xu chong dian liu yi de shi , wei tu gao du ( ji BITMAPINFOHEADER de biHeight cheng yuan ) wei fu shu , zhe shi yin wei tong chang qing kuang xia BMP shi an zhao cong xia zhi shang de shun xu cun chu zai nei cun zhong de , dan DrawThemeTextEx() xu yao de wei tu shun xu shi cong shang zhi xia , suo yi yao ba gao du she wei fu shu 。 dib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); dib.bmiHeader.biWidth = rcText.Width(); dib.bmiHeader.biHeight = -rcText.Height(); dib.bmiHeader.biplanes = 1; dib.bmiHeader.biBitCount = 32; dib.bmiHeader.biCompression = BI_RGB; bmp.CreateDIBSection (dc,&dib,DIB_RGB_COLORS,NULL,NULL,0);    xian zai , wo men de tu xing dui xiang jiu chuang jian hao le , ke yi kai shi hui zhi wen ben le 。 // she zhi hao DC dcMem.SelectBitmap ( bmp ); dcMem.SelectFont ( m_font ); // hui zhi wen ben DTTOPTS dto = { sizeof(DTTOPTS) }; const UINT uFormat = DT_SINGLELINEDT_CENTERDT_VCENTERDT_NOPREFIX; CRect rcText2 = rcText; dto.dwFlags = DTT_COMPOSITEDDTT_GLOWSIZE; dto.iGlowSize = 10; rcText2 -= rcText2.TopLeft(); // xiang tong de rect, dan zuo shang jiao wei (0,0) DrawThemeTextEx ( m_hTheme, dcMem, 0, 0, CT2CW(szTime), -1, uFormat, rcText2, &dto );   DTTOPTS jie gou kong zhi le wen ben zen yang bei hui zhi , zai biao zhi zhong wo men zhi ming le yao hui zhi " he cheng wen ben ", bing rang wen ben you yi ge fa guang xiao guo 。 zui hou , ba nei cun zhong de wei tu tie dao ping mu shang :  // jiang wen ben hui zhi dao ping mu shang 。  BitBlt ( dc, rcText.left, rcText.top, rcText.Width(), rcText.Height(), dcMem, 0, 0, SRCCOPY ); } // end if (IsCompositionEnabled())    jia ru composition wei da kai , wo men yong GDI han shu hui zhi wen ben : else {  const UINT uFormat = DT_SINGLELINEDT_CENTERDT_VCENTERDT_NOPREFIX;  // she zhi hao DC  dc.SetTextColor ( RGB(255,255,255) );  dc.SelectFont ( m_font );  dc.SetBkMode ( TRANSPARENT );  // hui zhi wen ben  dc.DrawText ( szTime, -1, rcText, uFormat ); } return true; // wo men hui zhi le zheng ge bei jing }    xia mian jiu shi " he cheng wen ben " de mo yang : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001074.jpg[/img][/url]    wei yan shi fa guang xiao guo , xia mian shi tong yi bei jing shang de yi duan wen ben , dan mei you fa guang xiao guo : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001192.jpg[/img][/url] chu li composition xiang guan de tong zhi    dang DWM de composition zhuang tai da kai huo guan bi shi , xi tong hui xiang suo you ding ceng chuang kou guang bo yi ge WM_DWMCOMPOSITIONCHANGED xiao xi ; jia ru composition wei da kai , xu yao zai ci tiao yong DwmExtendFrameIntoClientArea() yi gao zhi DWM, wo men chuang kou de na yi bu fen ying wei mao bo li xiao guo : LRESULT CMainFrame::OnCompositionChanged(...) {  if ( IsCompositionEnabled() )  {   MARGINS mar = {0};   mar.cyBottomHeight = 100;   DwmExtendFrameIntoClientArea ( m_hWnd, &mar );  }  return 0; }    zai dui hua kuang cheng xu zhong ying yong mao bo li xiao guo    zai dui hua kuang cheng xu zhong tian jia mao bo li xiao guo de guo cheng , yu shang mian kuang jia chuang kou de li zi fei chang xiang si , dan xu yao dui dai ma zuo yi xie shao wei de gai dong 。 zai shi li dui hua kuang cheng xu zhong wei ding ceng chuang kou tian jia le mao bo li xiao guo , xia mian , xiang dui qian yi li zi zuo le xiu gai huo tian jia de dai ma , jiang yi hei ti zi biao chu 。    she zhi dui hua kuang    ru zhi qian yi yang , yao gao zhi CThemeImpl wo men yao shi yong na ge chuang kou lei zhu ti , bing tiao yong DwmExtendFrameIntoClientArea() wei chuang kou bian kuang tian jia mao bo li xiao guo 。 CMainDlg::CMainDlg() {  SetThemeClassList ( L"globals" ); } BOOL CMainDlg::OnInitDialog ( HWND hwndFocus, LPARAM lParam ) {  // shan chu le xiang dao sheng cheng de mou xie chu shi hua dai ma  // wei ding ceng chuang kou tian jia mao bo li xiao guo  if ( IsCompositionEnabled() )  {   MARGINS mar = {0};   mar.cyTopHeight = 150;   DwmExtendFrameIntoClientArea ( m_hWnd, &mar );  }    jie xia lai , gou jian wen ben zi ti 。 zhu chong , wo men xu yao xian shi tiao yong OpenThemeData(), er wei shen me zai qian mian de kuang jia chuang kou li zi zhong bu xu yao tiao yong ne , yin wei CThemeImpl zai ta de WM_CREATE chu li cheng xu zhong yi tiao yong le 。 fan guan dui hua kuang qu er dai zhi jie shou WM_INITDIALOG, er CThemeImpl wei chu li WM_INITDIALOG, suo yi jiu xu yao wo men zi ji tiao yong OpenThemeData() le 。 ling wai , zai dai ma zhong ye ba zi ti she zhi de geng da , zhi shi wei le yan shi geng da zi ti de fa guang xiao guo 。 // jue ding shi yong na yi zhong zi ti LOGFONT lf = {0}; OpenThemeData(); if ( !IsThemeNull() )  GetThemeSysFont ( TMT_MSGBOXFONT, &lf ); else {  NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };  SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS),&ncm, false );  lf = ncm.lfMessageFont; } lf.lfHeight *= 3; m_font.CreateFontIndirect ( &lf );    dui hua kuang de ding ceng chuang kou shang you yi ge da de jing tai wen ben kong jian , ye jiu shi wo men yao hui zhi shi jian de di fang 。 dai ma she zhi le kong jian de owner-draw feng ge , yin ci , wo men ke ba suo you de wen ben hui zhi dai ma dou fang zai OnDrawItem() zhong : // she zhi jing tai wen ben kong jian de owner-draw m_wndTimeLabel.Attach ( GetDlgItem(IDC_CLOCK) ); m_wndTimeLabel.ModifyStyle ( SS_TYPEMASK, SS_OWNERDRAW );    zui hou , tiao yong EnableThemeDialogTexture() yi bian dui hua kuang bei jing shi yong dang qian zhu ti lai hui zhi 。 // qi ta chu shi hua dai ma EnableThemeDialogTexture ( ETDT_ENABLE ); // she zhi ji shi qi de shi jian jian ge wei 1 miao , yi zai mei ge miao zhong nei dou neng geng xin shi zhong SetTimer ( 1, 1000 ); return TRUE; }    da kai mao bo li xiao guo    ru qian mian yi yang , wo men xu yao yong hei se hua shua lai tian chong mao bo li qu yu , yi bian ying zao yi zhong tou shi xiao guo 。 yin wei nei zhi de dui hua kuang chuang kou chu li guo cheng hui xiang ying WM_ERASEBKGND xiao xi , lai chu li zhu ru fei ju xing huo ban tou ming kong jian , suo yi , wo men xu yao zai OnPaint() er bu shi OnEraseBkgnd() zhong zuo hui tu 。 void CMainDlg::OnPaint ( HDC hdc ) {  CPaintDC dc(m_hWnd);  CRect rcGlassArea;  if ( IsCompositionEnabled() )  {   GetClientRect ( rcGlassArea );   rcGlassArea.bottom = 150;   dc.FillSolidRect(rcGlassArea, RGB(0,0,0));  } }    hui zhi wen ben    zai OnTimer() zhong , huo qu dang qian shi jian , bing yi ci she zhi jing tai kong jian de wen ben : void CMainDlg::OnTimer ( UINT uID, TIMERPROC pProc ) {  // huo qu dang qian shi jian  TCHAR szTime[64];  GetTimeFormat ( LOCALE_USER_DEFAULT, 0, NULL, NULL,szTime, _countof(szTime) );  m_wndTimeLabel.SetWindowText ( szTime ) }   SetWindowText() han shu hui shi jing tai kong jian chong hui , dao zhi OnDrawItem() han shu de tiao yong 。OnDrawItem() han shu zhong de dai ma yu qian mian kuang jia chuang kou li zi zhong de lei si , zai ci bu zai zhui shu , yi xia shi cheng xu wai guan : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001311.jpg[/img][/url] zai mao bo li xiao guo shang hui zhi tu xing    xian qian yi ti dao , zai mao bo li qu yu zhong jin xing hui tu xu yao yong dao ke shi bie alpha de API, ru GDI+ han shu 。 xia mian de li zi yong dao GDI+ zhong de Image lei zai dui hua kuang de zuo shang jiao hui zhi le yi ge Logo, ru tu shi : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001433.jpg[/img][/url]    zhe ge Logo shi cong yu exe wen jian zai tong yi mu lu de mylogo.png wen jian zhong du qu de , qing zhu chong , yin wei shi yong le GDI+ hui zhi Logo, suo yi Logo si zhou de tou ming du yi bei bao liu , bing qie kan shang qu xian shi de hen zheng que 。    shi zheng ge chuang kou mao bo li hua    wo men huan ke yi rang zheng ge chuang kou kan shang qu dou xiang kuai mao bo li , yi xia you yi duan jian duan dai ma , zhi xu ba MARGINS jie gou de di yi ge cheng yuan she wei -1 jiu xing le : MARGINS mar = {-1}; DwmExtendFrameIntoClientArea ( m_hWnd, &mar );    jia ru zai wo men de dui hua kuang cheng xu zhong jia ru zhe duan dai ma , na me cheng xu zui zhong jiang kan shang qu xiang zhe yang : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001598.jpg[/img][/url]    liu yi guan cha ,4 ge an niu shang de wen ben yan se xian shi bu zheng que , bing qie mei ge an niu wai wei dou you yi ge bu tou ming de ju xing 。 tong chang lai shuo , tou ming xing yu zi chuang kou bu hui pei he de fei chang hao , jia ru xiang yao yi ge quan wei mao bo li xiao guo de dui hua kuang , na me kong jian bu fen jiu xu yao yi yi ge bu tou ming de bei jing lai hui zhi , ru "Windows Mobility Center" cheng xu : [url=http://www.wangchao.net.cn/bbs/pydetail_1785469.html][img]http://image.wangchao.net.cn/it/1323423001789.jpg[/img][/url]    jie lun    zai cheng xu zhong tian jia mao bo li xiao guo ke shi cheng xu zai shi jiao shang xian de fei chang yu zhong bu tong , er qie neng ti gong yi ge bi tong yong kong jian zhong zhuang tai lan geng hao de zhuang tai xian shi qu yu , ben wen zhu yao shi qi dao yi ge pao zhuan yin yu de zuo yong , ye you zhu yu da jia zai shi yong ben di C++ tian jia mao bo li xiao guo shi , dui DWM API you yi ge chu bu de le jie 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
桌球宝贝_性感在蔓延(3)
桌球宝贝_性感在蔓延(2)
银杏树下清纯女孩(9)
银杏树下清纯女孩(8)
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有