Exemplo n.º 1
0
func main() {
	xcgui.XInitXCGUI()
	hwnd := xcgui.XWndCreate(400, 200, 300, 200, "标题",
		xcgui.NULL, xcgui.XC_WINDOW_STYLE_DEFAULT)

	parent := xcgui.HXCGUI(hwnd)
	//button
	btn := xcgui.XBtnCreate(10, 5, 80, 22, "关闭", parent)
	xcgui.XBtnSetType(btn, xcgui.BUTTON_TYPE_CLOSE)
	//监听btn事件
	xcgui.XEleRegEventC(btn, xcgui.XE_BNCLICK, syscall.NewCallback(OnBtnClick))
	//label
	lb := xcgui.XShapeTextCreate(50, 100, 100, 22, "hello world!", parent)
	xcgui.XShapeTextSetText(lb, "hello 世界!")
	xcgui.XShapeTextSetTextColor(lb, 0xff0000, 255)

	//取text及长度
	str := xcgui.XShapeTextGetTextGo(lb)
	fmt.Println(str)
	fmt.Println(xcgui.XShapeTextGetTextLength(lb))

	xcgui.XWndShowWindow(hwnd, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 2
0
func (wb *WindowBase) Show() (err error) {
	ret := xc.XWndShowWindow(wb.hWindow, xc.SW_RESTORE)
	if !ret {
		return errors.New("XWndShowWindow call filed.")
	}

	return nil
}
Exemplo n.º 3
0
func main() {
	xcgui.XCLoadResource("resource.xml", "")

	hxCGUI := xcgui.XCLoadLayout("layout.xml", 0)

	xcgui.XWndAdjustLayout(xcgui.HWINDOW(hxCGUI))
	xcgui.XWndShowWindow(xcgui.HWINDOW(hxCGUI), xcgui.SW_SHOW)

	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}
Exemplo n.º 4
0
Arquivo: frame.go Projeto: maxid/xcgui
func main() {
	mw = xcgui.XFrameWndCreate(0, 0, 600, 400, xcgui.StringToUTF16Ptr("炫彩界面库窗口"), xcgui.NULL, xcgui.XC_WINDOW_STYLE_DEFAULT)
	xcgui.XBtnSetType(xcgui.XBtnCreate(3, 3, 20, 20, xcgui.StringToUTF16Ptr("X"), xcgui.HXCGUI(mw)), xcgui.BUTTON_TYPE_CLOSE)

	hPane1 := xcgui.XPaneCreate(xcgui.StringToUTF16Ptr("111"), 200, 200, mw)
	hPane2 := xcgui.XPaneCreate(xcgui.StringToUTF16Ptr("2222222222"), 200, 200, mw)
	hPane3 := xcgui.XPaneCreate(xcgui.StringToUTF16Ptr("333"), 200, 200, mw)

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane1, xcgui.Align_left)

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane2, xcgui.Align_bottom)

	xcgui.XFrameWndAddPane(mw, xcgui.NULL, hPane3, xcgui.Align_right)

	xcgui.XWndRegEventC(mw, xcgui.WM_RBUTTONUP, xcgui.CallBack(OnWndButtonUp))

	xcgui.XWndAdjustLayout(mw)
	xcgui.XWndShowWindow(mw, xcgui.SW_SHOW)
	xcgui.XRunXCGUI()
	xcgui.XExitXCGUI()
}