19,468
社区成员
发帖
与我相关
我的任务
分享
CPaintDC dc(this); // device context for painting
// 指针
Image image(L"Indicator.png");
int w,h;
w=image.GetWidth();
h=image.GetHeight();
// 背景
CRect rect;
rect.SetRect(0,0,w,h);
// on memDC
CDC memDC;
memDC.CreateCompatibleDC(&dc);
HBITMAP hbmp=CreateCompatibleBitmap(dc.m_hDC,w,h);
memDC.SelectObject(hbmp);
Graphics graphics(memDC.m_hDC);
// argb 背景与对话框同色
SolidBrush brush1(Color(255,210,210,210));
graphics.FillRectangle(&brush1, 0, 0, w, h);
// background 画面板
Image imageBk(L"Pannel.png");
TextureBrush brush(&imageBk);
graphics.FillRectangle(&brush,0,0,w,h);//
// moveto center
graphics.TranslateTransform((REAL)(w/2),(REAL)(h/2));
// ratate 90 degree
graphics.RotateTransform(131.0);// 原图有 offset = 42.0 degree
// move back
graphics.TranslateTransform((REAL)(-w/2),(REAL)(-h/2));
// draw indicator 指针
graphics.DrawImage(&image,0,0,w,h);
// draw to screen
HDC hdc = graphics.GetHDC();
::BitBlt(dc.m_hDC,0,0,w,h,hdc,0,0,SRCCOPY);
graphics.ReleaseHDC(hdc);
CPaintDC dc(this); // device context for painting
Image image(L"Indicator.png");
int w,h;
w=image.GetWidth();
h=image.GetHeight();
CRect rect;
rect.SetRect(0,0,w,h);
//
CDC memDC;
memDC.CreateCompatibleDC(&dc);
HBITMAP hbmp=CreateCompatibleBitmap(dc.m_hDC,w,h);
memDC.SelectObject(hbmp);
// memDC
Graphics graphics(memDC.m_hDC);
// argb
SolidBrush brush(Color(128,128,255,255));
graphics.FillRectangle(&brush,0,0,w,h);//
//
graphics.TranslateTransform((REAL)(w/2),(REAL)(h/2));
graphics.RotateTransform(45.0);
graphics.TranslateTransform((REAL)(-w/2),(REAL)(-h/2));
graphics.DrawImage(&image,0,0,w,h);
HDC hdc = graphics.GetHDC();
::BitBlt(dc.m_hDC,0,0,w,h,hdc,0,0,SRCCOPY);
graphics.ReleaseHDC(hdc);