diff options
| author | papplampe <[email protected]> | 2014-06-10 14:34:26 +0200 |
|---|---|---|
| committer | papplampe <[email protected]> | 2014-06-11 11:41:31 +0200 |
| commit | 4fa35b22391d56ba22725229f8d99f0061c910d0 (patch) | |
| tree | 7d35fc8183616b75b65a89b006be043b173b171b /sysdata_windows.go | |
| parent | 5fa1bd22e2d457523949e0e5e1dece729d053129 (diff) | |
added Center function to window
Diffstat (limited to 'sysdata_windows.go')
| -rw-r--r-- | sysdata_windows.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdata_windows.go b/sysdata_windows.go index 4a4f69f..76c068c 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -685,3 +685,15 @@ func (s *sysData) repaintAll() { } <-ret } + +func (s *sysData) center() { + var ws _RECT + _getWindowRect.Call(uintptr(s.hwnd), uintptr(unsafe.Pointer(&ws))) + dw, _, _ := _getSystemMetrics.Call(_SM_CXFULLSCREEN) + dh, _, _ := _getSystemMetrics.Call(_SM_CYFULLSCREEN) + ww := ws.right - ws.left + wh := ws.bottom - ws.top + wx := (int32(dw) / 2) - (ww / 2) + wy := (int32(dh) / 2) - (wh / 2) + s.setRect(int(wx), int(wy), int(ww), int(wh), 0) +} |
