Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resize the bitmap for bitmap button

Status
Not open for further replies.

joice

Programmer
Nov 22, 2000
11
0
0
SG
Hi all;
I need to resize the CBitmapButton for different cases. But I do not how to make the bitmap size change to fit in the button. Now it just cut off the bitmap to make it small but not scale it. Anyway to scale the bitmap to let it fit the button properly?
Thank you very much for your help!
 
joice,

There are many techniques you might use. Here is one:

Use memory device contexts and use StretchBlt() to resize the bitmap from one context into another. See the GDI SDK documentation for StretchBlt() or CDC::StretchBlt() documentation.

Another would be to use an imaging algorithm to resize the image. Perhaps from a imaging library that you purchase or download off the net. Of course you could write your own routine.

Hope this helps
-pete
 
Thank you for your help. But I do not know how to use CDC. I have once used it at which time, I overwrite the CBitmapButton class, then I call CDC::StrentchBlt() in DrawItem. However, this time, I do not have such a class, then I do not how to use it. Do you have an example or tell me more about how to make use of this method.
Thank you!
 
I guess StretchBlt() is also part of the windows SDK, which you could use to call. ::StretchBlt (...)

Sriks
 
Still blur of how to use it. In ::stretchBlt, I still need to pass it HDC, which I do not know what to pass. I am also strange of where to put the bitmap name, what I am using now is
VERIFY(m_button_exit.LoadBitmaps(_T("exit"), NULL, NULL));

Can u pls help me to give me example of how to do that?
Thank you!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top