PC Review


Reply
Thread Tools Rate Thread

Control.Location

 
 
CJ Taylor
Guest
Posts: n/a
 
      3rd Mar 2004
Alright found a bug in the framework I think...

Someone try this...

Build 2 forms.

In form one, add a button that will open form 2.

so

Public Class Form1
inherits System.Windows.Forms.Form

...

private sub onButtonClick (sender as object, e as system.eventargs) handles
button1.click

dim f2 as new Form2
f2.Location = new Point(250,250)
f2.Showdialog()
end sub

end class

on form 2... add a label

on your load event, add this

me.mylabel.text = string.format ("X Coord: {0} Y Coord: {1}")

your coords will say 250,250, however, you will be able tosee your probably
not at 250, 250...

However, if you set the location on the form load, it will work. So
something in Load resets the value of the location... at least this is what
I've been dealing with...

Anywone else experience this?

-CJ




 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Mar 2004
* "CJ Taylor" <(E-Mail Removed)> scripsit:
> Alright found a bug in the framework I think...


I don't think so.

> Build 2 forms.
>
> In form one, add a button that will open form 2.
>
> so
>
> Public Class Form1
> inherits System.Windows.Forms.Form
>
> ...
>
> private sub onButtonClick (sender as object, e as system.eventargs) handles
> button1.click
>
> dim f2 as new Form2
> f2.Location = new Point(250,250)
> f2.Showdialog()
> end sub
>
> end class
>
> on form 2... add a label
>
> on your load event, add this
>
> me.mylabel.text = string.format ("X Coord: {0} Y Coord: {1}")
>
> your coords will say 250,250, however, you will be able tosee your probably
> not at 250, 250...
>
> However, if you set the location on the form load, it will work. So
> something in Load resets the value of the location... at least this is what
> I've been dealing with...


Are you sure the form's 'StartPosition' property is set to 'Manual'?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Mar 2004
Hi CJ,

Same behaviour I think you are right

\\
Dim f2 As New Form2
f2.Text = "CJ" ' Is always showed right
f2.Location = New Point(250, 250)
' f2.CJ = New Point(250, 250) ' This works fine
f2.ShowDialog()
///
\\\
Public CJ As Point
Private Sub Form2_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' Me.Location = CJ ' this works fine
Me.Label1.Text = Me.Location.X.ToString & " " & Me.Location.Y.ToString
End Sub
///

However, you will see in some minutes comes Herfried and he has the message
"known bug".

:-)

Cor



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Mar 2004
Hi Herfried,
\\\
Dim f2 As New Form2
f2.Text = "CJ"
f2.StartPosition = FormStartPosition.Manual
f2.Location = New Point(250, 250)
' f2.CJ = New Point(250, 250) ' This works fine
f2.ShowDialog()
///

Yes works also

> Are you sure the form's 'StartPosition' property is set to 'Manual'?


Why should you do that, do you have documentation?

Cor


 
Reply With Quote
 
CJ Taylor
Guest
Posts: n/a
 
      3rd Mar 2004
Regardless. If you look at the forms Left and Top Properties (which will
match the corresponding X,Y props of the form) it will say the coordiantes
you entered, although its not the actual coordinates of the form.

However, they obviously aren't there. My point being, if its the
StartPosition, then it should change the X,Y coords and not just draw the
form without modifying those properties.

2). Documentation could be better.


"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:c250in$1pl1ok$(E-Mail Removed)...
> * "CJ Taylor" <(E-Mail Removed)> scripsit:
> > Alright found a bug in the framework I think...

>
> I don't think so.
>
> > Build 2 forms.
> >
> > In form one, add a button that will open form 2.
> >
> > so
> >
> > Public Class Form1
> > inherits System.Windows.Forms.Form
> >
> > ...
> >
> > private sub onButtonClick (sender as object, e as system.eventargs)

handles
> > button1.click
> >
> > dim f2 as new Form2
> > f2.Location = new Point(250,250)
> > f2.Showdialog()
> > end sub
> >
> > end class
> >
> > on form 2... add a label
> >
> > on your load event, add this
> >
> > me.mylabel.text = string.format ("X Coord: {0} Y Coord: {1}")
> >
> > your coords will say 250,250, however, you will be able tosee your

probably
> > not at 250, 250...
> >
> > However, if you set the location on the form load, it will work. So
> > something in Load resets the value of the location... at least this is

what
> > I've been dealing with...

>
> Are you sure the form's 'StartPosition' property is set to 'Manual'?
>
> --
> Herfried K. Wagner [MVP]
> <http://dotnet.mvps.org/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Mar 2004
* "Cor" <(E-Mail Removed)> scripsit:
> \\\
> Dim f2 As New Form2
> f2.Text = "CJ"
> f2.StartPosition = FormStartPosition.Manual
> f2.Location = New Point(250, 250)
> ' f2.CJ = New Point(250, 250) ' This works fine
> f2.ShowDialog()
> ///
>
> Yes works also
>
>> Are you sure the form's 'StartPosition' property is set to 'Manual'?

>
> Why should you do that, do you have documentation?


If you don't set it, Windows will determine the position used to show
the form even if you set the position.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Mar 2004
* "CJ Taylor" <(E-Mail Removed)> scripsit:
> Regardless. If you look at the forms Left and Top Properties (which will
> match the corresponding X,Y props of the form) it will say the coordiantes
> you entered, although its not the actual coordinates of the form.
>
> However, they obviously aren't there. My point being, if its the
> StartPosition, then it should change the X,Y coords and not just draw the
> form without modifying those properties.


ACK.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      3rd Mar 2004
Hi CJ,

>
> 2). Documentation could be better.


Take my sample with the public variable, therefore it is not necessary to
set it to manual.

Cor


 
Reply With Quote
 
CJ Taylor
Guest
Posts: n/a
 
      3rd Mar 2004
So am I right or wrong?

"Herfried K. Wagner [MVP]" <hirf-spam-me-(E-Mail Removed)> wrote in message
news:c251lq$1pm8nb$(E-Mail Removed)...
> * "Cor" <(E-Mail Removed)> scripsit:
> > \\\
> > Dim f2 As New Form2
> > f2.Text = "CJ"
> > f2.StartPosition = FormStartPosition.Manual
> > f2.Location = New Point(250, 250)
> > ' f2.CJ = New Point(250, 250) ' This works fine
> > f2.ShowDialog()
> > ///
> >
> > Yes works also
> >
> >> Are you sure the form's 'StartPosition' property is set to 'Manual'?

> >
> > Why should you do that, do you have documentation?

>
> If you don't set it, Windows will determine the position used to show
> the form even if you set the position.
>
> --
> Herfried K. Wagner [MVP]
> <http://dotnet.mvps.org/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      3rd Mar 2004
* "CJ Taylor" <(E-Mail Removed)> scripsit:
> So am I right or wrong?


You are right, but I am not sure if it's a real bug.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 2100: The control or subform control is too large for this location Larry Microsoft Access 0 28th Sep 2005 04:18 PM
control-end location =?Utf-8?B?YmlsbGlucg==?= Microsoft Excel Misc 2 16th Nov 2004 01:12 PM
Control Location Bryan Hughes Microsoft Access Form Coding 0 9th Nov 2004 01:52 AM
location of a control Gonzalo Rodriguez Microsoft Dot NET Framework Forms 5 20th Jun 2004 01:36 PM
RE: Anchoring a Control "relative" to another control's size and location. Duke Sun Microsoft Dot NET Framework Forms 1 29th Jun 2003 05:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:22 PM.