示例#1
1
文件: handler.go 项目: CodyGuo/ngui
// 为窗口设置新的尺寸
func win_handler_sizeTo(browser *cef.Browser, args []cef.V8Value) (result interface{}) {
	fmt.Println("win_handler_sizeTo")
	width := cef.V8ValueToInt32(args[0])
	height := cef.V8ValueToInt32(args[1])

	h := win.HWND(browser.GetWindowHandle())
	var rect win.RECT
	win.GetWindowRect(h, &rect)

	fmt.Printf("win_handler_sizeTo Left=%v,Right=%v,Width=%v,Height=%v\n", rect.Left, rect.Top, width, height)
	win.MoveWindow(h, rect.Left, rect.Top, width, height, true)

	//result = 1

	return
}
示例#2
0
文件: handler.go 项目: CodyGuo/ngui
// 为窗口设置新的位置
func win_handler_moveTo(browser *cef.Browser, args []cef.V8Value) (result interface{}) {
	fmt.Println("win_handler_moveTo")
	left := cef.V8ValueToInt32(args[0])
	top := cef.V8ValueToInt32(args[1])

	fmt.Printf("win_handler_moveTo left=%v,top=%v\n", left, top)

	h := win.HWND(browser.GetWindowHandle())

	var rect win.RECT
	win.GetWindowRect(h, &rect)
	width := int32(rect.Right - rect.Left)
	height := int32(rect.Bottom - rect.Top)

	fmt.Printf("win_handler_moveTo Left=%v,Right=%v,Width=%v,Height=%v\n", left, top, width, height)
	win.MoveWindow(h, left, top, width, height, true)

	return
}