Elastic Fonts

Designing monitor resolution-independent applications is a frequentproblem Visual Basic programmers face. The simplest solution isto design forms at the 640 by 480 resolution found in most lap-topcomputers. Such a form design, however, looks awkward in desktopcomputers which have resolutions of 1024 by 768.

Solutions to resolve this include VSElastic control from VideoSoft’sVS-OCX and FarPoint’s Tab Pro VBX. In VSElastic, you can pasteall child controls on the Elastic control. You must adjust thecontrol’s two properties, Align = 5 (Fill Container, here theform itself) and AutosizeChildren = 7 (Proportional).

Should your forms require tabbed folders (in case of large numberof controls), use Tab Pro and set the AutoSize = 5 (Fill Parent)and AutosizeChildren = 3 (size and location of control).

The controls now will automatically resize and reposition whenthe resolution of the monitor changes or when the form is resized.The remaining problem is that these custom controls cannot resizeor reposition child controls that are pasted on frames, pictureboxes, or panel controls (option buttons). As the custom controlsdo not alter the fontsize of the controls, captions are truncated.To overcome this problem, you need to use a true-proportionalfont such as Arial and insert this code in the Form_Resize event:

 Sub Form_Resize()dim i as integer, j as integerdim curFormHeight as integerdim curFormWidth as integerdim DefaultFontSize as integerdim orgFormHeight as integerdim orgFormWidth as integerOn Error GoTo FormResizeErrorDefaultFontSize = 8      ' Or whatever fancies youorgFormHeight = 8000    ' In twips, or whatever your desired ' height isorgFormWidth = 8000curFormHeight = Me.Height               ' Get current form heightcurFormWidth = Me.Width          ' Get current form widthFor i = 0 to Controls.Count -1                Controls(i).FontName = "Arial"                Controls(i).FontSize = _                        DefaultFontSize * _                        (curFormHeight / _                        orgFormHeight)Next i' If the form contains option buttons or 'check box control group thenFor j = 0 To Option1().Count - 1                Option1(j).Height = 200 * _(curFormHeight / orgFormHeight)                Option1(j).Width = 1000 * _(curFormWidth / orgFormWidth)                Option1(j).Top = 250 * _                        (j + 1) * (curFormHeight _                        / orgFormHeight)                Option1(j).Left = 250 * _                        (curFormWidth / orgFormWidth)   Next jFormResizeError:If Err = 438 Then                Resume Next      ' If the form ' contains a control whose Font  ' properties do not existEnd If
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a