go get github.com/lxn/walk
package main
import (
"log"
"strings"
"github.com/lxn/walk"
."github.com/lxn/walk/declarative"
)
func init(){
log.SetFlags(log.Ldate|log.Lshortfile)
}
func main(){
var inTE,outTE *walk.TextEdit
MainWindow{
Title: "test",
MinSize: Size{600,400},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children:[]Widget{
TextEdit{AssignTo:&inTE,MaxLength:10},
TextEdit{AssignTo:&outTE,ReadOnly:true},
},
},
PushButton{
Text: "SCREAM",
OnClicked: func(){
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Run()
}
go get github.com/akavel/rsrc
拉取下来之后,就会在GOPATH/src/bin中会发现有一个rsrc.exe
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
</assembly>
rsrc -manifest gui.manifest -o rsrc.syso
go build -ldflags="-H windowsgui"
原文:https://www.cnblogs.com/MyUniverse/p/13185022.html