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 14 3332
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" <ga***@community.nospam> wrote in message
news:e8**************@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
"Galen Somerville" <ga***@community.nospam> wrote in message
news:e8**************@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" <ga***@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/>
I forgot to mention that the sizing code is in Form_Load
GalenS
"Kevin Westhead" <ma***********@nospam.nospam> wrote in message
news:Oh**************@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" <ga***@community.nospam> wrote in message news:e8**************@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 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
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl... "Galen Somerville" <ga***@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
"Galen Somerville" <ga***@community.nospam> schreef in bericht
news:e8**************@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
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ub**************@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" <ga***@community.nospam> schreef in bericht news:e8**************@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.
"Galen Somerville" <ga***@community.nospam> wrote in message
news:es**************@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]" <no************@planet.nl> wrote in message news:ub**************@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" <ga***@community.nospam> schreef in bericht news:e8**************@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
"Stephany Young" <noone@localhost> wrote in message
news:Ou**************@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" <ga***@community.nospam> wrote in message news:es**************@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]" <no************@planet.nl> wrote in message news:ub**************@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" <ga***@community.nospam> schreef in bericht news:e8**************@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)
"Galen Somerville" <ga***@community.nospam> wrote in message
news:%2****************@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:Ou**************@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" <ga***@community.nospam> wrote in message news:es**************@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]" <no************@planet.nl> wrote in message news:ub**************@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" <ga***@community.nospam> schreef in bericht news:e8**************@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
"Stephany Young" <noone@localhost> wrote in message
news:%2****************@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" <ga***@community.nospam> wrote in message news:%2****************@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:Ou**************@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" <ga***@community.nospam> wrote in message news:es**************@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]" <no************@planet.nl> wrote in message news:ub**************@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" <ga***@community.nospam> schreef in bericht > news:e8**************@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.
"Galen Somerville" <ga***@community.nospam> wrote in message
news:OK**************@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:%2****************@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" <ga***@community.nospam> wrote in message news:%2****************@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:Ou**************@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" <ga***@community.nospam> wrote in message news:es**************@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]" <no************@planet.nl> wrote in message > news:ub**************@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" <ga***@community.nospam> schreef in bericht >> news:e8**************@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
"Stephany Young" <noone@localhost> wrote in message
news:eg*************@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" <ga***@community.nospam> wrote in message news:OK**************@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:%2****************@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" <ga***@community.nospam> wrote in message news:%2****************@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:Ou**************@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" <ga***@community.nospam> wrote in message > news:es**************@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]" <no************@planet.nl> wrote in message >> news:ub**************@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" <ga***@community.nospam> schreef in bericht >>> news:e8**************@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
"Galen Somerville" <ga***@community.nospam> wrote in message
news:eU**************@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:eg*************@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" <ga***@community.nospam> wrote in message news:OK**************@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:%2****************@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" <ga***@community.nospam> wrote in message news:%2****************@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:Ou**************@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" <ga***@community.nospam> wrote in message >> news:es**************@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]" <no************@planet.nl> wrote in message >>> news:ub**************@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" <ga***@community.nospam> schreef in bericht >>>> news:e8**************@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 >>>>> >>>>> >>>> >>>> >>> >>> >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jozef |
last post by:
I have some old code that I use from the Access 95 Developers handbook. The
code works very well, with the exception that it doesn't seem to recognize
wide screens, and sizes tab controls so that...
|
by: Jaikumar |
last post by:
Hi,
1) I have created one windows application, In the main form ( form1) i have added one usercontrol (usercontrol1), In that user control i am drawing one image.
2) In the UserControl1 i am...
|
by: Rod Gill |
last post by:
Hi,
I have a form that when opened in the designer appears of the screen. The
form selector can't be dragged (or resized) and if I scroll right and down
to centralise it the form simply jumps...
|
by: Philip Wagenaar |
last post by:
I have made a form with a tab that containts groupboxes and those contain
checkboxes.
When I run the application sometimes the outlining for some groupboxes are
not shown, if I switch tabs and...
|
by: Bill |
last post by:
I'm using the POST method to submit a simple form html page with yes/no
and checkbox fields to an asp response page which stores the values in
a new dim string, then uses it to build a new table...
|
by: Sithlord999 |
last post by:
Hello.
I'm working on an email form on Dreamweaver and I'm looking for a PHP code to make it work. The form with some required fields would send the submitted information and two image attachments...
|
by: Ryan |
last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip,
data binding elements (dataset, binding source, table adapter), tab control
with 7 tab pages, each page contains a...
|
by: justplain.kzn |
last post by:
Hi,
I have a table with dynamic html that contains drop down select lists
and readonly text boxes. Dynamic calculations are done on change of a
value in one of the drop down select lists.
...
|
by: sammiesue |
last post by:
Hi,
I have form with 2 autosummed textboxes ("total" and "casinototal"). I would like to have a grand total textbox ("grandtotal") get its value from summing "total" and "casinototal", but it...
|
by: punitshrivastava |
last post by:
Hi to All.
I am Punit Shrivastava.I am working in Asp.As i am new in this technology please help me.
I want to create enquiry form in Asp.
For this i code like this:
<form name="enquiry"...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |