Пример #1
0
func (this *Window) SetPos(x, y int) {
	w, h := this.Size()
	if w == 0 {
		w = 100
	}
	if h == 0 {
		h = 25
	}
	w32.MoveWindow(this.hwnd, x, y, w, h, true)
}
Пример #2
0
// SetProperty sets a window property.
func (win *window) SetProperty(p sparta.Property, v interface{}) {
	switch p {
	case sparta.Caption:
		if win.w.Property(sparta.Parent) != nil {
			break
		}
		w32.SetWindowText(win.id, v.(string))
	case sparta.Geometry:
		val := v.(image.Rectangle)
		w32.MoveWindow(win.id, val.Min.X, val.Min.Y, val.Dx(), val.Dy(), true)
	case sparta.Foreground:
		val := v.(color.RGBA)
		win.fore = getBrush(val)
	case sparta.Background:
		val := v.(color.RGBA)
		win.back = getBrush(val)
	}
}
Пример #3
0
func (this *Window) SetSize(width, height int) {
	x, y := this.Pos()
	w32.MoveWindow(this.hwnd, x, y, width, height, true)
}