-
May 13th, 2004, 04:57 AM
#1
SDI CFormView App
Hi,
I have a SDI App where the view is based on CFormView, I have successfully put a bitmap in the background of the CFormView by using the following code in the OnPaint Function:
Code:
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap bitmap;
CBitmap * pbitmap;
bitmap.LoadBitmap(IDB_OVERALL);
pbitmap = memDC.SelectObject(&bitmap);
CRect Rect;
GetClientRect(&Rect);
int iDeltaX = 0;
dc.BitBlt(iDeltaX, 0, Rect.Width(), Rect.Height(), &memDC, 0, 0, SRCCOPY);
memDC.SelectObject(pbitmap);
This is fine however it is set against the left side and I want the bitmap centered. In order to do this I need the width of the bitmap, any ideas?
Also if possible I would like to disable the window from being resized, I want the app to remain maximised, is this possible?
Thanks in advance.
KnNeeded.
-
May 13th, 2004, 05:30 AM
#2
I need the width of the bitmap, any ideas?
To get a bitmap size use CBitmap::GetBitmap method:
Code:
BITMAP bm;
VERIFY(bitmap.GetBitmap(&bm));
int height = bm.bmHeight;
int width = bm.bmWidth,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|