c++ Non MFC Icon on button without border?

OK so after looking into somethings with my program I need to create a flat button without a border and when I do this I can't use the BS_ICON or else it will display the 1x1 border.

So I'm sure now that I have to use bitblt to draw my icon with a transparent bg onto the buttons background which would be the DC if I'm not mistaken?

Anyways I'm going to be looking more into this online and in a separate program try to draw the icon within the button without a border.

Just in case I'm come across some problems which I know I will and I'll post the code at that time could someone explain to me how to get this accomplish?

and trust me I just don't want someone to give me the answer like post the code and use it from there. I like to learn these things but if some one could explain to me how to accomplish this?

Thanks everyone
Last edited on
ok so this is the code I have.
Everything in the resource file seems to be correct as I checked with the an resource editor and it shows the icon is within my program.

Heres the code:
1
2
3
4
5
        HWND button=CreateWindowEx(0,"Button","",WS_CHILD,0,0,32,32,hwnd,0,0,0);
        HICON hbmPWSCommandOVERVIEW=(HICON)LoadImage(app_hInstance, MAKEINTRESOURCE(button_icon),IMAGE_ICON,14,14,0);
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hwnd, &ps);
        DrawIcon(hdc,32,32,hbmPWSCommandOVERVIEW);


I tried using DrawIcon and within my form I still don't see anything as its all white.

So where did I mess up at and all?

Thanks

also if its also possible to use bitblt for this then please let me know.


I know that I said I was trying to draw and icon on the button, what i'm trying to do is draw it onto the form first then change the hwnd to the button to draw on the button instead. Thanks :D
ok so I'm still having some problems and I got most of the top code to work except that it has to be HBITMAP. Is there anyway I can work with icons instead of bitmaps for buttons?

I have to draw it mannualy instead of using the BS_ICON style.

Thanks
Ok so I'm stuck with the BS_OWNERDRAW Style.

So far I've been searching the last few days and all I can find is MFC examples.

I need to do this in pure API only without MFC and I can't find any hints or some examples for C++

So i'm lost and have no idea where to go from here

any help would be appreciated
Thanks everyone
Topic archived. No new replies allowed.