| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 815 人关注过本帖
标题:[求助]我想用做个BMP格式图片按钮,谁能指导吗?
只看楼主 加入收藏
rwhq23d
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-10-30
收藏
 问题点数:0 回复次数:7 
[求助]我想用做个BMP格式图片按钮,谁能指导吗?
翻了好几本书
在网上也求助了好多天
我想应该不难
照着例子步骤来 可是总没有试成功的

请高手帮忙 只要实现一个按钮的就行
先谢谢了
搜索更多相关主题的帖子: BMP 按钮 格式 指导 
2006-10-30 21:59
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 
不是有CBitmapButton类吗?

[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-10-30 22:17
rwhq23d
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-10-30
收藏
得分:0 

只告诉我函数 我不会用
msdn对我来说 如果是vb之类的还行 可是vc就不会用了 MFC很麻烦啊

2006-10-30 22:27
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 
To create a bitmap-button control in a window’s client area, follow these steps:

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.
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.

The class CToolBar takes a different approach to bitmap buttons.

For more information on CBitmapButton, seeControl Topics in Visual C++ Programmer's Guide.

说的真的很明白的。

[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-10-30 22:39
radcat
Rank: 3Rank: 3
等 级:论坛游民
威 望:8
帖 子:306
专家分:45
注 册:2006-9-12
收藏
得分:0 
在对话框上画一个按钮

设置按钮风格styles:Push-like,bitmap.

SendDlgItemMessage(hWnd,//拥有按钮的窗口句柄(那个对话框)
IDC_B,//按钮ID号
BM_SETIMAGE,
IMAGE_BITMAP ,
(LPARAM)sticon01//导入图片的ID
);

2006-10-31 08:43
Bekky
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:354
专家分:0
注 册:2006-5-29
收藏
得分:0 
你去网上找自绘按钮,就能发现解决办法。

我的编译环境为WinXp + VC 6.0 http://blog..cn/yobo
2006-10-31 15:12
lisypro
Rank: 4
等 级:业余侠客
威 望:3
帖 子:695
专家分:216
注 册:2005-9-25
收藏
得分:0 

从网上下一个定义好的类,简单


长期承接管理系统
代做各种vb/ / vc小程序
QQ:82341763
手机:13623290828
群号 11619730
2006-10-31 15:13
olivezhang
Rank: 1
等 级:新手上路
帖 子:223
专家分:0
注 册:2005-9-14
收藏
得分:0 
可以这样实现:
1. 建一个Dialog MFC Application.
2. 在对话框类中加入以下代码:
(1) 在DoDataExchange(CDataExchange* pDX)中加代码:
DDX_Control(pDX, IDC_BUTTON1, m_BitMapBtn);
//IDC_BUTTON1是按钮ID。

(2)在OnInitDialog()函数中加入代码:
m_BitMapBtn.LoadBitmaps(IDB_BTN_BIMAP);
// IDB_BTN_BIMAP是位图ID。
// m_BitMapBtn为CBitmapButton对象.


谷底深深行 ,峰顶漫漫步......@_@
2006-10-31 16:29
快速回复:[求助]我想用做个BMP格式图片按钮,谁能指导吗?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.053204 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved