|
Toolbar就是工具条, 范例里面也有示例.
对于工具条, 以前有以下使用过程中的发现:
1. 工具条会不会占用winform窗体的大小
为了验证这个结论, 设置窗体背景色为黄色, 设置一个picture铺满整个窗口,背景色为绿色,添加了工具条之后,生成的工具条背景色为黄色,和设置的窗体大小对比, 被占去了部分空间.
所以,结论是: 会!
2.工具条样式有哪些? 能放置到窗体的底部吗?
使用的过程中,发现如果把toolbar的style属性放到creat()外面, 工具条就会跑到窗体底部.
至于工具条的样式,可以查看toolbar的源码里面的_TBstyle_开头的就是.
先记录这么多,以后发现其他好玩的继续.
大家使用过程中有其他新发现,也欢迎留言分享.
测试用源码如下:
- import win.ui;
- import win.ui.toolbar;
- /*DSG{{*/
- var winform = win.form(text="Toolbar工具条演示";right=504;bottom=206;bgcolor=65535)
- winform.add(
- picturebox={cls="picturebox";left=0;top=0;right=505;bottom=207;bgcolor=8421376;z=1}
- )
- /*}}*/
- /*==========工具条==============*/
- var toolbar = win.ui.toolbar(winform);
- toolbar.create( /* 删除了这里的style属性 */); // 创建工具条
- toolbar.showLabel = true; //在按钮上显示文字
- toolbar.imageList = win.imageList( 16, 16 ).add($"\toolbar.gif",0xFF00FF/*透明色*/) ;
- toolbar.style = 0x4000/*_TBSTYLE_REGISTERDROP*/;//属性写到了外面,使工具条显示在底部
- toolbar.add( "新建", , 1 );
- toolbar.add(
- "禁用",
- function (id) {
- toolbar.getButtonById(id).disabled = true;
- }, 15
- );
- toolbar.add(
- "恢复1234567",
- function (id) {
- toolbar.getButton(2).disabled = false;
- }, 16
- );
- winform.show();
- win.loopMessage();
复制代码 |
|