如何给按钮添加背景图?
解决方案 »
- CreateProcess创建进程后父子进程如何实现模态对话框的效果?高手请指点!
- 求英文版的Visual Studio 2005
- 我重载了CMenu的DrawItem,怎样在刚创建一个Menu的时候就获取它绘制Item时使用的DC?
- 准备学VC++,请问用什么工具?
- 求解:多个线程同时访问数据库的问题。
- 用vc6做console模式的程序,类似sleep这样的延时函数是什么?难道没有?
- 我为何不能使用AnimateWindow()函数?
- LNK2001: unresolved external symbol "int __cdecl InitWindowsClass(struct HINSTANCE__ *)" (?InitWindowsClass@@YAHPAUHINSTANCE__
- 如何利用图片变化。判断摄像头移动方向和距离
- 如何改变类型?
- 简单问题,在线等待,高手请进!!!!急
- 发表意见都有分,请帮忙!
Construct the CBitmapButton object.
Call the Create function to create the Windows button control and attach it to the CBitmapButton object.
Call the LoadBitmaps member function to load the bitmap resources after the bitmap button is constructed.
To include a bitmap-button control in a dialog box, follow these steps: Create one to four bitmap images for the button.
Create a dialog template with an owner-draw button positioned where you want the bitmap button. The size of the button in the template does not matter.
Set the button’s caption to a value such as “MYIMAGE” and define a symbol for the button such as IDC_MYIMAGE.
In your application’s resource script, give each of the images created for the button an ID constructed by appending one of the letters “U,” “D,” “F,” or “X” (for up, down, focused, and disabled) to the string used for the button caption in step 3. For the button caption “MYIMAGE,” for example, the IDs would be “MYIMAGEU,” “MYIMAGED,” “MYIMAGEF,” and “MYIMAGEX.” You must specify the ID of your bitmaps within double quotes. Otherwise the resource editor will assign an integer to the resource and MFC will fail when loading the image.
In your application’s dialog class (derived from CDialog), add a CBitmapButton member object.
In the CDialog object’s OnInitDialog routine, call the CBitmapButton object’s AutoLoad function, using as parameters the button’s control ID and the CDialog object’s this pointer.
If you want to handle Windows notification messages, such as BN_CLICKED, sent by a bitmap-button control to its parent (usually a class derived from CDialog), add to the CDialog-derived object a message-map entry and message-handler member function for each message. The notifications sent by a CBitmapButton object are the same as those sent by a CButton object