按照一般的方法,给Button 添加位图有缺点,就是button 的位置会变化。
我试了不少方法,都无法做到好的效果。
除了编写ActiveX控件,谁还后别的法子?
我试了不少方法,都无法做到好的效果。
除了编写ActiveX控件,谁还后别的法子?
解决方案 »
- 结构体类型变量定义问题
- 关于宏定义的问题
- 你们怎么得到border size等windows的信息?
- 菜鸟问题 请教如何在combo box的控件的下拉菜单里显示某张表的所有字段
- easy easy easy question!but i am a newer!help,thanks!
- CWnd改为CView后的问题,请指教,谢谢!
- 高分求解关于在图像控件中Redraw的问题
- 谁能告诉我这是怎么回事啊?急!在线等,分不够在加,马上解决马上结恬!
- 大家好
- 关于MFC的CSocket传输图片问题
- TAB控件上有一个BUTTON,怎样触发它?
- 请问哪里有使用SQLServer DB-Library C (C++) API开发应用程序的详细资料?
HICON hicon = AfxGetApp()->LoadIcon(IDI_ICON1);
m_button1.SetIcon(hicon);
I believe that if you create a button using function Create(...),then use SetIcon(),you can do it,but if you put a button control on a dialog ,then try to put a picture on it ,I think you can't use SetIcon().What's more,We can get true color using bmp.While using .ico,there are less color a button surface can hold.
Give you score!
vckbase.com
To create a bitmap-button control in a window's client area Create one to four bitmap images for the button.
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.
// Declare a bitmap button object on the stack.
CBitmapButton myButton;// Declare a bitmap button object on the heap.
CBitmapButton* pmyButton = new CBitmapButton;CButton myButton1, myButton2, myButton3, myButton4;第二,创建windows button控件与CBitmaButton关联
// Create a push button.
myButton1.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
CRect(10,10,100,30), pParentWnd, 1);// Create a radio button.
myButton2.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
CRect(10,40,100,70), pParentWnd, 2);// Create an auto 3-state button.
myButton3.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTO3STATE,
CRect(10,70,100,100), pParentWnd, 3);// Create an auto check box.
myButton4.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,
CRect(10,100,100,130), pParentWnd, 4);
第三,调用LoadBitmaps()装载bitmap资源
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);