Ejemplo n.º 1
0
// Public methods
func (this *Form) Center() {
	sWidth := w32.GetSystemMetrics(w32.SM_CXFULLSCREEN)
	sHeight := w32.GetSystemMetrics(w32.SM_CYFULLSCREEN)
	if sWidth != 0 && sHeight != 0 {
		w, h := this.Size()
		this.SetPos((sWidth/2)-(w/2), (sHeight/2)-(h/2))
	}
}
Ejemplo n.º 2
0
import (
	"image"
	"image/color"
	"log"
	"os"

	"github.com/AllenDang/w32"
	"github.com/js-arias/sparta"
)

// WidgetTable holds a list of widgets.
var widgetTable = make(map[w32.HWND]sparta.Widget)

var (
	// Window extra borders
	extraX = (2 * w32.GetSystemMetrics(w32.SM_CXFRAME)) + 4
	extraY = (2 * w32.GetSystemMetrics(w32.SM_CYFRAME)) + w32.GetSystemMetrics(w32.SM_CYCAPTION) + 4
)

// Window holds the window information.
type window struct {
	id  w32.HWND // window id
	w   sparta.Widget
	pos image.Point

	// graphic part
	dc         w32.HDC // device context
	isPaint    bool    // true if the window is processing a PAINT event.
	back, fore *brush
	curr       *brush
}