Multi-Resolution Delphi ApplicationsYou are here:About>Computing & Technology>Delphi Programming> Coding Delphi Applications> Coding standards> Multi-Resolution Delphi Applications Delphi Programming Computing & Technology Delphi Programming Essentials First Time Here? What is Delphi?Learn Delphi: Tutorials / Online CoursesFree Source Delphi Components / ProgramsTips, Tricks and Delphi Code SnippetsDelphi Language Reference (Code Samples) Topics Getting Started with DelphiCoding Delphi ApplicationsBuild Database ApplicationsSource Code ProjectsPower Using VCL ComponentsUsing Data (DB) ControlsAdvanced Delphi TechniquesCoding Internet / NetworkLearn Delphi for .NETBest Components and ToolsEssential Tools and Utils Buyer's Guide Delphi KNowledge ORGanizerBorland Delphi 2006CodeGear Delphi 2007 for Win32Book: Delphi for .NET Developers GuideBook: .NET 2.0 for Delphi Programmers Tools Compare Prices Find a Job Yellow Pages Forums Most Popular Articles Latest Articles HelpNewsletters & RSSEmail to a friendPrint this PageSubmit to Digg Suggested Reading Using VCL componentsWorking with Forms Most Popular Network traffic monitorWeb Site inside a Delphi EXEHandling Windows MessagesA Beginner's Guide to DelphiDelphi Tips and Tricks Multi-Resolution Delphi Apps From Zarko Gajic, Your Guide to Delphi Programming. FREE Newsletter. Sign Up Now! (Continued from Page 1) Anchors, Alignement and Constraints; Third party VCL Once you know what issues to bear in mind when scaling Delphi forms on different screen resolutions ... you are ready for some coding... When working with Delphi version 4 (or above) several properties are designed to help us maintain the look and layout of controls on a form. Use Align to align a control to the top, bottom, left, or right of a form or panel and have it remain there even if the size of the form, panel, or component that contains the control changes. When the parent is resized, an aligned control also resizes so that it continues to span the top, bottom, left, or right edge of the parent. Use Constraints to specify the minimum and maximum width and height of the control. When Constraints contains maximum or minimum values, the control can t be resized to violate those constraints. Use Anchors to ensure that a control maintains its current position relative to an edge of its parent, even if the parent is resized. When its parent is resized, the control holds its position relative to the edges to which it is anchored. If a control is anchored to opposite edges of its parent, the control stretches when its parent is resized. ~~~~~~~~~~~~~~~~~~~~~~~~~ procedure ScaleForm (F: TForm; ScreenWidth, ScreenHeight: LongInt) ; begin
F.Scaled := True; F.AutoScroll := False; F.Position := poScreenCenter; F.Font.Name := 'Arial'; if (Screen.Width <> ScreenWidth) then begin F.Height := LongInt(F.Height) * LongInt(Screen.Height) div ScreenHeight; F.Width := LongInt(F.Width) * LongInt(Screen.Width) div ScreenWidth; F.ScaleBy(Screen.Width,ScreenWidth) ; end; end; ~~~~~~~~~~~~~~~~~~~~~~~~~ VCL And finally, why bother with coding when there are components for all your resizing problems (try them and choose the best one for you): TNFormSizing Need forms that keep proportionality when being resized manually? And also when being Maximized or Tiled/Cascaded? Forms for both MDI and SDI type applications? TNFormSizing is all you need for that. Just put the TNFormSizing on your form and choose an option for ProportionType - its only published property. Free with code. TFormResizer To use this free component (+ source code), just drop it onto a form and then add one line of code apiece to the form's OnCreate and OnResize handlers (optionally resizes the fonts of the components). Resizer component Another free component. Includes component editor with all controls for this container in table format. Then you can define the behavior for each control. All settings will be stored in DFM file automatically. GTSizer Shareware component: resizes at design time, automatic resolution independence, supports third party/custom controls, supports all border styles, etc. Perfect Size All you do is drop PerfectSize on a form and the rest is handled for you! At run time, your controls and fonts are always kept in proper scale and proportion regardless of the user's screen resolution. Shareware. Previous 1 2 Suggested Reading Using VCL componentsWorking with Forms Related Articles Owner and ParentHow to Add Size Handles to Controls being Resized at Ru...Multi-Resolution Delphi ApplicationsDelphi and Active FormsIncremental SearchingHelping Moms Out What's Best for Kids? Summer Vacation Ideas Meals for Your Family Raising Kids of Character Are Video Games Good for Kids? What's Hot Delphi Programming Tips 9 - 12Using TCoolBarDelphi Tips 261- 264Pos functionGuest Book - About Delphi Programming All Topics | Email Article | Print this Page | | Advertising Info | News & Events | Work at About | SiteMap | Reprints |
HelpOur Story | Be a Guide More from About, Inc.: Calorie-Count | UCompareHealthCare User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2007 About, Inc., A part of The New York Times Company. All rights reserved.