void Common::DrawButton(HDC hDC, HBITMAP A, HBITMAP B, HBITMAP C) { if (StartTime < GetTickCount() - 2000) { DrawTransparentBitmap(hDC, this->A.left, this->A.top, A, 255, 0, 255); DrawTransparentBitmap(hDC, this->B.left, this->B.top, B, 255, 0, 255); DrawTransparentBitmap(hDC, this->C.left, this->C.top, C, 255, 0, 255); } }
void Main::Render(HDC hDC) { DrawBitmap(hDC, 0, 0, hbit[0]); // 배경 DrawTransparentBitmap(hDC, Button[0].left - 30, Button[0].top - 10, hbit[1], 255, 0, 255); //Rectangle(hDC, Button[0]); DrawTransparentBitmap(hDC, Button[1].left - 30, Button[1].top - 10, hbit[2], 255, 0, 255); //Rectangle(hDC, Button[1]); DrawTransparentBitmap(hDC, Button[4].left - 10, Button[4].top - 10, hbit[5], 255, 0, 255); //Rectangle(hDC, Button[4]); DrawTransparentBitmap(hDC, Button[3].left, Button[3].top, hbit[4], 255, 0, 255); DrawTransparentBitmap(hDC, Button[2].left, Button[2].top, hbit[3], 255, 0, 255);//InfoButton //Rectangle(hDC, Button[2]); }
void CSplashDlg::OnPaint() { CPaintDC dc(this); // device context for painting CRect rect; GetClientRect( rect ); if( m_bitmap.GetSafeHandle() ) { DrawTransparentBitmap( dc.GetSafeHdc(), (HBITMAP)m_bitmap.GetSafeHandle(), 0, 0, 0, 0, rect.Width(), rect.Height(), RGB(0,255,0) ); } /* CBitmap bitmap; if( bitmap.LoadBitmap( IDB_SPLASH ) ) { CDC dcMem; if (!dcMem.CreateCompatibleDC(&dc)) return; CBitmap* pBitmapOld = dcMem.SelectObject(&bitmap); if (pBitmapOld == NULL) return; BITMAP bmpInfo; bitmap.GetBitmap( &bmpInfo ); dc.BitBlt(2, 2, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMem, 0, 0, SRCCOPY); dcMem.SelectObject(pBitmapOld); } */ }
void CuDlgQueryExecutionPlanBoxStarLeaf::OnNcPaint() { // Default method CDialog::OnNcPaint(); // Draw our bitmap in transparent mode CWindowDC captDC(this); // captDC.SetMapMode(MM_TEXT); LONG lIconId = GetWindowLong(m_hWnd, GWL_USERDATA); UINT iconId = (UINT)lIconId; // iconId can be NULL: preview mode if (iconId) { CBitmap bmp; BOOL bSuccess = bmp.LoadBitmap(iconId); ASSERT (bSuccess); BITMAP bm; bmp.GetBitmap(&bm); short dx = GetSystemMetrics(SM_CXDLGFRAME)+1; short dy = GetSystemMetrics(SM_CYDLGFRAME)+1; COLORREF transparent = RGB(255, 0, 255); DrawTransparentBitmap(captDC.m_hDC, (HBITMAP)bmp, dx, dy, transparent); } }
void Common::DrawEnter(HDC hDC, bool move) { if (move == false) DrawTransparentBitmap(hDC, 0, 600, hbit[0], 255, 0, 255); else DrawEnter(hDC); }
void Situation_5::Render(HDC hDC) { DrawBitmap(hDC, 0, 0, hbit[0]); //배경 switch (SitState) { case Narr1: DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, *CurrentNarr, 255, 0, 255); CommonPtr()->DrawEnter(hDC); break; case Narr2: DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, *CurrentNarr, 255, 0, 255); CommonPtr()->DrawButton(hDC, hbit[3], hbit[4], hbit[5]); break; ////////////////////////////////// 맞는 선택지_2에서 DrawEnter(); case Sit_A_1: DrawBitmap(hDC, 0, 0, hbit[6]); DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[9], 255, 0, 255); CommonPtr()->DrawEnter(hDC); break; case Sit_A_2: DrawBitmap(hDC, 0, 0, hbit[6]); DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[10], 255, 0, 255); CommonPtr()->DrawReturn(hDC); CommonPtr()->DrawExit(hDC); CommonPtr()->DrawMain(hDC); break; case Sit_B_1: DrawBitmap(hDC, 0, 0, hbit[7]); // 배경 DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[11], 255, 0, 255); CommonPtr()->DrawEnter(hDC); break; case Sit_B_2: DrawBitmap(hDC, 0, 0, hbit[7]); DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[12], 255, 0, 255); CommonPtr()->DrawReturn(hDC); CommonPtr()->DrawExit(hDC); CommonPtr()->DrawMain(hDC); break; case Sit_C_1: DrawBitmap(hDC, 0, 0, hbit[8]); DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[13], 255, 0, 255); CommonPtr()->DrawEnter(hDC); break; case Sit_C_2: DrawBitmap(hDC, 0, 0, hbit[8]); DrawTransparentBitmap(hDC, CommonPtr()->GetNarration().left, CommonPtr()->GetNarration().top, hbit[14], 255, 0, 255); CommonPtr()->DrawEnter(hDC); break; } }
void CRScrlBarCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { CWnd* parent; if (m_bDrawing || !m_hWnd) return; m_bDrawing=TRUE; // all the graphics come from the file system and if this is not // available then we cant draw anything // long offsets; if (m_parent) // this contains the closest rdialog if the below case is not true { parent=m_parent; } else { // assumes we are on a listbox with an rdialog underneath it // it will probably break if its placed somewhere on its own... // I tried to set m_parent to be the listboxes parent but // I kept getting stupid errors parent=GetParent()->GetParent(); } CDC* pOffScreenDC=(CDC*)parent->SendMessage(WM_GETOFFSCREENDC,NULL,NULL); ASSERT(pOffScreenDC); // this will fail if parent is not an RDialog // offsets=parent->SendMessage(WM_GETXYOFFSET,NULL,NULL); // this is quite a complex drawing procedure so we are going // to use an offscreen DC to prevent flicker... CBitmap bitmap; bitmap.CreateCompatibleBitmap(pdc,rcBounds.right,rcBounds.bottom); CBitmap* pOldBitmap; pOldBitmap=pOffScreenDC->SelectObject(&bitmap); // ASSERT(pOffScreenDC->GetDeviceCaps(CAPS1)&C1_TRANSPARENT); /* offscreenDC2.CreateCompatibleDC(pdc); CBitmap bitmap2; bitmap2.CreateCompatibleBitmap(pdc,rcBounds.right,rcBounds.bottom); CBitmap* pOldBitmap2; pOldBitmap2=offscreenDC2.SelectObject(&bitmap2); // first draw the background artwork CRect rect; GetWindowRect(rect); CRect parentrect; parent->GetWindowRect(parentrect); int offsetx; int offsety; offsetx=short(offsets & 0x0000FFFF)+parentrect.left-rect.left; offsety=short((offsets & 0xFFFF0000)>>16)+parentrect.top-rect.top; FileNum artwork; artwork=(FileNum)parent->SendMessage(WM_GETARTWORK,NULL,NULL); DrawBitmap(artwork,pOffScreenDC2,offsetx,offsety); */ // now overlay the semi-transparent scrollbar body // if (m_bHorzAlign) // MergeBitmap(FileNum(FIL_HORZSCROLLBAR,pOffScreenDC,0,0); // else // MergeBitmap(FileNum(FIL_VERTSCROLLBAR,pOffScreenDC,0,0); if (m_bHorzAlign) { DrawTiledBitmap(FileNum(FIL_HORZ_SCROLLBAR+m_FileNumOffset),pOffScreenDC,SBWIDTH,0,rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH); } else { DrawTiledBitmap(FileNum(FIL_VERT_SCROLLBAR+m_FileNumOffset),pOffScreenDC,0,SBWIDTH,rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH); } /* int x; if (m_bHorzAlign) { for (x=32;x<rcBounds.right-rcBounds.left-32;x+=128) DrawBitmap(FileNum(FIL_HORZ_SCROLLBAR,pOffScreenDC,x,0); } else { for (x=32;x<rcBounds.bottom-rcBounds.top-32;x+=128) DrawBitmap(FileNum(FIL_VERT_SCROLLBAR,pOffScreenDC,0,x); }*/ // MergeDCs(pOffScreenDC2,pOffScreenDC); /* // supported in Windoze 98 only // MergeDCs does the same thing however GetClientRect(rect); BLENDFUNCTION blendfunction; blendfunction.blendOp=AC_SRC_OVER; blendfunction.blendFlags=NULL; blendfunction.SourceConstantAlpha=127; blendfunction.AlphaFormat=NULL; AlphaBlend(pOffScreenDC->m_hDC,0,0,rect.right,rect.bottom, pdc->m_hDC,0,0,rect.right,rect.bottom,blendfunction); */ // now draw the puck if (m_bHorzAlign) { int divisor=m_pagesize+m_lMaxValue-m_lMinValue; int puckwidth=0; if (divisor>0) puckwidth=(m_pagesize*(rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND))/divisor; int puckpos=(m_iScrollPos*(rcBounds.right-rcBounds.left-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND-puckwidth))/(m_lMaxValue-m_lMinValue); DrawTransparentBitmap(FileNum(FIL_PUCK_LEFT+m_FileNumOffset),pOffScreenDC,SBWIDTH+puckpos,PUCKGAP); DrawTransparentBitmap(FileNum(FIL_PUCK_RIGHT+m_FileNumOffset),pOffScreenDC,SBWIDTH+PUCKEND+puckpos+puckwidth,PUCKGAP); // for (int x=32+12+puckpos;x<32+12+puckpos+puckwidth;x++) // { // DrawBitmap(FileNum(FIL_PUCK_MIDDLE_HORZ,pOffScreenDC,x,PUCKGAP); // } DrawTiledBitmap(FileNum(FIL_PUCK_MIDDLE_HORZ+m_FileNumOffset),pOffScreenDC,SBWIDTH+PUCKEND+puckpos,PUCKGAP,puckwidth); } else { int divisor=m_pagesize+m_lMaxValue-m_lMinValue; int puckwidth=0; if (divisor>0) puckwidth=(m_pagesize*(rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND))/divisor; int puckpos=(m_iScrollPos*(rcBounds.bottom-rcBounds.top-SBWIDTH-SBWIDTH-PUCKEND-PUCKEND-puckwidth))/(m_lMaxValue-m_lMinValue); DrawTransparentBitmap(FileNum(FIL_PUCK_TOP+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+puckpos); DrawTransparentBitmap(FileNum(FIL_PUCK_BOTTOM+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+PUCKEND+puckpos+puckwidth); // for (int x=32+PUCKEND+puckpos;x<32+PUCKEND+puckpos+puckwidth;x++) // { // DrawBitmap(FileNum(FIL_PUCK_MIDDLE_VERT,pOffScreenDC,PUCKGAP,x); // } DrawTiledBitmap(FileNum(FIL_PUCK_MIDDLE_VERT+m_FileNumOffset),pOffScreenDC,PUCKGAP,SBWIDTH+PUCKEND+puckpos,puckwidth); } // now draw the buttons at the ends FileNum filenum; if (m_button==1) filenum=FileNum(FIL_SCROLLBAR_BUTTON_DOWN+m_FileNumOffset); else filenum=FileNum(FIL_SCROLLBAR_BUTTON_UP+m_FileNumOffset); DrawBitmap(filenum,pOffScreenDC,0,0); if (m_button==2) filenum=FileNum(FIL_SCROLLBAR_BUTTON_DOWN+m_FileNumOffset); else filenum=FileNum(FIL_SCROLLBAR_BUTTON_UP+m_FileNumOffset); if (m_bHorzAlign) DrawBitmap(filenum,pOffScreenDC,rcBounds.right-SBWIDTH,0); else DrawBitmap(filenum,pOffScreenDC,0,rcBounds.bottom-SBWIDTH); pdc->BitBlt(0,0,rcBounds.right-rcBounds.left,rcBounds.bottom-rcBounds.top,pOffScreenDC, 0,0,SRCCOPY); // flips offscreen dc to real dc pOffScreenDC->SelectObject(pOldBitmap); // then delete the dc // offscreenDC2.SelectObject(pOldBitmap2); // offscreenDC2.DeleteDC(); m_bDrawing=FALSE; }
void Common::DrawExit(HDC hDC) { DrawTransparentBitmap(hDC, Exit.left - 30, Exit.top - 10, hbit[2], 255, 0, 255); }
void Common::DrawMain(HDC hDC) { DrawTransparentBitmap(hDC, Main.left - 30, Main.top - 10, hbit[3], 255, 0, 255); }
void Common::DrawReturn(HDC hDC) { DrawTransparentBitmap(hDC, Return.left - 30, Return.top - 10, hbit[1], 255, 0, 255); }
void Common::DrawEnter(HDC hDC) { DrawTransparentBitmap(hDC, Enter.left, Enter.top, hbit[0], 255, 0, 255); }