Re: Vista cuts bottom of my form



"Jack" <replyto@it> wrote in message news:uRH2YYOvHHA.2040@xxxxxxxxxxxxxxxxxxxxxxx

Thak you Rick. Changing back to 96dpi has solved the
problem but only partially. User can now access controls
located at the bottom of the form, but the form still is cut
at the bottom, apparently more then I can see that in my
Vista. Why is such difference?

There are all sorts of possibilities. The dots per inch setting is just one of them. Your own Vista may be running in standard mode while your user's Vista might be running the Aero desktop, which will make all the caption bars and stuff and the borders thicker, or you may have a thin taskbar and your user might have a thicker one, or the taskbars may be in a different position, I could go on for hours! If he is running Aero and you are not then you could tell your user to run your own program in "non Aero" by right clicking its shortcut and selecting Properties and placing a tick against "disable desktop composition" under the Compatibility tab. But you really should not be doing these things. Instead of forcing your user to change his system to accommodate your program you should change your program to accommodate your user! As I've already mentioned, your code needs to check the available screen area *at run time*. If it is a fixed size Form and if the desired Width or Height is greater than will fit onto the display you need to reduce them accordingly. Your code then needs to examine the resultant ScaleWidth and ScaleHeight properties of the Form and position all Controls so that they fit within it. Similarly, if it is a maximized Form then your code needs to examine the ScaleWidth and ScaleHeight *after* the Form has loaded (and therefore after Windows has resized it) and reposition all Controls so that they fit within it. In fact, to do it properly everything on your Form should be positioned to your requirements at run time, taking into account the available client area within your Form after your Form has been resized to take account of the available desktop area. In that way your code will still work fine on a machine that is set differently to your own, and you would not have needed to tell your user to change his dpi to 96 or to turn of Aero, which he might not actually be happy doing. In fact if he has set his own system to 120 dpi then he will usually have a very good reason of his own for having done so, and it is rude to tell him to change it just to suit your own needs. This stuff is very easy to do. There is really no excuse for failing to do it. Asking the user to make changes to his system to accommodate your own failure to add such code should not even be considered as an option. To start you off, here's an example of how to get the available desktop area:

Option Explicit
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, ByRef lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Private Sub Command1_Click()
Dim myrect As RECT
Dim wide1 As Long, high1 As Long
Dim wide2 As Long, high2 As Long
Dim s1 As String
' get the total screen pixel area
wide1 = ScaleX(Screen.Width, vbTwips, vbPixels)
high1 = ScaleY(Screen.Height, vbTwips, vbPixels)
s1 = "Screen size is " & Format(wide1) & " x " _
& Format(high1) & " pixels." & vbCrLf
' get the "available" screen pixel area, not
' including taskbar and other similar bars
Call SystemParametersInfo(SPI_GETWORKAREA, 0&, myrect, 0&)
wide2 = myrect.Right - myrect.Left
high2 = myrect.Bottom - myrect.Top
s1 = s1 & "Available desktop area is " & Format(wide2) _
& " x " & Format(high2) & " pixels."
MsgBox s1
End Sub




.



Relevant Pages

  • Re: RTF printing problem
    ... If you run the modified code in my previous post it should tell you the size of the printer's unprintable bottom margin. ... Here is some code which allows you to print the contents of your RichTextBox in a different way, allowing you to specify precise page margins. ... Private Sub Command1_Click ... Dim LeftOffset As Long, TopOffset As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Window Class of UserForm controls
    ... Not all controls have HWnds. ... other controls share the same HWnd. ... Private Function ClassNameAs String ... Dim CN As String ...
    (microsoft.public.excel.programming)
  • Re: add text to bottom of richtextbox, simple method? Solved
    ... It allows you to print the contents of a RichTextBox with selectable left, right, top and bottom page margins, and it works fine whether the RTB text runs to just one page or to several pages. ... Dim LineWidth As Long ... LeftMarginWidth As Long, ...
    (microsoft.public.vb.general.discussion)
  • ball poses Lionels auditor
    ... The trades, controls, and films are all private and empty. ... surprising familiar cup works sketchs inside Bernadette's nosy ... Some amusements will be gastric institutional cycles. ...
    (sci.crypt)
  • Re: MenuBar properties
    ... recursive function for reading the level on controls. ... Dim cbar As CommandBar ... Dim cbarc As CommandBarControl ... Dim cbarc1 As CommandBarControl 'ControlLevel1 controls ...
    (microsoft.public.access.modulesdaovba)

Loading