本文整理汇总了C++中CDC::CreateDC方法的典型用法代码示例。如果您正苦于以下问题:C++ CDC::CreateDC方法的具体用法?C++ CDC::CreateDC怎么用?C++ CDC::CreateDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDC
的用法示例。
在下文中一共展示了CDC::CreateDC方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetScreenDataSize
BOOL CScreenSnap::GetScreenDataSize(DWORD &dwScreenDataSize)
{
CDC dc;
dc.CreateDC("DISPLAY",NULL,NULL,NULL);
CheckPointer(dc.GetSafeHdc(),FALSE);
CBitmap bm;
int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CYSCREEN);
if(!bm.CreateCompatibleBitmap(&dc,nWidth,nHeight))
{
dc.DeleteDC();
return FALSE;
}
BITMAP btm;
bm.GetBitmap(&btm);
dwScreenDataSize = btm.bmWidthBytes * btm.bmHeight;
dwScreenDataSize += sizeof(BITMAPFILEHEADER);
dwScreenDataSize += sizeof(BITMAPINFOHEADER);
dc.DeleteDC();
return TRUE;
}
示例2: OnInitDialog
LRESULT CScreenDlg::OnInitDialog(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled){
ShowWindow(SW_HIDE);
CDC dcScreen;
dcScreen.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
m_size.cx = GetDeviceCaps(dcScreen.m_hDC, HORZRES);
m_size.cy = GetDeviceCaps(dcScreen.m_hDC, VERTRES);
m_dcMem.CreateCompatibleDC(dcScreen.m_hDC);
m_bmpScreen.CreateCompatibleBitmap(dcScreen.m_hDC, m_size.cx,m_size.cy);
HBITMAP pOldBmp = m_dcMem.SelectBitmap(m_bmpScreen.m_hBitmap);
m_dcMem.BitBlt(0,0,m_size.cx, m_size.cy, dcScreen.m_hDC, 0, 0, SRCCOPY);
RECT rect={0,0,m_size.cx, m_size.cy};
MoveWindow(&rect);
ShowWindow(SW_SHOW);
RIGHT_RECT.left = m_size.cx - INFO_WIDTH-INFO_OFFSET;
RIGHT_RECT.right = m_size.cx-INFO_OFFSET;
m_bmpInfoBK = (HBITMAP)c6beeres::R().GetImg(IDB_BITMAP_INFOBK,IMAGE_BITMAP,INFO_WIDTH,INFO_HEIGHT);
S1= (HBITMAP)c6beeres::R().GetImg(IDB_S1,IMAGE_BITMAP,shadow_size,shadow_size);
S2= (HBITMAP)c6beeres::R().GetImg(IDB_S2,IMAGE_BITMAP,shadow_size,shadow_size);
S3= (HBITMAP)c6beeres::R().GetImg(IDB_S3,IMAGE_BITMAP,shadow_size,shadow_size);
S4= (HBITMAP)c6beeres::R().GetImg(IDB_S4,IMAGE_BITMAP,shadow_size,shadow_size);
S5= (HBITMAP)c6beeres::R().GetImg(IDB_S5,IMAGE_BITMAP,shadow_size,shadow_size);
thinfont = ::CreateFont(15,0,0,0,FW_THIN,false,FALSE,FALSE,DEFAULT_CHARSET,OUT_STRING_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_MODERN,_T("arial"));
boldfont= ::CreateFont(15,0,0,0,FW_BOLD,false,FALSE,FALSE,DEFAULT_CHARSET,OUT_STRING_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_MODERN,_T("arial"));
penLine1.CreatePen(PS_SOLID, 1, SELECT_RECTCOLOR);
penLine2.CreatePen(PS_SOLID, 1, CROSS_LINECOLOR);
bool border=false,shadow=false;
COLORREF bcolor=0;
nsplugin::GetImgCapParam(border,shadow,bcolor);
pen_Border.CreatePen(PS_SOLID, border_size, bcolor);
return 0;
}
示例3: SetFont
BOOL CPMenuSpecial::SetFont (CFont &pFont)
{
TEXTMETRIC tm;
CFont *pOldFont;
CDC TVDC;
LOGFONT LogFont;
m_Font.DeleteObject ();
if (pFont.GetObject (sizeof (LogFont), &LogFont) != 0)
{
if (m_Font.CreateFontIndirect (&LogFont) != 0)
{
if (m_Font.GetObject (sizeof (LogFont), &LogFont) != 0)
{
if (TVDC.CreateDC ("DISPLAY", NULL, NULL, NULL) != 0)
{
if ((pOldFont = TVDC.SelectObject (&m_Font)) != NULL)
{
TVDC.GetTextMetrics (&tm);
m_nDefaultTextHeight = tm.tmHeight;
TVDC.SelectObject (pOldFont);
return TRUE;
}
}
}
m_Font.DeleteObject ();
}
}
return FALSE;
}
示例4: Capture
void CViewBitmap::Capture(CRect &rect)
{
if(m_pPalette)
{ DeleteObject();
delete m_pPalette;
}
m_width=rect.Width();
m_heighth=rect.Height();
double wid=rect.left/1024;
double hei=rect.top/768;
CDC dcscreen;
dcscreen.CreateDC("DISPLAY",NULL,NULL,NULL);
CDC dcMem;
dcMem.CreateCompatibleDC( &dcscreen );
CreateCompatibleBitmap( &dcscreen, m_width, m_heighth );
dcMem.SelectObject( this );
dcMem.BitBlt(0,0,m_width, m_heighth,&dcscreen,rect.left,rect.top,SRCCOPY);
// create an empty logical palette that¡¯s big enough to hold all the colors
int nColors = ( 1 << ( dcscreen.GetDeviceCaps( BITSPIXEL ) *dcscreen.GetDeviceCaps( PLANES ) ) );
LOGPALETTE *pLogpal=(LOGPALETTE*) new BYTE[sizeof(LOGPALETTE)+(nColors * sizeof(PALETTEENTRY))];
pLogpal -> palVersion = 0x300;
pLogpal -> palNumEntries = nColors;
// load this empty palette with the system palette's colors
GetSystemPaletteEntries( dcscreen.m_hDC, 0, nColors,(LPPALETTEENTRY)(pLogpal->palPalEntry));
m_pPalette = new CPalette;
m_pPalette -> CreatePalette( pLogpal );
delete []pLogpal;
dcMem.DeleteDC();
dcscreen.DeleteDC();
}
示例5: OnDcCdc
void CMFCDCView::OnDcCdc()
{
// TODO: Add your command handler code here
CDC dc;
dc.CreateDC("DISPLAY",NULL,NULL,NULL);
//输出信息
dc.TextOut(100,100,"Hello CDC");
dc.DeleteDC();
}
示例6: ConvertFont
void COptionTreeFontSel::ConvertFont(LOGFONT &lf, CHARFORMAT &cfFont)
{
// Declare variables
CDC dc;
dc.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
long yPerInch = dc.GetDeviceCaps(LOGPIXELSY);
// Create log font
// -- Font name
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = cfFont.bPitchAndFamily;
_tcscpy(lf.lfFaceName, cfFont.szFaceName);
// -- Size
lf.lfHeight = abs(((cfFont.yHeight * yPerInch) / 1440));
lf.lfWidth = 0;
lf.lfEscapement = 0;
// -- Bold
if (cfFont.dwEffects & CFE_BOLD)
{
lf.lfWeight = FW_BOLD;
}
else
{
lf.lfWeight = FW_NORMAL;
}
// -- Strikeout
if (cfFont.dwEffects & CFE_STRIKEOUT)
{
lf.lfStrikeOut = TRUE;
}
else
{
lf.lfStrikeOut = FALSE;
}
// -- Underline
if (cfFont.dwEffects & CFE_UNDERLINE)
{
lf.lfUnderline = TRUE;
}
else
{
lf.lfUnderline = FALSE;
}
// -- Italic
if (cfFont.dwEffects & CFE_ITALIC)
{
lf.lfItalic = TRUE;
}
else
{
lf.lfItalic = FALSE;
}
}
示例7: PrepareWindow
// Protected member functions
BOOL COXScreenGrabber::PrepareWindow(BOOL bClient, CRect& ScrRect, CWnd* pWnd)
{
if (pWnd == NULL)
pWnd = CWnd::GetForegroundWindow();
if (pWnd == NULL)
pWnd = CWnd::GetDesktopWindow();
ASSERT(pWnd != NULL);
if (!pWnd->IsWindowVisible())
return FALSE;
if (pWnd == CWnd::GetDesktopWindow())
{
// create a DC for the screen and create
CDC SreenDC;
if (!SreenDC.CreateDC(_T("DISPLAY"), NULL, NULL, NULL))
return FALSE;
// get screen resolution and set Rect
ScrRect.left = 0;
ScrRect.top = 0;
ScrRect.right = SreenDC.GetDeviceCaps(HORZRES);
ScrRect.bottom = SreenDC.GetDeviceCaps(VERTRES);
SreenDC.DeleteDC();
}
else
{
// Move window which was selected to top of Z-order for
// the capture, and make it redraw itself
pWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOMOVE);
pWnd->UpdateWindow();
if (bClient)
{
// get the client area dimensions
pWnd->GetClientRect(&ScrRect);
// convert client coords to screen coords
CPoint pt1(ScrRect.left, ScrRect.top);
CPoint pt2(ScrRect.right, ScrRect.bottom);
pWnd->ClientToScreen(&pt1);
pWnd->ClientToScreen(&pt2);
ScrRect.left = pt1.x;
ScrRect.top = pt1.y;
ScrRect.right = pt2.x;
ScrRect.bottom = pt2.y;
}
else
pWnd->GetWindowRect(&ScrRect);
}
return TRUE;
}
示例8: MakeImage
KernelBitmap* SGNameDrag::MakeImage(UINT32 nDepth)
{
// If there's no current View, or no Spread, then fail.
DocView* pView = DocView::GetCurrent();
if (pView == 0) return 0;
Spread* pSpread = pView->FindEnclosingSpread(OilCoord(0, 0));
if (pSpread == 0) return 0;
// Create a device context for the display.
CDC sdc;
sdc.CreateDC("DISPLAY", 0, 0, 0);
// Calculate the size of the rendering and set up the rendering matrix etc.
Matrix matConvert;
FIXED16 fxScale = 1;
INT32 nSel = NameGallery::Instance()->GetSelectedItemCount();
DocRect drClip(0, 0, SG_DefaultNameText, nSel * SG_DefaultSmallIcon);
// Work out the destination bitmap's characteristics.
double dpi = (double) GetDeviceCaps(sdc.m_hDC, LOGPIXELSX);
if (nDepth == 0)
nDepth = GetDeviceCaps(sdc.m_hDC, BITSPIXEL) * GetDeviceCaps(sdc.m_hDC, PLANES);
// Create a render region with the given properties of the display etc.
GRenderBitmap* pRenderer = new GRenderBitmap(drClip, matConvert, fxScale, nDepth, dpi);
ERRORIF(pRenderer == 0, _R(IDE_NOMORE_MEMORY), 0);
pRenderer->AttachDevice(pView, &sdc, pSpread);
pRenderer->StartRender();
pRenderer->SaveContext();
// Blank the background.
pRenderer->SetLineWidth(0);
pRenderer->SetLineColour(COLOUR_WHITE);
pRenderer->SetFillColour(COLOUR_WHITE);
pRenderer->DrawRect(&drClip);
// Render the item's name.
DocColour dcText(COLOUR_BLACK), dcBack(COLOUR_WHITE);
pRenderer->SetFixedSystemTextColours(&dcText, &dcBack);
String_256 strName;
m_pSourceItem->GetNameText(&strName);
pRenderer->DrawFixedSystemText(&strName, drClip);
// Create a kernel bitmap from the OIL bitmap and return it.
pRenderer->RestoreContext();
pRenderer->StopRender();
OILBitmap* pOilMaskBmp = pRenderer->ExtractBitmap();
delete pRenderer;
KernelBitmap* pkb = new KernelBitmap(pOilMaskBmp, TRUE);
ERRORIF(pkb == 0, _R(IDE_NOMORE_MEMORY), 0);
return pkb;
}
示例9: FillInLogFont
DWORD CFontDialog::FillInLogFont(const CHARFORMAT& cf)
{
USES_CONVERSION;
DWORD dwFlags = 0;
if (cf.dwMask & CFM_SIZE)
{
CDC dc;
dc.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
LONG yPerInch = dc.GetDeviceCaps(LOGPIXELSY);
m_lf.lfHeight = -(int) ((cf.yHeight * yPerInch) / 1440);
}
else
m_lf.lfHeight = 0;
m_lf.lfWidth = 0;
m_lf.lfEscapement = 0;
m_lf.lfOrientation = 0;
if ((cf.dwMask & (CFM_ITALIC|CFM_BOLD)) == (CFM_ITALIC|CFM_BOLD))
{
m_lf.lfWeight = (cf.dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL;
m_lf.lfItalic = (BYTE)((cf.dwEffects & CFE_ITALIC) ? TRUE : FALSE);
}
else
{
dwFlags |= CF_NOSTYLESEL;
m_lf.lfWeight = FW_DONTCARE;
m_lf.lfItalic = FALSE;
}
if ((cf.dwMask & (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) ==
(CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR))
{
dwFlags |= CF_EFFECTS;
m_lf.lfUnderline = (BYTE)((cf.dwEffects & CFE_UNDERLINE) ? TRUE : FALSE);
m_lf.lfStrikeOut = (BYTE)((cf.dwEffects & CFE_STRIKEOUT) ? TRUE : FALSE);
}
else
{
m_lf.lfUnderline = (BYTE)FALSE;
m_lf.lfStrikeOut = (BYTE)FALSE;
}
if (cf.dwMask & CFM_CHARSET)
m_lf.lfCharSet = cf.bCharSet;
else
dwFlags |= CF_NOSCRIPTSEL;
m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
m_lf.lfQuality = DEFAULT_QUALITY;
if (cf.dwMask & CFM_FACE)
{
m_lf.lfPitchAndFamily = cf.bPitchAndFamily;
lstrcpy(m_lf.lfFaceName, A2T((LPSTR)cf.szFaceName));
}
else
{
m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
m_lf.lfFaceName[0] = (TCHAR)0;
}
return dwFlags;
}
示例10: PrintInit
/***************************************************
PrintInit
Initializes and sets up the data that needs to
be calculated to perform the actual print. Such
tasks include calcualating the number of pages
required to print the given range, and the scale.
Params
pDC - device context for the printer (or print preview)
pPD - pointer to the print dialog information
startCol- leftmost column to print on the page
endCol - rightmost column to print on the page
startRow- topmost row to print on the page
endRow - bottom most row to print on the page
Return
number of pages that will be printed
****************************************************/
int CUGPrint::PrintInit(CDC * pDC, CPrintDialog* pPD, int startCol,long startRow,
int endCol,long endRow)
{
UNREFERENCED_PARAMETER(pPD);
ClearPrintList();
//get a screen device context
CDC sDC;
sDC.CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
//check to see if the request if for printing or print preview
m_bIsPreview = FALSE;
SIZE size;
pDC->SetMapMode(MM_ANISOTROPIC);
SetWindowExtEx(pDC->m_hDC,1,1,&size);
if(size.cx != 1){
m_bIsPreview = TRUE;
SetWindowExtEx(pDC->m_hDC,size.cx,size.cy,&size);
}
//get the metrics for the printer
float paperWidthPX = (float)pDC->GetDeviceCaps(HORZRES);
float paperHeightPX = (float)pDC->GetDeviceCaps(VERTRES);
float paperWidthMM = (float)pDC->GetDeviceCaps(HORZSIZE);
float paperHeightMM = (float)pDC->GetDeviceCaps(VERTSIZE);
int virtualWidthPX = (int)( 3.79 * (paperWidthMM - m_printLeftMargin - m_printRightMargin));
int virtualHeightPX = (int)( 3.78 * (paperHeightMM - m_printTopMargin - m_printBottomMargin));
//save the scaling values
m_printVScale = ( (paperHeightPX/paperHeightMM) *
(paperHeightMM - m_printTopMargin - m_printBottomMargin) ) /
virtualHeightPX;
m_printHScale = ( (paperWidthPX/paperWidthMM) *
(paperWidthMM - m_printLeftMargin - m_printRightMargin) ) /
virtualWidthPX;
//save the margins
m_printLeftMarginPX = (int)((paperWidthPX/paperWidthMM) * m_printLeftMargin);
m_printTopMarginPX = (int)((paperHeightPX/paperHeightMM) * m_printTopMargin);
m_printRightMarginPX = (int)(paperWidthPX - (paperWidthPX/paperWidthMM) * m_printRightMargin);
m_printBottomMarginPX = (int)(paperHeightPX - (paperHeightPX/paperHeightMM) * m_printBottomMargin);
m_paperWidthPX = (int)paperWidthPX;
m_paperHeightPX = (int)paperHeightPX;
//if not print preview, then addjust values by the virtual pixel width
if(m_bIsPreview == FALSE)
{
m_virPixWidth = (int)paperWidthPX / 450; //300
m_printVScale /= m_virPixWidth;
m_printHScale /= m_virPixWidth;
m_printLeftMarginPX /= m_virPixWidth;
m_printTopMarginPX /= m_virPixWidth;
m_printRightMarginPX /= m_virPixWidth;
m_printBottomMarginPX /= m_virPixWidth;
m_paperWidthPX /= m_virPixWidth;
m_paperHeightPX /= m_virPixWidth;
}
//get the number of pages wide
int col,width=0,w;
int scol = startCol; //start col for a page
m_pagesWide = 0;
if(m_printSideHeading)
width = m_ctrl->GetSH_Width();
//find the number of pages wide and the number of columns
//on each page
for(col =startCol;col <= endCol;col++)
{
m_ctrl->GetColWidth(col,&w);
width += w;
if(width > virtualWidthPX)
{
m_pagesWide++;
if(m_printSideHeading)
width = m_ctrl->GetSH_Width();
else
width = 0;
if(w < virtualWidthPX)
col--;
//.........这里部分代码省略.........
示例11: GetScreenData
BOOL CScreenSnap::GetScreenData(BYTE* pScreenData,DWORD &dwScreenData)
{
CDC dc;
dc.CreateDC("DISPLAY",NULL,NULL,NULL);
CheckPointer(dc.GetSafeHdc(),FALSE);
CBitmap bm;
int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CYSCREEN);
if(!bm.CreateCompatibleBitmap(&dc,nWidth,nHeight))
{
dc.DeleteDC();
return FALSE;
}
CDC tdc;
if(!tdc.CreateCompatibleDC(&dc))
{
dc.DeleteDC();
return FALSE;
}
CBitmap*pOld = tdc.SelectObject(&bm);
if(pOld == NULL)
{
tdc.DeleteDC();
dc.DeleteDC();
return FALSE;
}
tdc.BitBlt(0,0,nWidth,nHeight,&dc,0,0,SRCCOPY);
tdc.SelectObject(pOld);
BITMAP btm;
bm.GetBitmap(&btm);
DWORD nSize = btm.bmWidthBytes * btm.bmHeight;
// LPSTR lpData = (LPSTR)GlobalAllocPtr(GPTR,nSize);
// if(lpData == NULL)
// {
// tdc.DeleteDC();
// dc.DeleteDC();
// return FALSE;
// }
//--------------------------------------------------------
BITMAPINFOHEADER bih;
bih.biBitCount = btm.bmBitsPixel;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
bih.biCompression = 0;
bih.biHeight = btm.bmHeight;
bih.biPlanes = 1;
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biSizeImage = nSize;
bih.biWidth = btm.bmWidth;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
//--------------------------------------------------------
//得到DIB色彩表
if(!GetDIBits(dc,bm,0,bih.biHeight,(pScreenData + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)),(BITMAPINFO*)&bih,DIB_RGB_COLORS))
{
tdc.DeleteDC();
dc.DeleteDC();
return FALSE;
}
//--------------------------------------------------------
BITMAPFILEHEADER bfh;
bfh.bfReserved1 = bfh.bfReserved2 = 0;
bfh.bfType = ((WORD)('M'<< 8)|'B');
bfh.bfSize = 54 + nSize;
bfh.bfOffBits = 54;
memcpy(pScreenData,&bfh,sizeof(BITMAPFILEHEADER));
dwScreenData = sizeof(BITMAPFILEHEADER);
memcpy(pScreenData + dwScreenData,&bih,sizeof(BITMAPINFOHEADER));
dwScreenData += sizeof(BITMAPINFOHEADER);
// memcpy(pScreenData,lpData,nSize);
dwScreenData += nSize;
// GlobalFreePtr(lpData);
tdc.DeleteDC();
dc.DeleteDC();
return TRUE;
}
示例12: Draw
void CLogiTextGate::Draw(CDC* pDC, CLogiView* pView)
{
ASSERT_VALID(this);
// Draw the Bitmap Portion
if (m_iStyle == 1)
{
CRect crBackup = m_position;
CSize csBackup = m_size;
m_position = CRect(m_position.TopLeft(), CSize(BITX_TXT, -BITY_TXT));
m_size = CSize(BITX_TXT, BITY_TXT);
CLogiGate::Draw(pDC, pView);
m_position = crBackup;
m_size = csBackup;
}
// if printing build a bitmap on the fly for the Text.
if (pDC->IsPrinting() || m_pDocument->m_iZoom)
{
CDC MemDC;
MemDC.CreateCompatibleDC(NULL);
pOldFont = MemDC.SelectObject(&m_pDocument->m_cfScreen);
pOldPen = MemDC.SelectObject(&m_pDocument->m_cpBlack);
pOldBrush = MemDC.SelectObject(&m_pDocument->m_cbWhite);
int oldBkMode = MemDC.SetBkMode(TRANSPARENT);
COLORREF oldTextColor = MemDC.SetTextColor(RGB(0, 0, 0));
// calculate the surrounding rectangle of the text only
CSize csExtent;
if (m_bLoaded)
{
csExtent = MemDC.GetTextExtent( m_pTextArray[m_uIndex], m_pTextArray[m_uIndex].GetLength() ) + CSize(4,4);
}
else
{
csExtent = MemDC.GetTextExtent( m_pTextText, m_pTextText.GetLength() ) + CSize(4,4);
}
MemDC.GetTextMetrics(&tm);
if (tm.tmItalic) csExtent += CSize(tm.tmHeight/4,0);
// crate a temperary bitmap to draw the text to (can't be MemDC?)
CBitmap cbGate;
CDC screenDC;
screenDC.CreateDC(L"DISPLAY", NULL, NULL, NULL);
cbGate.CreateCompatibleBitmap(&screenDC, csExtent.cx, csExtent.cy);
screenDC.DeleteDC();
pOldBmp = MemDC.SelectObject(&cbGate);
// draw rectangle also inits bitmap with brush
MemDC.Rectangle(CRect(CPoint(0,0),csExtent));
// draw text
if (m_bLoaded)
{
MemDC.TextOut(2, 2, m_pTextArray[m_uIndex], m_pTextArray[m_uIndex].GetLength());
}
else
{
MemDC.TextOut(2, 2, m_pTextText, m_pTextText.GetLength());
}
MemDC.SelectObject(pOldPen);
MemDC.SelectObject(pOldBrush);
MemDC.SetTextColor(oldTextColor);
MemDC.SetBkMode(oldBkMode);
MemDC.SelectObject(pOldFont);
MemDC.SelectObject(pOldBmp);
// build a DIB from the bitmap
m_Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_Bmi.bmiHeader.biHeight = csExtent.cy;
m_Bmi.bmiHeader.biWidth = csExtent.cx;
m_Bmi.bmiHeader.biPlanes = 1;
m_Bmi.bmiHeader.biBitCount = 4;
m_Bmi.bmiHeader.biCompression = BI_RGB;
m_Bmi.bmiHeader.biSizeImage = 0;
m_Bmi.bmiHeader.biXPelsPerMeter = 0;
m_Bmi.bmiHeader.biYPelsPerMeter = 0;
m_Bmi.bmiHeader.biClrUsed = 16;
m_Bmi.bmiHeader.biClrImportant = 16;
if(!::GetDIBits(MemDC.GetSafeHdc(), (HBITMAP) cbGate.m_hObject, 0, (UINT) m_Bmi.bmiHeader.biHeight, NULL, (LPBITMAPINFO) &m_Bmi, DIB_RGB_COLORS)) return;
if (m_Bmi.bmiHeader.biSizeImage == 0) return;
//.........这里部分代码省略.........