Questions tagged [cbitmap]
27 questions
11
votes
3 answers
How do you scale a CBitmap object?
I've loaded a CBitmap object from a resource ID, and I'm now wanting to scale it to 50% its size in each dimension. How might I go about this?

Smashery
- 57,848
- 30
- 97
- 128
8
votes
6 answers
how to add bitmap image to buttons in MFC?
I am Trying to add an image to an existing button..I have done that to an extent, the problem is I can add an ownerdrawn Image but am not able to add the extact image that I want.. for the example see the below code
CButton* pBtn=…

kiddo
- 1,596
- 7
- 31
- 60
3
votes
2 answers
MFC copy part of the screen into a CBitmap
Using the function
OnEraseBkgnd(CDC* pDC)
I write on the CDialog derived class, a background image that fills the screen.
Then inside the OnPaint I have the following code that is executed only once (for the 1st time OnPaint is called).
…

Maverick
- 1,105
- 12
- 41
3
votes
1 answer
Save a CBitmap to .bmp file
I'm working with a CBitmap object using a CDC. When I'm finished with it I want to save it to a file. I have seen something about a process with that code LINK:
CFile file;
if(file.Open(szFileName, CFile::modeCreate | CFile::modeWrite))
{
…

jabujavi
- 477
- 5
- 15
2
votes
1 answer
Beginner In MFC C++, why does the device context need to create an old Font/Bitmap/etc pointer and then selectObject() it at the end?
Case in point:
void CMainWindow::OnPaint ()
{
CRect rect;
GetClientRect (&rect);
CPaintDC dc (this);
dc.SetViewportOrg (rect.Width () / 2, rect.Height () / 2);
dc.SetBkMode (TRANSPARENT);
for (int i=0; i<3600; i+=150) {
…

Moe45673
- 854
- 10
- 20
2
votes
2 answers
Can't Display Bitmap of Higher Resolution than CDC area
Hi there dear gurus and expert coders.
i am not gonna start with im a newbie and don't know much about image programming but unfortunately those are the facts :(
I am trying to display an image from a bitmap pointer *ImageData which is of…

T. Jones
- 23
- 3
2
votes
1 answer
Transfer an image from CDC to CBitmap
How can I transfer an image from CDC to CBitmap?
The problem in whole:
I have a big image into CBitmap A. I need to transfer parts of this image to a number of CBitmap for the storage into a vector, because I can't use a number of CDC for this :)
I…

Seer
- 45
- 2
- 7
2
votes
1 answer
How do I correctly convert an ICON to a BITMAP using MFC?
I'm loading an ICON of another application via
HICON ico = ExtractIcon(NULL, L"path\\to\\OtherApp.exe", 0);
How can I create a CBitmap object from this icon?
Specifically (not really answered in the dup question for me):
Which device context?
At…

Martin Ba
- 37,187
- 33
- 183
- 337
1
vote
0 answers
Changing CBitmap storage on clipboard from OpenClipboard()/CloseClipboard() to COleDataSource (MFC)
I have an MFC app that stores a CBitmap on the clipboard using OpenClipboard()/SetClipboardData()/CloseClipboard():
if(OpenClipboard())
{
if(EmptyClipboard())
{
SetClipboardData(CF_BITMAP, pBitmap->m_hObject);
…

Steve A
- 1,798
- 4
- 16
- 34
1
vote
1 answer
MFC: CBitmapCreateCompatibleBitmap() gives different results based on two compatible CDC's passed to it?
Why would passing a compatible DC and the DC the compatible one is based on to CreateCompatibleBitmap() give different results?
This one creates a monochrome bitmap:
CDC dcMem;…

df234987
- 513
- 2
- 13
1
vote
2 answers
LoadBitmap fails after multiple calls
In this function, after about 90 calls (it's called in a loop and the idea is to load in a separate image each time, but I have kept it to one image for simplicity).The global variables now changed to local ones.
void…

Michael Dutton
- 49
- 6
1
vote
2 answers
Screen capture only returns a black image
I'm trying to take a screen capture of the main dialog in my MFC application and save it as an image file. I tried about every example I could find online and always end up with the same result: the image file has the correct dimensions (I tried…

jimturmoy
- 33
- 8
1
vote
1 answer
c++ - mfc / want to add bitmap to cbutton. CButton has no member setBitmap and BM_SETIMAGE is also not available for sendMessage
this is my first question on stackoverflow and i hope i do everything right:S
As described in my titel i am working on a visual studio(2012) project with mfc.
I try to add a bitmap to my cbutton, which was inserted in the design view to my…

sadermader
- 23
- 5
1
vote
1 answer
Convert CBitmap object to CxImage object MFC
I have a CBitmap object "m_bmp". I need to convert this to a CxImage Object. Any ideas? Is there any direct conversion from bitmap object to other types available from CxImage?

esh
- 2,842
- 5
- 23
- 39
0
votes
1 answer
Why is my stretchblt images losing colours?
I am having some difficulties in correctly populating a CListCtrl with thumbnails of monitor displays.
On the right of my CDialog I have a static control and I render the image on a white canvas like this:
void…

Andrew Truckle
- 17,769
- 16
- 66
- 164