通过载入bitmap来设置ctoolbar
来源:互联网 发布:奥地利是怎样国家知乎 编辑:程序博客网 时间:2024/05/22 21:20
参见msdn--------------------------------------------
Visual C++ provides you with two methods to create a toolbar. To create a toolbar resource using the Resource Editor, follow these steps:
- Create a toolbar resource.
- Construct the CToolBar object.
- Call the Create (or CreateEx) function to create the Windows toolbar and attach it to the CToolBar object.
- Call LoadToolBar to load the toolbar resource.
Otherwise, follow these steps:
- Construct the CToolBar object.
- Call the Create (or CreateEx) function to create the Windows toolbar and attach it to the CToolBar object.
- Call LoadBitmap to load the bitmap that contains the toolbar button images.
- Call SetButtons to set the button style and associate each button with an image in the bitmap.
All the button images in the toolbar are taken from one bitmap, which must contain one image for each button. All images must be the same size; the default is 16 pixels wide and 15 pixels high.(可以设任意大小) Images must be side by side in the bitmap.
The SetButtons function takes a pointer to an array of control IDs and an integer that specifies the number of elements in the array. The function sets each button’s ID to the value of the corresponding element of the array and assigns each button an image index, which specifies the position of the button’s image in the bitmap. If an array element has the value ID_SEPARATOR, no image index is assigned.
不用去管分隔条,图片ID依次
The order of the images in the bitmap is typically the order in which they are drawn on the screen, but you can use the SetButtonInfo function to change the relationship between image order and drawing order.
All buttons in a toolbar are the same size. The default is 24 x 22 pixels, in accordance with Windows Interface Guidelines for Software Design. Any additional space between the image and button dimensions is used to form a border around the image.
Each button has one image. The various button states and styles (pressed, up, down, disabled, disabled down, and indeterminate) are generated from that one image. Although bitmaps can be any color, you can achieve the best results with images in black and shades of gray.
Toolbar buttons imitate pushbuttons by default. However, toolbar buttons can also imitate check-box buttons or radio buttons. Check-box buttons have three states: checked, cleared, and indeterminate. Radio buttons have only two states: checked and cleared.
To set an individual button or separator style without pointing to an array, call GetButtonStyle to retrieve the style, and then call SetButtonStyle instead of SetButtons. SetButtonStyle is most useful when you want to change a button’s style at run time.
2.还有一种方法,不过仅仅支持不大于256色(<=256色),但是在vc上效果还是会失真
(1)先载入bmp图片资源(<=256)
(2)VC菜单---Image---Grid Settings(设置工具条要怎么分割图像)
(3)VC菜单---Image---Tool Bar editor(会自动转换为Tool Bar的资源)
(4)载入图片-OK
- 通过载入bitmap来设置ctoolbar
- android通过Bitmap载入三种图片方式
- 通过CToolBar类创建工具栏
- CToolBar
- 通过设置Bitmap旋转ImageView(动态旋转图片)
- Linux中通过locale来设置字符集
- Linux中通过locale来设置字符集
- Linux中通过locale来设置字符集
- Linux中通过locale来设置字符集
- 通过注册表来修改IE安全设置
- Linux中通过locale来设置字符集
- Linux中通过locale来设置字符集
- Linux中通过locale来设置字符集
- 通过Js来设置页面样式
- Linux中通过locale来设置字符集
- html通过css来设置半透明背景
- Android通过应用来设置系统时间
- Android学习笔记:高效载入大量Bitmap
- 文本分类概述
- 监听按键ESC退出PopupScreen框
- 奇闻怪事,疯狂的胡须,英国学生疯长胡须,每天夜里3-10厘米不等
- PHP PDO 基础
- 做3G开发是学Java还是C++
- 通过载入bitmap来设置ctoolbar
- 编写C++C#相互调用COM组件
- Java接口的作用及实例
- 2岁男孩的眼睛里竟然生长十多条寄生的蛲虫,长约为十厘米左右在蠕动
- java
- 通过ODBC连接oracle
- java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava
- 遍历二叉树递归算法与非递归算法
- memset用法详解