using CBitmapButton
-
I am very new to programming. I have started using Visual C++ 6.0. I am not very familier yet with the terms used in programming. I would like to put a bitmap in place of mu button using CBitmapButton. I have looked over many different sites from MSDN to codeguru trying to find out how to do it. Either I get to the end and it doesn't work for some reason or the words being used are too advanced for me to understand. are there any simpler instructions for using CBitmapButton, on the web? Thank you.
-
I am very new to programming. I have started using Visual C++ 6.0. I am not very familier yet with the terms used in programming. I would like to put a bitmap in place of mu button using CBitmapButton. I have looked over many different sites from MSDN to codeguru trying to find out how to do it. Either I get to the end and it doesn't work for some reason or the words being used are too advanced for me to understand. are there any simpler instructions for using CBitmapButton, on the web? Thank you.
It's in MSDN. Here is it's example followed by my example. Make sure you do as it says and either call create with BS_OWNERDRAW or edit the button in the resource workshop and check on OwnerDraw in the properties for the button.
Example
CBitmapButton myButton;
// Create the bitmap button (must include the BS_OWNERDRAW style).
myButton.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,
CRect(10,10,100,100), pParentWnd, 1);// Load the bitmaps for this button.
myButton.LoadBitmaps(IDB_UP, IDB_DOWN, IDB_FOCUS, IDB_DISABLE);I put this in the header file.
CBitmapButton btnStop;
CBitmapButton btnMonitor;Then in the .cpp's OnCreate() function....
// now load the bitmaps for the CBitmapButton items if (!m\_wndToolBar.btnStop.LoadBitmaps(\_T("StopUp"), \_T("StopDown"), \_T("StopFocus"), \_T("StopDown")) || !m\_wndToolBar.btnMonitor.LoadBitmaps(IDB\_MONUP, IDB\_MONDOWN, IDB\_MONFOCUS, IDB\_MONDOWN) ) { TRACE0("Failed to load bitmaps for buttons\\n"); AfxThrowResourceException(); }
-
I am very new to programming. I have started using Visual C++ 6.0. I am not very familier yet with the terms used in programming. I would like to put a bitmap in place of mu button using CBitmapButton. I have looked over many different sites from MSDN to codeguru trying to find out how to do it. Either I get to the end and it doesn't work for some reason or the words being used are too advanced for me to understand. are there any simpler instructions for using CBitmapButton, on the web? Thank you.
If you want only to get a bitmap into the button CBitmapButton is Ok, but if you want more functionality (flat buttons, changing images depending on the mouse cursor...) without effort take a look at Davide Calabro's CButtonST, it's easy to use and will give you the possibility to use buttons as if you where programming in Delphi or VB (setting properties)... NOTE1: I'm novice too and it works fine for me... NOTE2: I'm new speaking english too... NOTE3: you can find CButtonSt and some other classes at codeproject in the button control related web page. Best regards..