Prev: Uninstall
Next: Using LINQ to SQL
From: Cor Ligthert[MVP] on 13 Jun 2010 02:46 Why then do you set that anchor. You can remove it completely in my idea. In my idea is for your solution panels and docking more used. "Mr. X." <nospam(a)nospam_please.com> wrote in message news:OSB4qFsCLHA.5464(a)TK2MSFTNGP05.phx.gbl... > O.K. > Solved !!! > I have solved the above, by keeping the old anchor, and every time when > the event : > properyGrid.SelectedGridItemChanged, I am checking whether the old anchor > has changed. > If it is changed, then I move the same anchor from the first control to > the second one. > That's solved the problem, and I can keep on ... > If you have any other comments on my approach, I would like to know about. > > Thanks, anyway :) >
From: Mr. X. on 14 Jun 2010 04:23 "Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> wrote : > Why then do you set that anchor. > You can remove it completely in my idea. > > In my idea is for your solution panels and docking more used. I am using the PropertyGrid panel, and it has anchor on it - can I hide it ? Besides, I have overcomed the anchor problem. I need the propertyGrid for the most of the propeties (colors, borders, etc ....). All the layout, and position - I am doing by hands in the hard way. Now - I try to overcome setting parent-child relations as it should be set (panel that has some controls on it). Thanks :)
From: Onur Güzel on 14 Jun 2010 09:32
On Jun 13, 12:46 am, "Mr. X." <nospam(a)nospam_please.com> wrote: > Hello. > How can I capture the event, when changing the anchor property of the > control ? > > I.e : > myPanel.anchor = AnchorStyles.Left & AnchorStyles.Bottom > ... > How can I know, when the Anchor property is changed (which event?) ? > > Thanks :) Hi, Though there's no built-in event like OnAnchorChanged, however you can still write your own event and sync it with the original anchor property behind the scenes. The key part is that you have to assign anchor property to your own property like named "PropGrid1Anchor", rather than native Control.Anchor at runtime, like in the example below. Place this into your existing Form class code: '-------------------------------------------------------------------- Private Sub Button1_Click _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click ' Change our custom anchor property to see it raised Me.PropGrid1Anchor = AnchorStyles.Right _ Or AnchorStyles.Bottom End Sub Public Event PropGrid1AnchorChanged(ByVal sender As Object) Public Property PropGrid1Anchor() As AnchorStyles Get Return Me.PropertyGrid1.Anchor End Get Set(ByVal value As AnchorStyles) ' It will also set built-in anchor property Me.PropertyGrid1.Anchor = value ' Let it raise RaiseEvent PropGrid1AnchorChanged(Me) End Set End Property Public Sub PropGrid_AnchorChanged _ (ByVal sender As Object) _ Handles Me.PropGrid1AnchorChanged ' Test it MsgBox("Raised!") End Sub '-------------------------------------------------------------------- Note that you're assigning anchor property to specific instance of PropertyGrid control, that is PropertyGrid1. You can customize it in order to your needs. There may be other thoughts, but also it can be an option to evaluate. HTH, Onur Güzel |