|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Form size ???up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of ' working rectangle. Me.Size = New System.Drawing.Size(workingRectangle.Width, _ workingRectangle.Height) ' Set the location so the entire form is visible. Me.Location = New System.Drawing.Point(0, 0) the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 x 748 and location as -4 x -4 It doesn't matter what the StartPosition and AutoSize is set to. What gives? I'm trying to use the Form Width to set a drawing Panel (PictDraw) to the maximum width based on the the width being a multiple of 4. I guess I'll have to use the SystemDrawing.Size(workingRectangle.Width) in the following code. The Form margin is set to Single. Index = Me.Width - 2 Index = Int(Index / 4) Index = Index * 4 gScreen.HorPixels = Index With PictDraw X1Y1.X = Int(Int((Me.Width - Index) ) / 2) X1Y1.Y = 0 .Location = X1Y1 X2Y2.X = gScreen.HorPixels X2Y2.Y = 450 .Size = X2Y2 End With Any ideas as to why the form always comes up 1032 X748 ? GalenS You should consider setting the location to be the location of the working
area rectangle, otherwise your form might not display properly on desktops where the taskbar is along either the top or left edges. E.g. Location = workingRectangle.Location Size = workingRectangle.Size When is the code that sets the size called? Is it called after InitializeComponent? You could try handling the LocationChanged and SizeChanged events of the form and see if they are raised when your code sets the properties. It could be that some other code is changing the properties after you, which means you'll see the events raised again. -- Show quoteHide quoteKevin Westhead "Galen Somerville" <galen@community.nospam> wrote in message news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... > My current screen resolution is set to 1024 x 768. My form size always > comes up as 1032 x 748. > > I have tried the help sample > ' Retrieve the working rectangle from the Screen class > ' using the PrimaryScreen and the WorkingArea properties. > Dim workingRectangle As System.Drawing.Rectangle = _ > Screen.PrimaryScreen.WorkingArea > > ' Set the size of the form slightly less than size of > ' working rectangle. > Me.Size = New System.Drawing.Size(workingRectangle.Width, _ > workingRectangle.Height) > > ' Set the location so the entire form is visible. > Me.Location = New System.Drawing.Point(0, 0) > > the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 > x 748 and location as -4 x -4 > > It doesn't matter what the StartPosition and AutoSize is set to. What > gives? > > <snip> > I forgot to mention that the sizing code is in Form_Load
GalenS Show quoteHide quote "Kevin Westhead" <mapson.mapson@nospam.nospam> wrote in message news:OhSUrNCVGHA.5580@TK2MSFTNGP11.phx.gbl... > You should consider setting the location to be the location of the working > area rectangle, otherwise your form might not display properly on desktops > where the taskbar is along either the top or left edges. E.g. > > Location = workingRectangle.Location > Size = workingRectangle.Size > > When is the code that sets the size called? Is it called after > InitializeComponent? You could try handling the LocationChanged and > SizeChanged events of the form and see if they are raised when your code > sets the properties. It could be that some other code is changing the > properties after you, which means you'll see the events raised again. > > -- > Kevin Westhead > > "Galen Somerville" <galen@community.nospam> wrote in message > news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >> My current screen resolution is set to 1024 x 768. My form size always >> comes up as 1032 x 748. >> >> I have tried the help sample >> ' Retrieve the working rectangle from the Screen class >> ' using the PrimaryScreen and the WorkingArea properties. >> Dim workingRectangle As System.Drawing.Rectangle = _ >> Screen.PrimaryScreen.WorkingArea >> >> ' Set the size of the form slightly less than size of >> ' working rectangle. >> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >> workingRectangle.Height) >> >> ' Set the location so the entire form is visible. >> Me.Location = New System.Drawing.Point(0, 0) >> >> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 >> x 748 and location as -4 x -4 >> >> It doesn't matter what the StartPosition and AutoSize is set to. What >> gives? >> >> <snip> >> > > Maybe your Form's Minimum size is set to that?.. there is a property for
Minimum size.. check that... VJ Show quoteHide quote "Galen Somerville" <galen@community.nospam> wrote in message news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... > My current screen resolution is set to 1024 x 768. My form size always > comes up as 1032 x 748. > > I have tried the help sample > ' Retrieve the working rectangle from the Screen class > ' using the PrimaryScreen and the WorkingArea properties. > Dim workingRectangle As System.Drawing.Rectangle = _ > Screen.PrimaryScreen.WorkingArea > > ' Set the size of the form slightly less than size of > ' working rectangle. > Me.Size = New System.Drawing.Size(workingRectangle.Width, _ > workingRectangle.Height) > > ' Set the location so the entire form is visible. > Me.Location = New System.Drawing.Point(0, 0) > > the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 > x 748 and location as -4 x -4 > > It doesn't matter what the StartPosition and AutoSize is set to. What > gives? > > I'm trying to use the Form Width to set a drawing Panel (PictDraw) to the > maximum width based on the the width being a multiple of 4. I guess I'll > have to use the SystemDrawing.Size(workingRectangle.Width) in the > following code. The Form margin is set to Single. > > Index = Me.Width - 2 > Index = Int(Index / 4) > Index = Index * 4 > gScreen.HorPixels = Index > With PictDraw > X1Y1.X = Int(Int((Me.Width - Index) ) / 2) > X1Y1.Y = 0 > .Location = X1Y1 > X2Y2.X = gScreen.HorPixels > X2Y2.Y = 450 > .Size = X2Y2 > End With > > Any ideas as to why the form always comes up 1032 X748 ? > > GalenS > > "Galen Somerville" <galen@community.nospam> schrieb: Form's cannot be larger than the desktop's working area.> My current screen resolution is set to 1024 x 768. My form size always > comes up as 1032 x 748. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> I know, that'swhy I asked the questions. I was basing my Panel width based
on Me.Width and the Panel always filled the screen with no Form border showing. I set a breakpoint and it shows Me.Width as 1032. That's when I added the workingRectangle code to try to correct it. Still 1032 GalenS Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:eNEbctEVGHA.5884@TK2MSFTNGP14.phx.gbl... > "Galen Somerville" <galen@community.nospam> schrieb: >> My current screen resolution is set to 1024 x 768. My form size always >> comes up as 1032 x 748. > > Form's cannot be larger than the desktop's working area. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> Galen,
I have the idea that you are doing the same problamatic things as was be done in the VB versions from the previous milenium Do you know the properties Dock and Anchor. They will make your live probably much easier. I hope this helps, Cor Show quoteHide quote "Galen Somerville" <galen@community.nospam> schreef in bericht news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... > My current screen resolution is set to 1024 x 768. My form size always > comes up as 1032 x 748. > > I have tried the help sample > ' Retrieve the working rectangle from the Screen class > ' using the PrimaryScreen and the WorkingArea properties. > Dim workingRectangle As System.Drawing.Rectangle = _ > Screen.PrimaryScreen.WorkingArea > > ' Set the size of the form slightly less than size of > ' working rectangle. > Me.Size = New System.Drawing.Size(workingRectangle.Width, _ > workingRectangle.Height) > > ' Set the location so the entire form is visible. > Me.Location = New System.Drawing.Point(0, 0) > > the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 > x 748 and location as -4 x -4 > > It doesn't matter what the StartPosition and AutoSize is set to. What > gives? > > I'm trying to use the Form Width to set a drawing Panel (PictDraw) to the > maximum width based on the the width being a multiple of 4. I guess I'll > have to use the SystemDrawing.Size(workingRectangle.Width) in the > following code. The Form margin is set to Single. > > Index = Me.Width - 2 > Index = Int(Index / 4) > Index = Index * 4 > gScreen.HorPixels = Index > With PictDraw > X1Y1.X = Int(Int((Me.Width - Index) ) / 2) > X1Y1.Y = 0 > .Location = X1Y1 > X2Y2.X = gScreen.HorPixels > X2Y2.Y = 450 > .Size = X2Y2 > End With > > Any ideas as to why the form always comes up 1032 X748 ? > > GalenS > > Cor
All controls have Anchor set. The control in question is a user control and intitially it is a small square in an unused portion of screen. When required it is sized at run time. I have found that the following code cures my problem With gScreen ..HorPixels = Screen.GetBounds(Rect).Width ..VerPixels = Screen.GetBounds(Rect).Height End With GalenS Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... > Galen, > > I have the idea that you are doing the same problamatic things as was be > done in the VB versions from the previous milenium > > Do you know the properties Dock and Anchor. > > They will make your live probably much easier. > > I hope this helps, > > Cor > > > "Galen Somerville" <galen@community.nospam> schreef in bericht > news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >> My current screen resolution is set to 1024 x 768. My form size always >> comes up as 1032 x 748. >> >> I have tried the help sample >> ' Retrieve the working rectangle from the Screen class >> ' using the PrimaryScreen and the WorkingArea properties. >> Dim workingRectangle As System.Drawing.Rectangle = _ >> Screen.PrimaryScreen.WorkingArea >> >> ' Set the size of the form slightly less than size of >> ' working rectangle. >> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >> workingRectangle.Height) >> >> ' Set the location so the entire form is visible. >> Me.Location = New System.Drawing.Point(0, 0) >> >> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as 1032 >> x 748 and location as -4 x -4 >> >> It doesn't matter what the StartPosition and AutoSize is set to. What >> gives? >> >> I'm trying to use the Form Width to set a drawing Panel (PictDraw) to the >> maximum width based on the the width being a multiple of 4. I guess I'll >> have to use the SystemDrawing.Size(workingRectangle.Width) in the >> following code. The Form margin is set to Single. >> >> Index = Me.Width - 2 >> Index = Int(Index / 4) >> Index = Index * 4 >> gScreen.HorPixels = Index >> With PictDraw >> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >> X1Y1.Y = 0 >> .Location = X1Y1 >> X2Y2.X = gScreen.HorPixels >> X2Y2.Y = 450 >> .Size = X2Y2 >> End With >> >> Any ideas as to why the form always comes up 1032 X748 ? >> >> GalenS >> >> > > The point everyone has seemed to missed is that you have your form
maximized. When a form is maximized the width of the form is the working area width + the form left border width + the form right border width and the height of the form is the working height is the working area height + the form top border height + the form bottom border height. The position of the form is 0 - the form left border width, 0 - the form top border width. This 'positioning' and 'sizing' means that a maximized form automatically takes account of the position and size of the taskbar (if it is showing) no matter where it actually positioned. The upshot is, the portion of the maximized form that you can actually see is the Title Bar and the client area - some of the client area may be 'reserved' for menubars, toolbars, statusbars and other controls that do not form part of the client area depending on which VS version you are using. It seems to me that you really want to position and size your user control in relation to the client area and therefore you can use Me.ClientSize property for this purpose without having to resort to convuluted maths. Show quoteHide quote "Galen Somerville" <galen@community.nospam> wrote in message news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... > Cor > > All controls have Anchor set. The control in question is a user control > and intitially it is a small square in an unused portion of screen. > > When required it is sized at run time. I have found that the following > code cures my problem > With gScreen > > .HorPixels = Screen.GetBounds(Rect).Width > > .VerPixels = Screen.GetBounds(Rect).Height > > End With > > GalenS > > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message > news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >> Galen, >> >> I have the idea that you are doing the same problamatic things as was be >> done in the VB versions from the previous milenium >> >> Do you know the properties Dock and Anchor. >> >> They will make your live probably much easier. >> >> I hope this helps, >> >> Cor >> >> >> "Galen Somerville" <galen@community.nospam> schreef in bericht >> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>> My current screen resolution is set to 1024 x 768. My form size always >>> comes up as 1032 x 748. >>> >>> I have tried the help sample >>> ' Retrieve the working rectangle from the Screen class >>> ' using the PrimaryScreen and the WorkingArea properties. >>> Dim workingRectangle As System.Drawing.Rectangle = _ >>> Screen.PrimaryScreen.WorkingArea >>> >>> ' Set the size of the form slightly less than size of >>> ' working rectangle. >>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>> workingRectangle.Height) >>> >>> ' Set the location so the entire form is visible. >>> Me.Location = New System.Drawing.Point(0, 0) >>> >>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as >>> 1032 x 748 and location as -4 x -4 >>> >>> It doesn't matter what the StartPosition and AutoSize is set to. What >>> gives? >>> >>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) to >>> the maximum width based on the the width being a multiple of 4. I guess >>> I'll have to use the SystemDrawing.Size(workingRectangle.Width) in the >>> following code. The Form margin is set to Single. >>> >>> Index = Me.Width - 2 >>> Index = Int(Index / 4) >>> Index = Index * 4 >>> gScreen.HorPixels = Index >>> With PictDraw >>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>> X1Y1.Y = 0 >>> .Location = X1Y1 >>> X2Y2.X = gScreen.HorPixels >>> X2Y2.Y = 450 >>> .Size = X2Y2 >>> End With >>> >>> Any ideas as to why the form always comes up 1032 X748 ? >>> >>> GalenS >>> >>> >> >> > > Stephany
That explains why Me.Width doesn't work. I did end up using the Client area width but I still do the math to get multiples of 4 pixels for the Panel. Other than setting the Anchor points I'm more interested in getting the whole program working properly before I worry about resizing all forms to greater than 1024 x 768. Thanks GalenS Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... > The point everyone has seemed to missed is that you have your form > maximized. > > When a form is maximized the width of the form is the working area width + > the form left border width + the form right border width and the height of > the form is the working height is the working area height + the form top > border height + the form bottom border height. The position of the form is > 0 - the form left border width, 0 - the form top border width. > > This 'positioning' and 'sizing' means that a maximized form automatically > takes account of the position and size of the taskbar (if it is showing) > no matter where it actually positioned. > > The upshot is, the portion of the maximized form that you can actually see > is the Title Bar and the client area - some of the client area may be > 'reserved' for menubars, toolbars, statusbars and other controls that do > not form part of the client area depending on which VS version you are > using. > > It seems to me that you really want to position and size your user control > in relation to the client area and therefore you can use Me.ClientSize > property for this purpose without having to resort to convuluted maths. > > > "Galen Somerville" <galen@community.nospam> wrote in message > news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >> Cor >> >> All controls have Anchor set. The control in question is a user control >> and intitially it is a small square in an unused portion of screen. >> >> When required it is sized at run time. I have found that the following >> code cures my problem >> With gScreen >> >> .HorPixels = Screen.GetBounds(Rect).Width >> >> .VerPixels = Screen.GetBounds(Rect).Height >> >> End With >> >> GalenS >> >> >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>> Galen, >>> >>> I have the idea that you are doing the same problamatic things as was be >>> done in the VB versions from the previous milenium >>> >>> Do you know the properties Dock and Anchor. >>> >>> They will make your live probably much easier. >>> >>> I hope this helps, >>> >>> Cor >>> >>> >>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>> My current screen resolution is set to 1024 x 768. My form size always >>>> comes up as 1032 x 748. >>>> >>>> I have tried the help sample >>>> ' Retrieve the working rectangle from the Screen class >>>> ' using the PrimaryScreen and the WorkingArea properties. >>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>> Screen.PrimaryScreen.WorkingArea >>>> >>>> ' Set the size of the form slightly less than size of >>>> ' working rectangle. >>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>> workingRectangle.Height) >>>> >>>> ' Set the location so the entire form is visible. >>>> Me.Location = New System.Drawing.Point(0, 0) >>>> >>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as >>>> 1032 x 748 and location as -4 x -4 >>>> >>>> It doesn't matter what the StartPosition and AutoSize is set to. What >>>> gives? >>>> >>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) to >>>> the maximum width based on the the width being a multiple of 4. I guess >>>> I'll have to use the SystemDrawing.Size(workingRectangle.Width) in the >>>> following code. The Form margin is set to Single. >>>> >>>> Index = Me.Width - 2 >>>> Index = Int(Index / 4) >>>> Index = Index * 4 >>>> gScreen.HorPixels = Index >>>> With PictDraw >>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>> X1Y1.Y = 0 >>>> .Location = X1Y1 >>>> X2Y2.X = gScreen.HorPixels >>>> X2Y2.Y = 450 >>>> .Size = X2Y2 >>>> End With >>>> >>>> Any ideas as to why the form always comes up 1032 X748 ? >>>> >>>> GalenS >>>> >>>> >>> >>> >> >> > > Is what you you are trying to achieve as follows:
1. Make the width of the panel the multiple of 4 pixels that is less than or equal to the width of the client area 2. Make the height of the panel the multiple of 4 pixels that is less than or equal to the height of the client area 3. Center the panel in the client area If so then it is as simple as: Panel.Size = New Size(Me.ClientSize.Width - (Me.ClientSize.Width Mod 4), Me.ClientSize.Height - (Me.ClientSize.Height Mod 4) Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), (Me.ClientSize.Height - Panel.Height) / 2) Show quoteHide quote "Galen Somerville" <galen@community.nospam> wrote in message news:%239gw9rrVGHA.2208@TK2MSFTNGP15.phx.gbl... > Stephany > > That explains why Me.Width doesn't work. I did end up using the Client > area width but I still do the math to get multiples of 4 pixels for the > Panel. > > Other than setting the Anchor points I'm more interested in getting the > whole program working properly before I worry about resizing all forms to > greater than 1024 x 768. > > Thanks > GalenS > > "Stephany Young" <noone@localhost> wrote in message > news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... >> The point everyone has seemed to missed is that you have your form >> maximized. >> >> When a form is maximized the width of the form is the working area width >> + the form left border width + the form right border width and the height >> of the form is the working height is the working area height + the form >> top border height + the form bottom border height. The position of the >> form is 0 - the form left border width, 0 - the form top border width. >> >> This 'positioning' and 'sizing' means that a maximized form automatically >> takes account of the position and size of the taskbar (if it is showing) >> no matter where it actually positioned. >> >> The upshot is, the portion of the maximized form that you can actually >> see is the Title Bar and the client area - some of the client area may be >> 'reserved' for menubars, toolbars, statusbars and other controls that do >> not form part of the client area depending on which VS version you are >> using. >> >> It seems to me that you really want to position and size your user >> control in relation to the client area and therefore you can use >> Me.ClientSize property for this purpose without having to resort to >> convuluted maths. >> >> >> "Galen Somerville" <galen@community.nospam> wrote in message >> news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >>> Cor >>> >>> All controls have Anchor set. The control in question is a user control >>> and intitially it is a small square in an unused portion of screen. >>> >>> When required it is sized at run time. I have found that the following >>> code cures my problem >>> With gScreen >>> >>> .HorPixels = Screen.GetBounds(Rect).Width >>> >>> .VerPixels = Screen.GetBounds(Rect).Height >>> >>> End With >>> >>> GalenS >>> >>> >>> >>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >>> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>>> Galen, >>>> >>>> I have the idea that you are doing the same problamatic things as was >>>> be done in the VB versions from the previous milenium >>>> >>>> Do you know the properties Dock and Anchor. >>>> >>>> They will make your live probably much easier. >>>> >>>> I hope this helps, >>>> >>>> Cor >>>> >>>> >>>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>>> My current screen resolution is set to 1024 x 768. My form size always >>>>> comes up as 1032 x 748. >>>>> >>>>> I have tried the help sample >>>>> ' Retrieve the working rectangle from the Screen class >>>>> ' using the PrimaryScreen and the WorkingArea properties. >>>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>>> Screen.PrimaryScreen.WorkingArea >>>>> >>>>> ' Set the size of the form slightly less than size of >>>>> ' working rectangle. >>>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>>> workingRectangle.Height) >>>>> >>>>> ' Set the location so the entire form is visible. >>>>> Me.Location = New System.Drawing.Point(0, 0) >>>>> >>>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as >>>>> 1032 x 748 and location as -4 x -4 >>>>> >>>>> It doesn't matter what the StartPosition and AutoSize is set to. What >>>>> gives? >>>>> >>>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) to >>>>> the maximum width based on the the width being a multiple of 4. I >>>>> guess I'll have to use the SystemDrawing.Size(workingRectangle.Width) >>>>> in the following code. The Form margin is set to Single. >>>>> >>>>> Index = Me.Width - 2 >>>>> Index = Int(Index / 4) >>>>> Index = Index * 4 >>>>> gScreen.HorPixels = Index >>>>> With PictDraw >>>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>>> X1Y1.Y = 0 >>>>> .Location = X1Y1 >>>>> X2Y2.X = gScreen.HorPixels >>>>> X2Y2.Y = 450 >>>>> .Size = X2Y2 >>>>> End With >>>>> >>>>> Any ideas as to why the form always comes up 1032 X748 ? >>>>> >>>>> GalenS >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > The heigth is fixed.
In VB6 my Picturebox always filled the screen horizontally. Now I decided to let the forms borders show. It's a single border so I assume we are looking at Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) Mod 4) Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), Iheigth) GalenS Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:%23rmot7rVGHA.5012@TK2MSFTNGP10.phx.gbl... > Is what you you are trying to achieve as follows: > > 1. Make the width of the panel the multiple of 4 pixels that is less than > or equal to the width of the client area > > 2. Make the height of the panel the multiple of 4 pixels that is less than > or equal to the height of the client area > > 3. Center the panel in the client area > > If so then it is as simple as: > > Panel.Size = New Size(Me.ClientSize.Width - (Me.ClientSize.Width Mod 4), > Me.ClientSize.Height - (Me.ClientSize.Height Mod 4) > > Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), > (Me.ClientSize.Height - Panel.Height) / 2) > > > "Galen Somerville" <galen@community.nospam> wrote in message > news:%239gw9rrVGHA.2208@TK2MSFTNGP15.phx.gbl... >> Stephany >> >> That explains why Me.Width doesn't work. I did end up using the Client >> area width but I still do the math to get multiples of 4 pixels for the >> Panel. >> >> Other than setting the Anchor points I'm more interested in getting the >> whole program working properly before I worry about resizing all forms to >> greater than 1024 x 768. >> >> Thanks >> GalenS >> >> "Stephany Young" <noone@localhost> wrote in message >> news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... >>> The point everyone has seemed to missed is that you have your form >>> maximized. >>> >>> When a form is maximized the width of the form is the working area width >>> + the form left border width + the form right border width and the >>> height of the form is the working height is the working area height + >>> the form top border height + the form bottom border height. The position >>> of the form is 0 - the form left border width, 0 - the form top border >>> width. >>> >>> This 'positioning' and 'sizing' means that a maximized form >>> automatically takes account of the position and size of the taskbar (if >>> it is showing) no matter where it actually positioned. >>> >>> The upshot is, the portion of the maximized form that you can actually >>> see is the Title Bar and the client area - some of the client area may >>> be 'reserved' for menubars, toolbars, statusbars and other controls that >>> do not form part of the client area depending on which VS version you >>> are using. >>> >>> It seems to me that you really want to position and size your user >>> control in relation to the client area and therefore you can use >>> Me.ClientSize property for this purpose without having to resort to >>> convuluted maths. >>> >>> >>> "Galen Somerville" <galen@community.nospam> wrote in message >>> news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >>>> Cor >>>> >>>> All controls have Anchor set. The control in question is a user control >>>> and intitially it is a small square in an unused portion of screen. >>>> >>>> When required it is sized at run time. I have found that the following >>>> code cures my problem >>>> With gScreen >>>> >>>> .HorPixels = Screen.GetBounds(Rect).Width >>>> >>>> .VerPixels = Screen.GetBounds(Rect).Height >>>> >>>> End With >>>> >>>> GalenS >>>> >>>> >>>> >>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >>>> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>>>> Galen, >>>>> >>>>> I have the idea that you are doing the same problamatic things as was >>>>> be done in the VB versions from the previous milenium >>>>> >>>>> Do you know the properties Dock and Anchor. >>>>> >>>>> They will make your live probably much easier. >>>>> >>>>> I hope this helps, >>>>> >>>>> Cor >>>>> >>>>> >>>>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>>>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>>>> My current screen resolution is set to 1024 x 768. My form size >>>>>> always comes up as 1032 x 748. >>>>>> >>>>>> I have tried the help sample >>>>>> ' Retrieve the working rectangle from the Screen class >>>>>> ' using the PrimaryScreen and the WorkingArea properties. >>>>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>>>> Screen.PrimaryScreen.WorkingArea >>>>>> >>>>>> ' Set the size of the form slightly less than size of >>>>>> ' working rectangle. >>>>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>>>> workingRectangle.Height) >>>>>> >>>>>> ' Set the location so the entire form is visible. >>>>>> Me.Location = New System.Drawing.Point(0, 0) >>>>>> >>>>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as >>>>>> 1032 x 748 and location as -4 x -4 >>>>>> >>>>>> It doesn't matter what the StartPosition and AutoSize is set to. What >>>>>> gives? >>>>>> >>>>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) to >>>>>> the maximum width based on the the width being a multiple of 4. I >>>>>> guess I'll have to use the SystemDrawing.Size(workingRectangle.Width) >>>>>> in the following code. The Form margin is set to Single. >>>>>> >>>>>> Index = Me.Width - 2 >>>>>> Index = Int(Index / 4) >>>>>> Index = Index * 4 >>>>>> gScreen.HorPixels = Index >>>>>> With PictDraw >>>>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>>>> X1Y1.Y = 0 >>>>>> .Location = X1Y1 >>>>>> X2Y2.X = gScreen.HorPixels >>>>>> X2Y2.Y = 450 >>>>>> .Size = X2Y2 >>>>>> End With >>>>>> >>>>>> Any ideas as to why the form always comes up 1032 X748 ? >>>>>> >>>>>> GalenS >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > Nearly.
The ClientSize.Width is already the width of the portion of tyhe form 'inside' the borders, so the calculation is: Panel.Size = New Size(Me.ClientSize.Width, IHeight) Panel.Location = New Location(0, (Me.ClientSize.Height - Panel.Height) / 2) Note that the location of the Panel is in relation to the top left of the client area of the form, not the top left of the screen. Show quoteHide quote "Galen Somerville" <galen@community.nospam> wrote in message news:OKf6ityVGHA.2276@tk2msftngp13.phx.gbl... > The heigth is fixed. > > In VB6 my Picturebox always filled the screen horizontally. Now I decided > to let the forms borders show. It's a single border so I assume we are > looking at > > Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) Mod > 4) > > Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), > Iheigth) > > GalenS > > "Stephany Young" <noone@localhost> wrote in message > news:%23rmot7rVGHA.5012@TK2MSFTNGP10.phx.gbl... >> Is what you you are trying to achieve as follows: >> >> 1. Make the width of the panel the multiple of 4 pixels that is less than >> or equal to the width of the client area >> >> 2. Make the height of the panel the multiple of 4 pixels that is less >> than or equal to the height of the client area >> >> 3. Center the panel in the client area >> >> If so then it is as simple as: >> >> Panel.Size = New Size(Me.ClientSize.Width - (Me.ClientSize.Width Mod 4), >> Me.ClientSize.Height - (Me.ClientSize.Height Mod 4) >> >> Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), >> (Me.ClientSize.Height - Panel.Height) / 2) >> >> >> "Galen Somerville" <galen@community.nospam> wrote in message >> news:%239gw9rrVGHA.2208@TK2MSFTNGP15.phx.gbl... >>> Stephany >>> >>> That explains why Me.Width doesn't work. I did end up using the Client >>> area width but I still do the math to get multiples of 4 pixels for the >>> Panel. >>> >>> Other than setting the Anchor points I'm more interested in getting the >>> whole program working properly before I worry about resizing all forms >>> to greater than 1024 x 768. >>> >>> Thanks >>> GalenS >>> >>> "Stephany Young" <noone@localhost> wrote in message >>> news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... >>>> The point everyone has seemed to missed is that you have your form >>>> maximized. >>>> >>>> When a form is maximized the width of the form is the working area >>>> width + the form left border width + the form right border width and >>>> the height of the form is the working height is the working area height >>>> + the form top border height + the form bottom border height. The >>>> position of the form is 0 - the form left border width, 0 - the form >>>> top border width. >>>> >>>> This 'positioning' and 'sizing' means that a maximized form >>>> automatically takes account of the position and size of the taskbar (if >>>> it is showing) no matter where it actually positioned. >>>> >>>> The upshot is, the portion of the maximized form that you can actually >>>> see is the Title Bar and the client area - some of the client area may >>>> be 'reserved' for menubars, toolbars, statusbars and other controls >>>> that do not form part of the client area depending on which VS version >>>> you are using. >>>> >>>> It seems to me that you really want to position and size your user >>>> control in relation to the client area and therefore you can use >>>> Me.ClientSize property for this purpose without having to resort to >>>> convuluted maths. >>>> >>>> >>>> "Galen Somerville" <galen@community.nospam> wrote in message >>>> news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >>>>> Cor >>>>> >>>>> All controls have Anchor set. The control in question is a user >>>>> control and intitially it is a small square in an unused portion of >>>>> screen. >>>>> >>>>> When required it is sized at run time. I have found that the following >>>>> code cures my problem >>>>> With gScreen >>>>> >>>>> .HorPixels = Screen.GetBounds(Rect).Width >>>>> >>>>> .VerPixels = Screen.GetBounds(Rect).Height >>>>> >>>>> End With >>>>> >>>>> GalenS >>>>> >>>>> >>>>> >>>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >>>>> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>>>>> Galen, >>>>>> >>>>>> I have the idea that you are doing the same problamatic things as was >>>>>> be done in the VB versions from the previous milenium >>>>>> >>>>>> Do you know the properties Dock and Anchor. >>>>>> >>>>>> They will make your live probably much easier. >>>>>> >>>>>> I hope this helps, >>>>>> >>>>>> Cor >>>>>> >>>>>> >>>>>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>>>>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>>>>> My current screen resolution is set to 1024 x 768. My form size >>>>>>> always comes up as 1032 x 748. >>>>>>> >>>>>>> I have tried the help sample >>>>>>> ' Retrieve the working rectangle from the Screen class >>>>>>> ' using the PrimaryScreen and the WorkingArea properties. >>>>>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>>>>> Screen.PrimaryScreen.WorkingArea >>>>>>> >>>>>>> ' Set the size of the form slightly less than size of >>>>>>> ' working rectangle. >>>>>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>>>>> workingRectangle.Height) >>>>>>> >>>>>>> ' Set the location so the entire form is visible. >>>>>>> Me.Location = New System.Drawing.Point(0, 0) >>>>>>> >>>>>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up as >>>>>>> 1032 x 748 and location as -4 x -4 >>>>>>> >>>>>>> It doesn't matter what the StartPosition and AutoSize is set to. >>>>>>> What gives? >>>>>>> >>>>>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) >>>>>>> to the maximum width based on the the width being a multiple of 4. I >>>>>>> guess I'll have to use the >>>>>>> SystemDrawing.Size(workingRectangle.Width) in the following code. >>>>>>> The Form margin is set to Single. >>>>>>> >>>>>>> Index = Me.Width - 2 >>>>>>> Index = Int(Index / 4) >>>>>>> Index = Index * 4 >>>>>>> gScreen.HorPixels = Index >>>>>>> With PictDraw >>>>>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>>>>> X1Y1.Y = 0 >>>>>>> .Location = X1Y1 >>>>>>> X2Y2.X = gScreen.HorPixels >>>>>>> X2Y2.Y = 450 >>>>>>> .Size = X2Y2 >>>>>>> End With >>>>>>> >>>>>>> Any ideas as to why the form always comes up 1032 X748 ? >>>>>>> >>>>>>> GalenS >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > Nope
Me.ClientSize came out as 1,024 so I'm back to Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) Mod 4), 573) and I want it at top of Client area so Panel.Location = New Point((Me.ClientSize.Width - Panel.Width) / 2), 0) GalenS Show quoteHide quote "Stephany Young" <noone@localhost> wrote in message news:egKTZ2zVGHA.196@TK2MSFTNGP10.phx.gbl... > Nearly. > > The ClientSize.Width is already the width of the portion of tyhe form > 'inside' the borders, so the calculation is: > > Panel.Size = New Size(Me.ClientSize.Width, IHeight) > > Panel.Location = New Location(0, (Me.ClientSize.Height - Panel.Height) / > 2) > > Note that the location of the Panel is in relation to the top left of the > client area of the form, not the top left of the screen. > > > "Galen Somerville" <galen@community.nospam> wrote in message > news:OKf6ityVGHA.2276@tk2msftngp13.phx.gbl... >> The heigth is fixed. >> >> In VB6 my Picturebox always filled the screen horizontally. Now I decided >> to let the forms borders show. It's a single border so I assume we are >> looking at >> >> Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) Mod >> 4) >> >> Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), >> Iheigth) >> >> GalenS >> >> "Stephany Young" <noone@localhost> wrote in message >> news:%23rmot7rVGHA.5012@TK2MSFTNGP10.phx.gbl... >>> Is what you you are trying to achieve as follows: >>> >>> 1. Make the width of the panel the multiple of 4 pixels that is less >>> than or equal to the width of the client area >>> >>> 2. Make the height of the panel the multiple of 4 pixels that is less >>> than or equal to the height of the client area >>> >>> 3. Center the panel in the client area >>> >>> If so then it is as simple as: >>> >>> Panel.Size = New Size(Me.ClientSize.Width - (Me.ClientSize.Width Mod >>> 4), Me.ClientSize.Height - (Me.ClientSize.Height Mod 4) >>> >>> Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), >>> (Me.ClientSize.Height - Panel.Height) / 2) >>> >>> >>> "Galen Somerville" <galen@community.nospam> wrote in message >>> news:%239gw9rrVGHA.2208@TK2MSFTNGP15.phx.gbl... >>>> Stephany >>>> >>>> That explains why Me.Width doesn't work. I did end up using the Client >>>> area width but I still do the math to get multiples of 4 pixels for the >>>> Panel. >>>> >>>> Other than setting the Anchor points I'm more interested in getting the >>>> whole program working properly before I worry about resizing all forms >>>> to greater than 1024 x 768. >>>> >>>> Thanks >>>> GalenS >>>> >>>> "Stephany Young" <noone@localhost> wrote in message >>>> news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... >>>>> The point everyone has seemed to missed is that you have your form >>>>> maximized. >>>>> >>>>> When a form is maximized the width of the form is the working area >>>>> width + the form left border width + the form right border width and >>>>> the height of the form is the working height is the working area >>>>> height + the form top border height + the form bottom border height. >>>>> The position of the form is 0 - the form left border width, 0 - the >>>>> form top border width. >>>>> >>>>> This 'positioning' and 'sizing' means that a maximized form >>>>> automatically takes account of the position and size of the taskbar >>>>> (if it is showing) no matter where it actually positioned. >>>>> >>>>> The upshot is, the portion of the maximized form that you can actually >>>>> see is the Title Bar and the client area - some of the client area may >>>>> be 'reserved' for menubars, toolbars, statusbars and other controls >>>>> that do not form part of the client area depending on which VS version >>>>> you are using. >>>>> >>>>> It seems to me that you really want to position and size your user >>>>> control in relation to the client area and therefore you can use >>>>> Me.ClientSize property for this purpose without having to resort to >>>>> convuluted maths. >>>>> >>>>> >>>>> "Galen Somerville" <galen@community.nospam> wrote in message >>>>> news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >>>>>> Cor >>>>>> >>>>>> All controls have Anchor set. The control in question is a user >>>>>> control and intitially it is a small square in an unused portion of >>>>>> screen. >>>>>> >>>>>> When required it is sized at run time. I have found that the >>>>>> following code cures my problem >>>>>> With gScreen >>>>>> >>>>>> .HorPixels = Screen.GetBounds(Rect).Width >>>>>> >>>>>> .VerPixels = Screen.GetBounds(Rect).Height >>>>>> >>>>>> End With >>>>>> >>>>>> GalenS >>>>>> >>>>>> >>>>>> >>>>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >>>>>> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>>>>>> Galen, >>>>>>> >>>>>>> I have the idea that you are doing the same problamatic things as >>>>>>> was be done in the VB versions from the previous milenium >>>>>>> >>>>>>> Do you know the properties Dock and Anchor. >>>>>>> >>>>>>> They will make your live probably much easier. >>>>>>> >>>>>>> I hope this helps, >>>>>>> >>>>>>> Cor >>>>>>> >>>>>>> >>>>>>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>>>>>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>>>>>> My current screen resolution is set to 1024 x 768. My form size >>>>>>>> always comes up as 1032 x 748. >>>>>>>> >>>>>>>> I have tried the help sample >>>>>>>> ' Retrieve the working rectangle from the Screen class >>>>>>>> ' using the PrimaryScreen and the WorkingArea properties. >>>>>>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>>>>>> Screen.PrimaryScreen.WorkingArea >>>>>>>> >>>>>>>> ' Set the size of the form slightly less than size of >>>>>>>> ' working rectangle. >>>>>>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>>>>>> workingRectangle.Height) >>>>>>>> >>>>>>>> ' Set the location so the entire form is visible. >>>>>>>> Me.Location = New System.Drawing.Point(0, 0) >>>>>>>> >>>>>>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up >>>>>>>> as 1032 x 748 and location as -4 x -4 >>>>>>>> >>>>>>>> It doesn't matter what the StartPosition and AutoSize is set to. >>>>>>>> What gives? >>>>>>>> >>>>>>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) >>>>>>>> to the maximum width based on the the width being a multiple of 4. >>>>>>>> I guess I'll have to use the >>>>>>>> SystemDrawing.Size(workingRectangle.Width) in the following code. >>>>>>>> The Form margin is set to Single. >>>>>>>> >>>>>>>> Index = Me.Width - 2 >>>>>>>> Index = Int(Index / 4) >>>>>>>> Index = Index * 4 >>>>>>>> gScreen.HorPixels = Index >>>>>>>> With PictDraw >>>>>>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>>>>>> X1Y1.Y = 0 >>>>>>>> .Location = X1Y1 >>>>>>>> X2Y2.X = gScreen.HorPixels >>>>>>>> X2Y2.Y = 450 >>>>>>>> .Size = X2Y2 >>>>>>>> End With >>>>>>>> >>>>>>>> Any ideas as to why the form always comes up 1032 X748 ? >>>>>>>> >>>>>>>> GalenS >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > Stephany
The actual code ended up as follows PictDraw.Size = New Size((Int((Me.ClientSize.Width - 2) / 4)) * 4, 450) PictDraw.Location = New Point(((Me.ClientSize.Width - PictDraw.Width) / 2), 0) gScreen.HorPixels = PictDraw.Width GalenS Show quoteHide quote "Galen Somerville" <galen@community.nospam> wrote in message news:eUj3WI0VGHA.2276@tk2msftngp13.phx.gbl... > Nope > Me.ClientSize came out as 1,024 so I'm back to > Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) Mod > 4), 573) > > and I want it at top of Client area so > Panel.Location = New Point((Me.ClientSize.Width - Panel.Width) / 2), 0) > > GalenS > > "Stephany Young" <noone@localhost> wrote in message > news:egKTZ2zVGHA.196@TK2MSFTNGP10.phx.gbl... >> Nearly. >> >> The ClientSize.Width is already the width of the portion of tyhe form >> 'inside' the borders, so the calculation is: >> >> Panel.Size = New Size(Me.ClientSize.Width, IHeight) >> >> Panel.Location = New Location(0, (Me.ClientSize.Height - Panel.Height) / >> 2) >> >> Note that the location of the Panel is in relation to the top left of the >> client area of the form, not the top left of the screen. >> >> >> "Galen Somerville" <galen@community.nospam> wrote in message >> news:OKf6ityVGHA.2276@tk2msftngp13.phx.gbl... >>> The heigth is fixed. >>> >>> In VB6 my Picturebox always filled the screen horizontally. Now I >>> decided to let the forms borders show. It's a single border so I assume >>> we are looking at >>> >>> Panel.Size = New Size(Me.ClientSize.Width - ((Me.ClientSize.Width- 2) >>> Mod 4) >>> >>> Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / 2), >>> Iheigth) >>> >>> GalenS >>> >>> "Stephany Young" <noone@localhost> wrote in message >>> news:%23rmot7rVGHA.5012@TK2MSFTNGP10.phx.gbl... >>>> Is what you you are trying to achieve as follows: >>>> >>>> 1. Make the width of the panel the multiple of 4 pixels that is less >>>> than or equal to the width of the client area >>>> >>>> 2. Make the height of the panel the multiple of 4 pixels that is less >>>> than or equal to the height of the client area >>>> >>>> 3. Center the panel in the client area >>>> >>>> If so then it is as simple as: >>>> >>>> Panel.Size = New Size(Me.ClientSize.Width - (Me.ClientSize.Width Mod >>>> 4), Me.ClientSize.Height - (Me.ClientSize.Height Mod 4) >>>> >>>> Panel.Location = New Location((Me.ClientSize.Width - Panel.Width) / >>>> 2), (Me.ClientSize.Height - Panel.Height) / 2) >>>> >>>> >>>> "Galen Somerville" <galen@community.nospam> wrote in message >>>> news:%239gw9rrVGHA.2208@TK2MSFTNGP15.phx.gbl... >>>>> Stephany >>>>> >>>>> That explains why Me.Width doesn't work. I did end up using the Client >>>>> area width but I still do the math to get multiples of 4 pixels for >>>>> the Panel. >>>>> >>>>> Other than setting the Anchor points I'm more interested in getting >>>>> the whole program working properly before I worry about resizing all >>>>> forms to greater than 1024 x 768. >>>>> >>>>> Thanks >>>>> GalenS >>>>> >>>>> "Stephany Young" <noone@localhost> wrote in message >>>>> news:OuUfiqqVGHA.3760@TK2MSFTNGP15.phx.gbl... >>>>>> The point everyone has seemed to missed is that you have your form >>>>>> maximized. >>>>>> >>>>>> When a form is maximized the width of the form is the working area >>>>>> width + the form left border width + the form right border width and >>>>>> the height of the form is the working height is the working area >>>>>> height + the form top border height + the form bottom border height. >>>>>> The position of the form is 0 - the form left border width, 0 - the >>>>>> form top border width. >>>>>> >>>>>> This 'positioning' and 'sizing' means that a maximized form >>>>>> automatically takes account of the position and size of the taskbar >>>>>> (if it is showing) no matter where it actually positioned. >>>>>> >>>>>> The upshot is, the portion of the maximized form that you can >>>>>> actually see is the Title Bar and the client area - some of the >>>>>> client area may be 'reserved' for menubars, toolbars, statusbars and >>>>>> other controls that do not form part of the client area depending on >>>>>> which VS version you are using. >>>>>> >>>>>> It seems to me that you really want to position and size your user >>>>>> control in relation to the client area and therefore you can use >>>>>> Me.ClientSize property for this purpose without having to resort to >>>>>> convuluted maths. >>>>>> >>>>>> >>>>>> "Galen Somerville" <galen@community.nospam> wrote in message >>>>>> news:esfMIMPVGHA.4884@TK2MSFTNGP10.phx.gbl... >>>>>>> Cor >>>>>>> >>>>>>> All controls have Anchor set. The control in question is a user >>>>>>> control and intitially it is a small square in an unused portion of >>>>>>> screen. >>>>>>> >>>>>>> When required it is sized at run time. I have found that the >>>>>>> following code cures my problem >>>>>>> With gScreen >>>>>>> >>>>>>> .HorPixels = Screen.GetBounds(Rect).Width >>>>>>> >>>>>>> .VerPixels = Screen.GetBounds(Rect).Height >>>>>>> >>>>>>> End With >>>>>>> >>>>>>> GalenS >>>>>>> >>>>>>> >>>>>>> >>>>>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >>>>>>> news:ubPc8xJVGHA.5828@TK2MSFTNGP10.phx.gbl... >>>>>>>> Galen, >>>>>>>> >>>>>>>> I have the idea that you are doing the same problamatic things as >>>>>>>> was be done in the VB versions from the previous milenium >>>>>>>> >>>>>>>> Do you know the properties Dock and Anchor. >>>>>>>> >>>>>>>> They will make your live probably much easier. >>>>>>>> >>>>>>>> I hope this helps, >>>>>>>> >>>>>>>> Cor >>>>>>>> >>>>>>>> >>>>>>>> "Galen Somerville" <galen@community.nospam> schreef in bericht >>>>>>>> news:e8hdSgBVGHA.4900@TK2MSFTNGP12.phx.gbl... >>>>>>>>> My current screen resolution is set to 1024 x 768. My form size >>>>>>>>> always comes up as 1032 x 748. >>>>>>>>> >>>>>>>>> I have tried the help sample >>>>>>>>> ' Retrieve the working rectangle from the Screen class >>>>>>>>> ' using the PrimaryScreen and the WorkingArea properties. >>>>>>>>> Dim workingRectangle As System.Drawing.Rectangle = _ >>>>>>>>> Screen.PrimaryScreen.WorkingArea >>>>>>>>> >>>>>>>>> ' Set the size of the form slightly less than size of >>>>>>>>> ' working rectangle. >>>>>>>>> Me.Size = New System.Drawing.Size(workingRectangle.Width, _ >>>>>>>>> workingRectangle.Height) >>>>>>>>> >>>>>>>>> ' Set the location so the entire form is visible. >>>>>>>>> Me.Location = New System.Drawing.Point(0, 0) >>>>>>>>> >>>>>>>>> the workingRectangle comes up as 1024 x 740. the Me.Size comes up >>>>>>>>> as 1032 x 748 and location as -4 x -4 >>>>>>>>> >>>>>>>>> It doesn't matter what the StartPosition and AutoSize is set to. >>>>>>>>> What gives? >>>>>>>>> >>>>>>>>> I'm trying to use the Form Width to set a drawing Panel (PictDraw) >>>>>>>>> to the maximum width based on the the width being a multiple of 4. >>>>>>>>> I guess I'll have to use the >>>>>>>>> SystemDrawing.Size(workingRectangle.Width) in the following code. >>>>>>>>> The Form margin is set to Single. >>>>>>>>> >>>>>>>>> Index = Me.Width - 2 >>>>>>>>> Index = Int(Index / 4) >>>>>>>>> Index = Index * 4 >>>>>>>>> gScreen.HorPixels = Index >>>>>>>>> With PictDraw >>>>>>>>> X1Y1.X = Int(Int((Me.Width - Index) ) / 2) >>>>>>>>> X1Y1.Y = 0 >>>>>>>>> .Location = X1Y1 >>>>>>>>> X2Y2.X = gScreen.HorPixels >>>>>>>>> X2Y2.Y = 450 >>>>>>>>> .Size = X2Y2 >>>>>>>>> End With >>>>>>>>> >>>>>>>>> Any ideas as to why the form always comes up 1032 X748 ? >>>>>>>>> >>>>>>>>> GalenS >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > >
Do properties return byref or byval?
select text in textbox call method on passed form VB .Net with ADSI problem Convert IsMissing, IsNull, VBempty to vb.net Easily upgrade B to VB.NET Basic Question - Working with forms .vbprog not installed! VB 2005 - URGENT Check Mapped Drive is Connected Recast an exception to its original type |
|||||||||||||||||||||||