一键变更为webbutton按钮风格

//本代码放到所有窗口的基类中,本窗口必须是 webbutton 风格的扁平窗口
//WebButton_AttachButtonWindow(handle(this))

uo_webbutton ibtn
commandbutton btn_obj

this.backcolor = RGB(255,255,255)


Integer li_count
Integer li_i

// 窗口内控件数
li_count = upperbound(this.control[])


// 循环记录各控件大小与窗口大小的比例
FOR li_i = 1 TO li_count
    CHOOSE CASE this.control[li_i].typeof()
    
        CASE checkbox!
            icbx_obj = this.control[li_i]
            icbx_obj.backcolor = this.backcolor
            
        CASE radiobutton!
            irb_obj = this.control[li_i]
            
        CASE commandbutton!
            btn_obj = this.control[li_i]
            ibtn.WebButton_AttachButton(handle(btn_obj))
            //gf_set_button_style(btn_obj,this.backcolor)
            long nBackColor,nBorderColor,nTextColor,clr
            //nBackColor = RGB(255,255,240)
            nBorderColor = RGB(70,90,110)
            nBackColor = nBorderColor
            nTextColor = RGB(255,255,255)
            clr = this.backcolor
            ibtn.sendmessage( handle(btn_obj), ibtn.wm_setbutton_windowcolor , 0, clr)            
            ibtn.sendmessage( handle(btn_obj), ibtn.WM_SETBUTTON_BORDERCOLOR , 0, nBorderColor)
            ibtn.sendmessage( handle(btn_obj), ibtn.WM_SETBUTTON_TEXTCOLOR , 0, nTextColor)
            ibtn.sendmessageString( handle(btn_obj), ibtn.WM_SETBUTTON_FONTINFO , "宋体", 12)
            ibtn.sendmessage( handle(btn_obj), ibtn.wm_setbutton_ellipse , 6, 6)
            long li_char
            li_char = 0
            choose case mid(trim(btn_obj.text),1,2)
                case "打印"
                    li_char = 983208
                case "检索"
                    li_char = 64913
                case "导出"
                    li_char = 983553
                case "导入"
                    li_char = 983475
                case "关闭"
                    li_char = 983219
                    nBackColor = RGB(120,0,0)
                case "退出"
                    li_char = 983219                    
                case "查询"
                    li_char = 57920
                case "保存"
                    li_char = 57714
                case "另存"
                    li_char = 57714
                case "放弃"
                    li_char = 61914
                case "计算"
                    li_char = 61687
                case "刷新"
                    li_char = 983388
                    
                case "清空"
                    li_char = 57604
                case "插入"
                    li_char = 983280
                case "删除"
                    li_char = 983278
                case "确定"
                    li_char = 64786
                    nBackColor = RGB(0,120,0)
                case "查找"
                    li_char = 983340
                case "增加"
                    li_char = 64791
                case "结算"
                    li_char = 983090
                case "更新"
                    li_char = 64817
                case "显示"
                    li_char = 983222
            end choose
            ibtn.SendMessage(handle(btn_obj),ibtn.WM_SETBUTTON_ICON_CHAR,0,li_char)
            ibtn.sendmessage( handle(btn_obj), ibtn.wm_setbutton_backcolor , 0, nBackColor)            
            
        CASE statictext!
            ist_obj = this.control[li_i]
            ist_obj.backcolor = this.backcolor
            
    End Choose
    
Next
 

部分按钮效果参考:

猜你喜欢

转载自blog.csdn.net/lxbin2003/article/details/106186007
今日推荐