Re: Can some expert tell me how to put a PNG in a Button?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




It sounds like the OP is not a *reader*, he is a *writer*:
he repeats the same question in a lot of Forums/NGs but doesn't read the
answers:
http://www.codeguru.com/forum/showthread.php?t=468195
http://www.dreamincode.net/forums/showtopic79323.htm
http://groups.google.com/group/microsoft.public.win32.programmer.gdi/browse_thread/thread/1e1f59bd5beef501?hl=en&ie=UTF-8&q="Can+some+expert+tell+me+how+to+put+a+PNG+in+a+Button"#34839a77ca72d44e
http://groups.google.com/group/microsoft.public.win32.programmer.ui/browse_thread/thread/e1d930b9b016a56a?hl=en&ie=UTF-8&q="Can+some+expert+tell+me+how+to+put+a+PNG+in+a+Button"#a3918348fa1ed2e0

Victor

"AntiBNI" <elitescript@xxxxxxxxxxx> wrote in message
news:EB83665B-D9B0-4888-B49A-661FC86A77AB@xxxxxxxxxxxxxxxx
I've been trying to draw a PNG on a Button for a long time without any
luck.

There is no documentation, Tutorial, Post or any kind of information abut
how to draw a Transparent PNG image on a CButton or CBitmapButton.

So, I really need some help on how to do it.

I tried:

----------------------------------------------Code-----------------------------------

void MyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{

// TODO: Add your code to draw the specified item
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
CRect rt;
rt = lpDrawItemStruct->rcItem;


Graphics grpx(dc);

Rect rect(50,20,100,100); //Size and Pos of the Image


Image * Img = Image::FromFile(L"C:\\Img.png",FALSE);//Image
Destination

grpx.DrawImage(Img,rect);//Draw The PNG on the Button

dc.SetTextColor(RGB(0,0,255));

CString Temp;
GetWindowText(Temp);

dc.DrawText(Temp,rt,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

dc.Detach();
}

----------------------------------------End of
Code-------------------------------------------------------

But it doesn't work at all...


This will Improve my GUIs dramatically.





.



Relevant Pages

  • Re: Can some expert tell me how to put a PNG in a Button?
    ... luck. ... There is no documentation, Tutorial, Post or any kind of information abut how to draw a Transparent PNG image on a CButton or CBitmapButton. ...
    (microsoft.public.vc.mfc)
  • Can some expert tell me how to put a PNG in a Button?
    ... There is no documentation, Tutorial, Post or any kind of information abut how to draw a Transparent PNG image on a CButton or CBitmapButton. ...
    (microsoft.public.win32.programmer.gdi)
  • Can some expert tell me how to put a PNG in a Button?
    ... There is no documentation, Tutorial, Post or any kind of information abut how to draw a Transparent PNG image on a CButton or CBitmapButton. ...
    (microsoft.public.vc.mfc)
  • Re: hows that for cose?
    ... All teams get massive strokes of good and bad fortune, but they won't always be in games where it matters. ... Bad luck in a game where the result really matters is not balanced by good fortune when it is not really needed. ... Only 2 points for a win will make a draw a decent result and will lead to dire defensive football. ...
    (uk.sport.football.clubs.liverpool)
  • Re: New to MS
    ... there are lots of meds that are there to help slow the progression. ... I don't know of a site, but I agree with Jennifer about the luck of the draw. ... There are lots of promising avenues of research, however, and Jennifer's skepticism aside, there could be a cure or effective treatment tomorrow for all we know. ...
    (alt.support.mult-sclerosis)