//圆形图标 / 圆形按钮 //plus 控件使用指南: doc://library-guide/std/win/ui/ctrl/plus.md##border-radius import win.ui; /*DSG{{*/ var winform = win.form(text="圆形图标 / 圆形按钮";right=759;bottom=469) winform.add( roundButton={cls="plus";text="圆形按钮";left=274;top=361;right=359;bottom=407;border={radius=-1};forecolor=0x008000;notify=1;z=2}; roundIcon={cls="plus";left=18;top=9;right=435;bottom=324;edge=1;foreRepeat="scale";z=1} ) /*}}*/ /* 如果 plus 控件指定边框圆角半径的 border.radiu 属性值为 -1, 就会裁剪前景图像(或前景颜色)为圆形,并依旧可支持前景图像设定的各种绘图模式。 如果控件前景绘图设为 expand 模式会自动修改为 stretch 模式,因为对裁剪为圆形的图像来说九宫格( expand )模式是无意义的。 border.radius 指定为-1 时则仅对前景有效,并且会忽略 border 属性的其他字段。 如果 border.radius 为其他大于 0 的值则边框会变为圆角,且同时裁剪背景与前景为圆角。 */ winform.roundIcon.border = {radius=-1}; //可在创建控件的参数中(设计属性)或者在创建控件后(运行属性)指定此属性。 //winform.roundIcon.foreground = 0x80ff00ff; //如果设置前景色也会被裁剪为圆形 winform.roundIcon.foreground = "~\extensions\wizard\project2\template\plus\1\res\images\excel.png"; //设置交互样式 winform.roundButton.skin( border = { default = {radius=-1}; //指定默认状态下的 border 样式。 }; foreground = { //圆形效果仅对前景有效, default = 0xFF008000; hover = 0xFFE81123; active = 0xFFF1707A; }; color = { default = 0xFFFFFFFF; } ) winform.show() win.loopMessage();