开发者

Cannot manage to have the main form to show scrollbars if bigger

I have developped an开发者_StackOverflow app on 22inch monitor at its max resolution when I run this on a laptop with a different ratio and a smaller resolution well the form is too big - to be expected but no scroll bar appear automaticaly to see the whole thing if needed I have tempered with all options but could not figure it out I have tried autoscroll of course but nothing I am sure it is not so difficult but I am stuck So if anyone could indicate me what properties to change I'll be most greatful or even better some easy strategy or components (even paying) to achieve a better screen resolution independance but the scrollbar would be great to start with


Set AutoScroll = True and BorderStyle = bsSizeable to get your existing form working. AutoScroll only kicks in if your form is made smaller for the content, but that doesn't happen if BorderStyle is set to something that doesn't allow resizing.

Then when you've got some time on your hands look into the TScrollBox and design your form to scale nicely; Put the stuff that can't scale on the ScrollBox (so you've got control over what scrolls and what doesn't scroll).


Autoscrolling kicks in when you make the form narrower than the right side of its right most control and/or make the form shorter than the bottom of its bottom most control. If there are no controls on the form, I think it wouldn't sprout any scroll bars no matter how small you size it.

What you are looking for is not just autoscrolling, but auto-resizing of a form based on the current screen dimensions as well. There is no "auto" property for this. You will have to deal with it yourself when you create / show the form.

In OnCreate (or the constructor itself after the inherited call):

Height := Screen.Height;
Width := Screen.Width;


Well it does seem to work because the form has panels and splitters it is a complex form From what I have read on the internet the forms on a laptop do show fully (mine included) is because the panels/ frames embedded in the main form are resized because the option align is alclient or alleft, so as far as the top form is concerned they are fully visible and therefore no scrollbars do appear. I do not know how to force the top form to show its scroll bars on demand something like that on create if screen.heigth


As I commented on Cosmins answer, I think you have missunderstud something here. A scrollbar is shown inside a container, if the content of that container is larger then the clientarea of the same container.

By larger then, I mean 1. a child component have a width or height greater then the containers width or height, or 2. a child component is placed where some or all of it is outside of the containers client area.

What you describes, is a form that is large enough to display all its content, but too large for the current desktop resolution.

eg. a form that is 1600x1200 pixels on a computerscreen with 1280x1024 resolution.

In such a case, ther will be no scrollbars, and if there would be scrollbars, the scrollbars should be on the desktop, which is the container that the form is inside, not the form.

What you should do, is to ensure that your main form is not larger then the desktop. If you shrink your forms bounderies, it will start clipping the content, and scrollbars should appear.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜