Control know when moved

  • Thread starter Thread starter Smokey Grindle
  • Start date Start date
S

Smokey Grindle

Is there any way for a control to know when its location moved? and OnEvents
or such?
 
let me rephrase this... I know there is a locationchanged event, but what is
its OnEvent (overridable) method?
 
Smokey said:
let me rephrase this... I know there is a locationchanged event, but what is
its OnEvent (overridable) method?

Just guessing from Our Friends in Redmond's usual convention ...

OnLocationChanged ?

HTH,
Phill W.
 
I'm confused. If you want the LocationChanged event, there is the
OnLocationChanged method. Normally you prepend the event name with
"On". Isn't that obvious?
 
To add to this, it is also NOT already used anywhere in the class... checked
that a couple times already :(
 
What object are you working with? What version of VS?

OnLocationChanged is documented as far back as .NET 1.1 for
System.Windows.Forms.Control, from which the user controls inherit.
 
How about the Move event

Private Sub Button6_Move(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button6.Move
Console.WriteLine(Button6.Top.ToString)
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
Dim i As Integer = Button6.Top
i -= 10
Button6.Top = i
End Sub
 
It's a custom control object inheriting from all things...
System.Windows.Forms.Control... which this SHOULD be there... dont know why
its not... and this is .NET 2.0
 
When I create a class like this:

Public Class Class1
Inherits System.Windows.Forms.Control
End Class

I see OnLocationChanged as an overridable method.
 
It's a custom control object inheriting from all things...
System.Windows.Forms.Control... which this SHOULD be there... dont know why
its not... and this is .NET 2.0

Just override the Location property and fire off your own
LocationChanged event in the set part of the property declaration.

Thanks,

Seth Rowe
 
Back
Top