void Process::MakeBitMap() { CClientDC ClientDC(pDCShow->GetWindow()); if(m_pResMap!=NULL) delete m_pResMap; m_pResMap=new CBitmap(); m_pResMap->CreateCompatibleBitmap(&ClientDC,m_nWndWidth,m_nWndHeight); CDC dc; dc.CreateCompatibleDC(&ClientDC); dc.SelectObject(m_pResMap); for(int i=0; i<m_nWndHeight; i++) for(int j=0; j<m_nWndWidth; j++) dc.SetPixelV(j,i,RGB(m_tResPixelArray[i][j].rgbRed,m_tResPixelArray[i][j].rgbGreen,m_tResPixelArray[i][j].rgbBlue)); if(m_bFaceOK && m_bShowFace) { CBrush Pen; Pen.CreateSolidBrush(RGB(255,0,0)); dc.FrameRect(m_rFaceRegion,&Pen); Pen.DeleteObject(); } dc.DeleteDC(); MyDraw(); }
//鼠标消息 void CCardControl::OnLButtonDown(UINT nFlags, CPoint point) { __super::OnLButtonDown(nFlags, point); //状态判断 if ((m_bPositively==false)||(m_bShowFirst==true)) return; if ((point.x>CARD_SPACE)||(m_CardDataArray.GetCount()==0)) return; //变量定义 CClientDC ClientDC(this); BYTE bCardData=m_CardDataArray[0]; CImageHandle HandleCard(&m_ImageCard); int nDrawWidth=(m_CardDataArray.GetCount()==1)?CARD_WIDTH:CARD_SPACE; //捕获鼠标 SetCapture(); m_bCaptureMouse=true; //绘画扑克 int nXPos=GetCardXPos(bCardData); int nYPos=GetCardYPos(bCardData); m_ImageCard.AlphaDrawImage(&ClientDC,0,0,nDrawWidth,CARD_HEIGHT,nXPos,nYPos,RGB(255,0,255)); return; }
void wxsDrawingWindow::FastRepaint() { wxClientDC ClientDC(this); PrepareDC(ClientDC); wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight())); wxBufferedDC DC(&ClientDC,BmpCopy); PaintExtra(&DC); }
//光标消息 BOOL CFaceItemSelectWnd::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT uMessage) { //获取光标 CPoint MousePoint; GetCursorPos(&MousePoint); ScreenToClient(&MousePoint); //点击判断 WORD wLastFaceID=m_wSelectFace; WORD wHoverFaceID=MouseHitTest(MousePoint); //相同判断 if (wHoverFaceID!=m_wSelectFace) { //变量定义 CClientDC ClientDC(this); //设置变量 m_wSelectFace=wHoverFaceID; //清理选择 if (wLastFaceID!=INVALID_WORD) { //计算位置 INT nXPos=m_nXExcursion+wLastFaceID%m_nWidthCount*(FRAME_WIDTH+FACE_CX); INT nYPos=TOP_PELS+wLastFaceID/m_nWidthCount*(FRAME_HEIGHT+FACE_CY)-m_nCurrentPos; //绘画头像 DrawFaceItem(&ClientDC,wLastFaceID,nXPos,nYPos,false); } //绘画选择 if (m_wSelectFace!=INVALID_WORD) { //计算位置 INT nXPos=m_nXExcursion+m_wSelectFace%m_nWidthCount*(FRAME_WIDTH+FACE_CX); INT nYPos=TOP_PELS+m_wSelectFace/m_nWidthCount*(FRAME_HEIGHT+FACE_CY)-m_nCurrentPos; //绘画头像 DrawFaceItem(&ClientDC,m_wSelectFace,nXPos,nYPos,true); } } //设置光标 if (m_wSelectFace!=INVALID_WORD) { SetCursor(LoadCursor(GetModuleHandle(AVATAR_CONTROL_DLL_NAME),MAKEINTRESOURCE(IDC_HAND_CUR))); return TRUE; } return __super::OnSetCursor(pWnd,nHitTest,uMessage); }
//重画消息 VOID CPasswordControl::OnNcPaint() { //获取位置 CRect rcWindow; GetWindowRect(&rcWindow); ScreenToClient(&rcWindow); //颜色定义 COLORREF crBackGround=CSkinEdit::m_SkinAttribute.m_crEnableBK; COLORREF crFrameBorad=CSkinEdit::m_SkinAttribute.m_crEnableBorad; //禁用状态 if (IsWindowEnabled()==FALSE) { if (m_bRenderImage==false) { crBackGround=CSkinEdit::m_SkinAttribute.m_crDisableBK; crFrameBorad=CSkinEdit::m_SkinAttribute.m_crDisableBorad; } else { crBackGround=CSkinEdit::m_SkinAttribute.m_crDisableBK; crFrameBorad=CSkinEdit::m_SkinAttribute.m_crDisableBorad; } } else { crBackGround=CSkinEdit::m_SkinAttribute.m_crEnableBK; crFrameBorad=CSkinEdit::m_SkinAttribute.m_crEnableBorad; } //边框判断 if (m_bDrawBorad==false) { crFrameBorad=crBackGround; } //绘画边框 CClientDC ClientDC(this); ClientDC.Draw3dRect(rcWindow.left,rcWindow.top,rcWindow.Width(),rcWindow.Height(),crFrameBorad,crFrameBorad); ClientDC.Draw3dRect(rcWindow.left+1,rcWindow.top+1,rcWindow.Width()-2,rcWindow.Height()-2,crBackGround,crBackGround); return; }
//重画函数 void CSkinHeaderCtrl::OnPaint() { //获取位置 CRect ClientRect; GetClientRect(&ClientRect); //设置自画 HD_ITEM HDItem; HDItem.mask=HDI_FORMAT; int iItemCount=GetItemCount(); for (int i=0;i<iItemCount;i++) { GetItem(i,&HDItem); HDItem.fmt|=HDF_OWNERDRAW; SetItem(i,&HDItem); } //建立缓冲图 CBitmap BufferBmp; CClientDC ClientDC(this); BufferBmp.CreateCompatibleBitmap(&ClientDC,ClientRect.Width(),ClientRect.Height()); m_BufferDC.CreateCompatibleDC(&ClientDC); m_BufferDC.SelectObject(&BufferBmp); m_BufferDC.SetBkMode(TRANSPARENT); m_BufferDC.SetTextColor(m_SkinAttribute.m_crHeadText); m_BufferDC.SelectObject(CSkinResourceManager::m_DefaultFont); //加载位图 CImageHandle ImageHandle(&m_SkinAttribute.m_ImageHead); if (ImageHandle.IsResourceValid()) { ImageHandle->StretchBlt(m_BufferDC,ClientRect.left,ClientRect.top,ClientRect.Width(),ClientRect.Height()); m_BufferDC.Draw3dRect(ClientRect.left,ClientRect.top,ClientRect.Width(),ClientRect.Height(),RGB(0,0,0),RGB(0,0,0)); Default(); } //绘画界面 ClientDC.BitBlt(0,0,ClientRect.Width(),ClientRect.Height(),&m_BufferDC,0,0,SRCCOPY); m_BufferDC.DeleteDC(); BufferBmp.DeleteObject(); return; }
//初始化消息 BOOL CHintMsgBox::OnInitDialog() { __super::OnInitDialog(); //设置标题 SetWindowText(m_strCaption); //设置资源 AfxSetResourceHandle(GetModuleHandle(NULL)); //获取信息 INT nTBorder=m_SkinAttribute.m_EncircleInfoView.nTBorder; INT nBBorder=m_SkinAttribute.m_EncircleInfoView.nBBorder; INT nLBorder=m_SkinAttribute.m_EncircleInfoView.nLBorder; INT nRBorder=m_SkinAttribute.m_EncircleInfoView.nRBorder; //按钮区域 CreateBoxButton(); INT nButtonAreaHeight=SMB_BUTTON_HEIGHT+SMB_BUTTON_TOP+SMB_BUTTON_BOTTOM; INT nButtonAreaWidth=m_nBtCount*SMB_BUTTON_WIDTH+(m_nBtCount+1)*SMB_BUTTON_SPACE+SMB_BUTTON_LEFT+SMB_BUTTON_RIGHT; //字符空间 CClientDC ClientDC(this); CRect rcString(0,0,SMB_STRING_WIDTH,SMB_STRING_HEIGHT); ClientDC.SelectObject(CSkinResourceManager::GetDefaultFont()); ClientDC.DrawText(m_strString,rcString,DT_CALCRECT|DT_EXPANDTABS|DT_NOCLIP|DT_WORD_ELLIPSIS); //字符区域 INT nStringAreaHeight=rcString.Height()+SMB_STRING_TOP; INT nStringAreaWidth=rcString.Width()+SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT+SMB_STRING_RIGHT; //窗口区域 INT nWindowAreaHeight=nStringAreaHeight+nButtonAreaHeight; INT nWindowAreaWidth=__max(SMB_WINDOW_WIDTH,__max(nStringAreaWidth,nButtonAreaWidth)); //输出位置 if (nWindowAreaWidth>nStringAreaWidth) { m_rcString.top=SMB_STRING_TOP+nTBorder; m_rcString.left=SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT+(nWindowAreaWidth-nStringAreaWidth)/2; m_rcString.right=m_rcString.left+rcString.Width(); m_rcString.bottom=m_rcString.top+rcString.Height()+nTBorder; } else { m_rcString.top=SMB_STRING_TOP+nTBorder; m_rcString.left=SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT; m_rcString.right=m_rcString.left+rcString.Width(); m_rcString.bottom=m_rcString.top+rcString.Height(); } //调整窗口 INT nWindowWidth=nWindowAreaWidth+nLBorder+nRBorder; INT nWindowHeight=nWindowAreaHeight+nTBorder+nBBorder; SetWindowPos(NULL,0,0,nWindowWidth,nWindowHeight,SWP_NOMOVE|SWP_NOZORDER|SWP_NOCOPYBITS); //计算位置 INT nYButton=nTBorder+nBBorder+nWindowAreaHeight-SMB_BUTTON_BOTTOM-SMB_BUTTON_HEIGHT; INT nXButton=(nWindowAreaWidth-m_nBtCount*SMB_BUTTON_WIDTH-(m_nBtCount+1)*SMB_BUTTON_SPACE)/2+SMB_BUTTON_SPACE; //调整按钮 for (UINT i=0;i<m_nBtCount;i++) { m_btButton[i].SetWindowPos(NULL,nXButton,nYButton,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); nXButton+=SMB_BUTTON_SPACE+SMB_BUTTON_WIDTH; } //默认按钮 UINT uDefaultIndex=(m_uType&MB_DEFMASK)>>8; if (uDefaultIndex>=m_nBtCount) uDefaultIndex=0; m_btButton[uDefaultIndex].SetFocus(); m_btButton[uDefaultIndex].SetButtonStyle(m_btButton[uDefaultIndex].GetButtonStyle()|BS_DEFPUSHBUTTON); //居中窗口 SetActiveWindow(); SetForegroundWindow(); CenterWindow(GetParent()); //设置时间 if (m_nElapse!=0) SetTimer(IDI_MESSAGE,1000,NULL); return FALSE; }
//绘画界面 void CSkinWndObject::DrawSkinView(CDC * pDC) { //获取参数 CRect ClientRect; m_pWndHook->GetClientRect(&ClientRect); //建立缓冲图 CSkinImage CaptionImage; CaptionImage.Create(ClientRect.Width()-2*m_nXExcursionPos,m_SkinAttribute.m_nCaptionHeigth,16); if (CaptionImage.IsNull()) return; //绘画背景 CDC BufferDC; BufferDC.CreateCompatibleDC(NULL); BufferDC.SelectObject(CaptionImage); DrawCaption(&BufferDC,CaptionImage.GetWidth(),CaptionImage.GetHeight()); //建立 DC if (pDC==NULL) { CClientDC ClientDC(m_pWndHook); ClientDC.BitBlt(m_nXExcursionPos,1,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); ClientDC.Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); BufferDC.DeleteDC(); } else { pDC->BitBlt(m_nXExcursionPos,1,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); pDC->Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); } //获取标题 TCHAR strTitle[128]; GetWindowText(*m_pWndHook,strTitle,CountArray(strTitle)); //计算位置 INT nYPos=(m_SkinAttribute.m_nCaptionHeigth-12)/2+2; INT nXPos=46; //建立缓冲图 CClientDC ClientDC(m_pWndHook); ClientDC.SetBkMode(TRANSPARENT); ClientDC.SelectObject(m_SkinAttribute.m_DefaultFont); ClientDC.SetTextAlign(TA_LEFT); //变量定义 int nStringLength=lstrlen(strTitle); int nXExcursion[8]={1,1,1,0,-1,-1,-1,0}; int nYExcursion[8]={-1,0,1,1,1,0,-1,-1}; //绘画边框 ClientDC.SetTextColor(RGB(0,112,192)); for (int i=0;i<CountArray(nXExcursion);i++) { ClientDC.TextOut(nXPos+nXExcursion[i],nYPos+nYExcursion[i],strTitle,nStringLength); } //绘画标题m_SkinAttribute.m_crCaptionTXColor ClientDC.SetTextColor(RGB(255,255,255)); ClientDC.TextOut(nXPos,nYPos,strTitle); BufferDC.DeleteDC(); return; }
//设置区域 VOID CLayeredWindow::InitLayeredArea(CDC * pDCImage, BYTE cbAlpha, CRect & rcUnLayered, CPoint & PointRound, bool bUnLayeredChild) { //效验参数 ASSERT((pDCImage!=NULL)&&(pDCImage->m_hDC!=NULL)); if ((pDCImage==NULL)||(pDCImage->m_hDC==NULL)) return; //变量定义 BITMAP Bitmap; ZeroMemory(&Bitmap,sizeof(Bitmap)); //获取图像 CBitmap * pBitmap=pDCImage->GetCurrentBitmap(); if (pBitmap!=NULL) pBitmap->GetBitmap(&Bitmap); //获取大小 CSize SizeImage; SizeImage.SetSize(Bitmap.bmWidth,Bitmap.bmHeight); //效验大小 ASSERT((SizeImage.cx>0)&&(SizeImage.cy>0)); if ((SizeImage.cx==0)||(SizeImage.cy==0)) return; //变量定义 BLENDFUNCTION BlendFunction; ZeroMemory(&BlendFunction,sizeof(BlendFunction)); //设置参数 BlendFunction.BlendOp=0; BlendFunction.BlendFlags=0; BlendFunction.AlphaFormat=AC_SRC_ALPHA; BlendFunction.SourceConstantAlpha=cbAlpha; //设置分层 CPoint ImagePoint(0,0); CClientDC ClientDC(this); UpdateLayeredWindow(&ClientDC,NULL,&SizeImage,pDCImage,&ImagePoint,0L,&BlendFunction,ULW_ALPHA); //创建区域 CRgn RegionResult; RegionResult.CreateRectRgn(0,0,SizeImage.cx,SizeImage.cy); //窗口排除 if (bUnLayeredChild==true) { //变量定义 tagEnumChildInfo EnumChildInfo; ZeroMemory(&EnumChildInfo,sizeof(EnumChildInfo)); //设置变量 EnumChildInfo.pWndLayered=this; EnumChildInfo.pWndControl=m_pWndControl; EnumChildInfo.pRegionResult=&RegionResult; //枚举窗口 ASSERT(m_pWndControl->GetSafeHwnd()!=NULL); EnumChildWindows(m_pWndControl->m_hWnd,EnumChildProc,(LPARAM)&EnumChildInfo); } //区域排除 if (rcUnLayered.IsRectEmpty()==FALSE) { //创建区域 CRgn RegionUnLayered; RegionUnLayered.CreateRoundRectRgn(rcUnLayered.left,rcUnLayered.top,rcUnLayered.right+1,rcUnLayered.bottom+1,PointRound.x,PointRound.y); //合并区域 RegionResult.CombineRgn(&RegionResult,&RegionUnLayered,RGN_DIFF); } //设置区域 SetWindowRgn(RegionResult,TRUE); return; }
//绘画界面 void CSkinWndObject::DrawSkinView(CDC * pDC) { //获取参数 CRect ClientRect; m_pWndHook->GetClientRect(&ClientRect); //建立缓冲图 CSkinImage CaptionImage; CaptionImage.Create(ClientRect.Width(),m_SkinAttribute.m_nCaptionHeigth,24); if (CaptionImage.IsNull()) return; //绘画背景 CDC BufferDC; BufferDC.CreateCompatibleDC(NULL); BufferDC.SelectObject(CaptionImage); DrawCaption(&BufferDC,CaptionImage.GetWidth(),CaptionImage.GetHeight()); //建立 DC if (pDC==NULL) { CClientDC ClientDC(m_pWndHook); ClientDC.BitBlt(m_nXExcursionPos,0,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); //ClientDC.Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); BufferDC.DeleteDC(); } else { pDC->BitBlt(m_nXExcursionPos,0,CaptionImage.GetWidth(),CaptionImage.GetHeight(),&BufferDC,0,0,SRCCOPY); //pDC->Draw3dRect(&ClientRect,RGB(0,0,0),RGB(0,0,0)); } //获取标题 TCHAR strTitle[128]; GetWindowText(*m_pWndHook,strTitle,CountArray(strTitle)); //计算位置 INT nYPos=(m_SkinAttribute.m_nCaptionHeigth-12)/2+2; INT nXPos=35; //建立缓冲图 CClientDC ClientDC(m_pWndHook); ClientDC.SetBkMode(TRANSPARENT); ClientDC.SelectObject(m_SkinAttribute.m_DefaultFont); ClientDC.SetTextAlign(TA_LEFT); //变量定义 int nStringLength=lstrlen(strTitle); int nXExcursion[8]={1,1,1,0,-1,-1,-1,0}; int nYExcursion[8]={-1,0,1,1,1,0,-1,-1}; int nXExcursion1=GetXExcursionPos(); int nYExcursion1=GetYExcursionPos(); CImageHandle m_FramLeft(&m_SkinAttribute.m_FramLeft); if (m_SkinAttribute.m_FramLeft.IsNull()) return ; CImageHandle m_BottomM(&m_SkinAttribute.m_BottomM); if (m_SkinAttribute.m_BottomM.IsNull()) return ; CImageHandle m_FramRight(&m_SkinAttribute.m_FramRight); if (m_SkinAttribute.m_FramRight.IsNull()) return ; CImageHandle BottomL(&m_SkinAttribute.m_BottomL); if (m_SkinAttribute.m_BottomL.IsNull()) return ; CImageHandle BottomR(&m_SkinAttribute.m_BottomR); if (m_SkinAttribute.m_BottomR.IsNull()) return ; int nLeftWidth=m_FramLeft->GetHeight(); int nMidWidth=m_BottomM->GetWidth(); int nRightWidth=m_FramRight->GetHeight(); for (int i=ClientRect.top+CaptionImage.GetHeight();i<ClientRect.bottom-BottomL->GetHeight();i+=nLeftWidth) m_SkinAttribute.m_FramLeft.BitBlt(ClientDC,nXExcursion1,i); for (int i=ClientRect.top+CaptionImage.GetHeight();i<ClientRect.bottom-BottomR->GetHeight();i+=nRightWidth) m_SkinAttribute.m_FramRight.BitBlt(ClientDC,ClientRect.Width()-nXExcursion1-m_FramRight->GetWidth(),i); for (int i=nXExcursion1+BottomL->GetWidth();i<ClientRect.Width()-m_FramRight->GetWidth();i+=nMidWidth) m_SkinAttribute.m_BottomM.BitBlt(ClientDC,i,ClientRect.Height()-m_BottomM->GetHeight()); m_SkinAttribute.m_BottomL.BitBlt(ClientDC,0,ClientRect.Height()-BottomL->GetHeight()); m_SkinAttribute.m_BottomR.BitBlt(ClientDC,ClientRect.Width()-BottomR->GetWidth()-nXExcursion1,ClientRect.Height()-BottomR->GetHeight()); //绘画边框 // ClientDC.SetTextColor(RGB(231,192,137)); // for (int i=0;i<CountArray(nXExcursion);i++) // { // ClientDC.TextOut(nXPos,nYPos,strTitle,nStringLength); // } //CImageHandle TitleLeft1(&m_SkinAttribute.m_TitleLeft); //if (m_SkinAttribute.m_TitleLeft1.IsNull()) return ; //CImageHandle TitleMid1(&m_SkinAttribute.m_TitleMid); //if (m_SkinAttribute.m_TitleMid1.IsNull()) return ; //CImageHandle TitleRight1(&m_SkinAttribute.m_TitleRight); //if (m_SkinAttribute.m_TitleRight1.IsNull()) return ; //int nLeftWidth=TitleLeft1->GetHeight(); //int nMidWidth=TitleMid1->GetWidth(); //int nRightWidth=TitleRight1->GetWidth(); /*for (int i=ClientRect.top;i<ClientRect.bottom;i+=nLeftWidth) TitleLeft1->BitBlt(BufferDC.m_hDC,ClientRect.left,i);*/ /*for (int i=nLeftWidth;i<nXMinDrawPause;i+=nMidWidth) TitleMid1->BitBlt(pDC->m_hDC,i,0); TitleRight1->BitBlt(pDC->m_hDC,nXMinDrawPause,0);*/ //绘画标题m_SkinAttribute.m_crCaptionTXColor //ClientDC.SetTextColor(m_SkinAttribute.m_crCaptionTXColor); //ClientDC.TextOut(nXPos,nYPos,strTitle); /*for (int i=ClientRect.top;i<ClientRect.bottom;i+=nLeftWidth) TitleLeft1->BitBlt(BufferDC.m_hDC,ClientRect.left,i);*/ BufferDC.DeleteDC(); return; }
//初始化消息 BOOL CHintMsgBox::OnInitDialog() { __super::OnInitDialog(); //设置标题 SetWindowText(m_strCaption); //关闭按钮 if((m_uType&MB_DEFBUTTON2)!=0)m_cbButtonState[BST_CLOSE]&=(~BUT_EXIST); else m_cbButtonState[BST_CLOSE]|=BUT_EXIST; //按钮区域 CreateBoxButton(); INT nButtonAreaHeight=SMB_BUTTON_HEIGHT+SMB_BUTTON_TOP+SMB_BUTTON_BUTTOM; INT nButtonAreaWidth=m_nBtCount*SMB_BUTTON_WIDTH+(m_nBtCount+1)*SMB_BUTTON_SPACE+SMB_BUTTON_LEFT+SMB_BUTTON_RIGHT; //字符空间 CClientDC ClientDC(this); CRect rcString(0,0,SMB_STRING_WIDTH,SMB_STRING_HEIGHT); ClientDC.SelectObject(CSkinResourceManager::GetDefaultFont()); ClientDC.DrawText(m_strString,rcString,DT_CALCRECT|DT_EXPANDTABS|DT_NOCLIP|DT_WORD_ELLIPSIS); //字符区域 INT nStringAreaHeight=rcString.Height()+SMB_STRING_TOP; INT nStringAreaWidth=rcString.Width()+SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT+SMB_STRING_RIGHT; //窗口区域 INT nWindowAreaHeight=nStringAreaHeight+nButtonAreaHeight; INT nWindowAreaWidth=__max(SMB_WINDOW_WIDTH,__max(nStringAreaWidth,nButtonAreaWidth)); //输出位置 if (nWindowAreaWidth>nStringAreaWidth) { m_rcString.top=m_SkinAttribute.m_nCaptionHeigth+SMB_STRING_TOP; m_rcString.left=GetXBorder()+SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT+(nWindowAreaWidth-nStringAreaWidth)/2; m_rcString.right=m_rcString.left+rcString.Width(); m_rcString.bottom=m_rcString.top+rcString.Height(); } else { m_rcString.top=m_SkinAttribute.m_nCaptionHeigth+SMB_STRING_TOP; m_rcString.left=GetXBorder()+SMB_ICON_LEFT+SMB_ICON_WIDTH+SMB_STRING_LEFT; m_rcString.right=m_rcString.left+rcString.Width(); m_rcString.bottom=m_rcString.top+rcString.Height(); } //调整窗口 CRect rcWindow(0,0,0,0); rcWindow.right=nWindowAreaWidth+GetXBorder()*2; rcWindow.bottom=nWindowAreaHeight+m_SkinAttribute.m_nCaptionHeigth+GetYBorder(); SetWindowPos(NULL,0,0,rcWindow.Width(),rcWindow.Height(),SWP_NOMOVE|SWP_NOZORDER); //调整按钮 INT nYButton=m_SkinAttribute.m_nCaptionHeigth+nWindowAreaHeight-SMB_BUTTON_BUTTOM-SMB_BUTTON_HEIGHT; INT nXButton=GetXBorder()+(nWindowAreaWidth-m_nBtCount*SMB_BUTTON_WIDTH-(m_nBtCount+1)*SMB_BUTTON_SPACE)/2+SMB_BUTTON_SPACE; for (UINT i=0;i<m_nBtCount;i++) { m_btButton[i].SetWindowPos(NULL,nXButton,nYButton,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_SHOWWINDOW); nXButton+=SMB_BUTTON_SPACE+SMB_BUTTON_WIDTH; } //默认按钮 UINT uDefaultIndex=(m_uType&MB_DEFMASK)>>8; if (uDefaultIndex>=m_nBtCount) uDefaultIndex=0; m_btButton[uDefaultIndex].SetFocus(); m_btButton[uDefaultIndex].SetButtonStyle(m_btButton[uDefaultIndex].GetButtonStyle()|BS_DEFPUSHBUTTON); //居中窗口 CenterWindow(GetParent()); //设置时间 if (m_nElapse!=0) SetTimer(IDI_MESSAGE,1000,NULL); return FALSE; }