usernotfound Expert Cheater Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Sun Apr 23, 2017 11:15 pm Post subject: Form height adjusting to user resolution |
|
|
I am using a borderless form and am worried about making the height too tall for users with smaller screens who won't be able to see everything, assuming there's no way to resize the window like with a regular form, is there a way to have the height adjust automatically so that the bottom is not going past the taskbar?
|
|
panraven Grandmaster Cheater Reputation: 54
Joined: 01 Oct 2008 Posts: 941
|
Posted: Mon Apr 24, 2017 10:55 am Post subject: |
|
|
The width and height can be obtained from windows API GetSystemMetrics function with proper input parameter (nIndex).
The API function need 1 integer input parameter, which may be call by CE Lua function executeCodeLocal directly, eg
Code: |
local function sysMetric(n)
return executeCodeLocal("GetSystemMetrics",n)
end
for i,v in ipairs {0,1,16,17} do
print(v,sysMetric(v))
end
-- print
0 1366 -- SM_CXSCREEN
1 768 -- SM_CYSCREEN
16 1366 -- SM_CXFULLSCREEN. excluding taskbar
17 715 -- SM_CYFULLSCREEN
|
It is not enough since the taskbar may be at top or left side, but should be ok for most user?
Your form should has an area that allow drag/move the form (the titlebar if not borderless), then make a timer function to check if the drag-area completely outside the desktop area, and adjust form position/size if need.
ADDED:
^I've misunderstood the problem ~_~
Anyway, may be a way to manually adjust height in borderless form (instead of automatic adjust by timer function) is more user friendly? I may temporary move a form almost outside the desktop and don't want to adjust the size again when moving it back.
_________________
- Retarded. |
|