79 Star 315 Fork 54

不在乎y/govcl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 2.20 KB
一键复制 编辑 原始数据 按行查看 历史
不在乎y 提交于 5年前 . Update all examples
package main
import (
"fmt"
"github.com/ying32/govcl/vcl"
_ "github.com/ying32/govcl/vcl/exts/winappres"
"github.com/ying32/govcl/vcl/types"
)
func main() {
vcl.Application.Initialize()
vcl.Application.SetShowHint(true)
mainForm := vcl.Application.CreateForm()
mainForm.SetPosition(types.PoScreenCenter)
form2 := vcl.Application.CreateForm()
form2.SetCaption("Form2")
stb := vcl.NewStatusBar(form2)
stb.SetParent(form2)
stb.SetSimpleText("状态条")
// 窗口全局show提示
mainForm.SetShowHint(true)
button := vcl.NewButton(mainForm)
button.SetParent(mainForm)
button.SetCaption("按钮1")
// 长提示,后面使用 | 分割
button.SetHint("这是一个提示|后面可以是长提示")
button.SetBounds(10, 20, 100, 30)
button.SetOnClick(func(sender vcl.IObject) {
form2.Show()
})
button = vcl.NewButton(mainForm)
button.SetParent(mainForm)
button.SetCaption("按钮2")
button.SetHint("提示。好好好好好。。。。。。。。。。。。。")
button.SetBounds(10, 60, 100, 30)
statusbar := vcl.NewStatusBar(mainForm)
statusbar.SetParent(mainForm)
statusbar.SetName("statusbar")
// 右下角出现可调整窗口三角形,默认显示
//statusbar.SetSizeGrip(false)
// 当开启后,菜单的或者按钮的提示会出现在panel上
statusbar.SetAutoHint(true)
// 一般配合AutoHint使用
statusbar.SetSimplePanel(true)
// 原本是不需这下面这样的,在dll中创建的貌似有些问题,所以手动来操作了
vcl.Application.SetOnHint(func(sender vcl.IObject) {
if statusbar.IsValid() {
if statusbar.SimplePanel() {
statusbar.SetSimpleText(vcl.Application.Hint())
} else {
if statusbar.Panels().Count() > 0 {
statusbar.Panels().Items(0).SetText(vcl.Application.Hint())
}
}
}
})
pnl := statusbar.Panels().Add()
pnl.SetText("pnl1")
pnl.SetWidth(100)
pnl = statusbar.Panels().Add()
pnl.SetText("pnl1")
pnl.SetAlignment(types.TaCenter)
pnl.SetWidth(100)
pnl = statusbar.Panels().Add()
pnl.SetText("第二格")
pnl.SetAlignment(types.TaRightJustify)
pnl.SetWidth(100)
var i int32
for i = 0; i < statusbar.Panels().Count(); i++ {
fmt.Println("text:", statusbar.Panels().Items(i).Text())
}
vcl.Application.Run()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ying32/govcl.git
git@gitee.com:ying32/govcl.git
ying32
govcl
govcl
v1.2.8

搜索帮助