![]() |
Re: ClientHeight/ClientWidth für WinAPI
Zitat:
Delphi-Quellcode:
Hat jemand eine Idee?
const
WND_HEIGHT = 260; WND_WIDTH = 340; [...] X := (GetSystemMetrics(SM_CXSCREEN) div 2) - (WND_WIDTH div 2); Y := (GetSystemMetrics(SM_CYSCREEN) div 2) - (WND_HEIGHT div 2); SetRect(WindowRect, X, Y, WND_WIDTH, WND_HEIGHT); AdjustWindowRectEx(WindowRect, dwStyle, False, dwExStyle); CreateWindowEx(dwExStyle, CLASS_NAME, WND_TITLE, dwStyle, WindowRect.Left, WindowRect.Top, WindowRect.Right, WindowRect.Bottom, 0, 0, hInstance, nil); (* Anmerkung: WND_HEIGHT / WND_WIDTH beieht sich auf die Maße des Client-Bereiches. Das Ergebnis von AdjustWindowRectEx ist viel kleiner, als die Konstanten *) |
Re: ClientHeight/ClientWidth für WinAPI
Ändere mal das hier:
Delphi-Quellcode:
Und dann das hier:
SetRect(WindowRect, X, Y, WND_WIDTH+X, WND_HEIGHT+Y);
Delphi-Quellcode:
Du willst ja die Koordinaten von rechts und unten angeben, und die ergeben sich aus der Addition von Breite/Höhe zu links und oben.
[...]
CreateWindowEx(dwExStyle, CLASS_NAME, WND_TITLE, dwStyle, WindowRect.Left, WindowRect.Top, WindowRect.Right-WindowRect.Left, // hier die Breite WindowRect.Bottom-WindowRect.Top, // und hier die Höhe 0, 0, hInstance, nil); Gruß, teebee |
Re: ClientHeight/ClientWidth für WinAPI
Danke! Klappt wunderbar.
:dp: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:16 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz