Article | 41023586 |
Type | HowTo |
Product | Engine |
Version | 5.0.0.1033 |
Date Added | 5/27/2004 |
Submitted by | Damon CNC Developer |
Keywords |
Some of our users also use other design software which allows the user to choose DirectX for graphics and set a gradient drawing background, as trivial as this may seem many users want this, if you could add this to your wishlist that would be great.
In 5.0.0.1033 you can use the DrawBackground event as follow:
void CVdView::OnDrawBackgroundvdrawctrl2(LPDISPATCH Render, short FAR*
Cancel)
{
CPicture pic =
m_Vdraw.GetUtility().GetFilePicture(_T("C:\\_TRAMBA\\A71\\0513_humornanet_com_an.jpg"));
CvdRender
rend;
rend.AttachDispatch(Render,FALSE);
HDC hdc =
(HDC)rend.GetHdc();
HDC hScreen = ::GetDC(NULL);
HDC hDC
= ::CreateCompatibleDC(hScreen);
CSize
size(pic.GetWidth(),pic.GetHeight());
CDC::FromHandle(hdc)->HIMETRICtoLP
(&size);
::ReleaseDC(NULL,hScreen);
HBITMAP hOldBitmap =
(HBITMAP)::SelectObject(hDC,(HBITMAP)pic.GetHandle());
StretchBlt(hdc,0,
0, rend.GetWidth(), rend.GetHeight(),
hDC,0,0,
size.cx,size.cy,SRCCOPY);
::SelectObject(hDC,hOldBitmap);
DeleteDC(hDC);
*Cancel
= 1;
}