mysterious resize behavior...

L

Lloyd Dupont

I have developed a custom Control inheriting from
System.Windows.Forms.Control
It has some children control.
Something really weird happen when I resize it, its children control move!
Even though I have specified Anchor = AnchorStyle.None & Dock =
DockStyle.None (and I checked with the debugger that they still equals to
that).

Any idea why it is so?

I have setup a break point on an event handler of the move event to
understand what's going on. (stack trace below).
starting with #### are the method I implement (but none set
Location/bounds/whatever), very mysterious...
any idea?
#####
PowerGui.dll!PowerGui.Grid.DefaultGridCell<System.Windows.Forms.TextBox>.control_Move(object
sender = {Text = ""}, System.EventArgs e = {System.EventArgs}) Line 265 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.OnMove(System.EventArgs
e) + 0x71 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnLocationChanged(System.EventArgs
e = {System.EventArgs}) + 0x26 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x,
int y, int width, int height, int clientWidth, int clientHeight) + 0x95
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds() +
0x1e8 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x696 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 3, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
[Native to Managed Transition]
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x94 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.DefWndProc(ref
System.Windows.Forms.Message m) + 0xc bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmWindowPosChanged(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x24 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x7a5 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 71, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBoundsCore(int x,
int y, int width, int height, System.Windows.Forms.BoundsSpecified specified
= None) + 0x194 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.SetBoundsCore(int
x, int y, int width, int height, System.Windows.Forms.BoundsSpecified
specified) + 0xc4 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle
bounds, System.Windows.Forms.BoundsSpecified specified) + 0x101 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.ApplyCachedBounds(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}) + 0x111 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.xLayout(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}, bool measureOnly, out
System.Drawing.Size preferredSize) + 0x164 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.LayoutCore(System.Windows.Forms.Layout.IArrangedElement
container, System.Windows.Forms.LayoutEventArgs args) + 0x19 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutEngine.Layout(object
container, System.Windows.Forms.LayoutEventArgs layoutEventArgs) + 0x19
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnLayout(System.Windows.Forms.LayoutEventArgs
levent) + 0x78 bytes
#####
PowerGui.dll!PowerGui.Controls.ScrollView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 700 + 0xa bytes C#
#####
PowerGui.dll!PowerGui.Grid.GridView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 329 + 0x9 bytes C#
System.Windows.Forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.LayoutEventArgs
args) + 0xa7 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement
affectedElement, string affectedProperty) + 0x2e bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutTransaction.DoLayout(System.Windows.Forms.Layout.IArrangedElement
elementToLayout, System.Windows.Forms.Layout.IArrangedElement
elementCausingLayout, string property) + 0x2c bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnResize(System.EventArgs
e = {System.EventArgs}) + 0x48 bytes
##### PowerGui.dll!PowerGui.Controls.ScrollView.OnResize(System.EventArgs
e = {System.EventArgs}) Line 605 + 0xb bytes C#
##### PowerGui.dll!PowerGui.Grid.GridView.OnResize(System.EventArgs e =
{System.EventArgs}) Line 297 + 0x9 bytes C#
 
L

Lloyd Dupont

I found a work around!
apparently a layout manager was involved.
I substitute my own and it fixed the issue. whatever it was...

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
Lloyd Dupont said:
I have developed a custom Control inheriting from
System.Windows.Forms.Control
It has some children control.
Something really weird happen when I resize it, its children control move!
Even though I have specified Anchor = AnchorStyle.None & Dock =
DockStyle.None (and I checked with the debugger that they still equals to
that).

Any idea why it is so?

I have setup a break point on an event handler of the move event to
understand what's going on. (stack trace below).
starting with #### are the method I implement (but none set
Location/bounds/whatever), very mysterious...
any idea?
#####
PowerGui.dll!PowerGui.Grid.DefaultGridCell<System.Windows.Forms.TextBox>.control_Move(object
sender = {Text = ""}, System.EventArgs e = {System.EventArgs}) Line 265
C#

System.Windows.Forms.dll!System.Windows.Forms.Control.OnMove(System.EventArgs
e) + 0x71 bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.OnLocationChanged(System.EventArgs
e = {System.EventArgs}) + 0x26 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x,
int y, int width, int height, int clientWidth, int clientHeight) + 0x95
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds() +
0x1e8 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x696 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes

System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 3, System.IntPtr wparam, System.IntPtr lparam) + 0x75
bytes
[Native to Managed Transition]
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x94 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.DefWndProc(ref
System.Windows.Forms.Message m) + 0xc bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.WmWindowPosChanged(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x24 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x7a5 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes

System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 71, System.IntPtr wparam, System.IntPtr lparam) + 0x75
bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBoundsCore(int
x, int y, int width, int height, System.Windows.Forms.BoundsSpecified
specified = None) + 0x194 bytes

System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.SetBoundsCore(int
x, int y, int width, int height, System.Windows.Forms.BoundsSpecified
specified) + 0xc4 bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle
bounds, System.Windows.Forms.BoundsSpecified specified) + 0x101 bytes

System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.ApplyCachedBounds(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}) + 0x111 bytes

System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.xLayout(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}, bool measureOnly, out
System.Drawing.Size preferredSize) + 0x164 bytes

System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.LayoutCore(System.Windows.Forms.Layout.IArrangedElement
container, System.Windows.Forms.LayoutEventArgs args) + 0x19 bytes

System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutEngine.Layout(object
container, System.Windows.Forms.LayoutEventArgs layoutEventArgs) + 0x19
bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.OnLayout(System.Windows.Forms.LayoutEventArgs
levent) + 0x78 bytes
#####
PowerGui.dll!PowerGui.Controls.ScrollView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 700 + 0xa bytes C#
#####
PowerGui.dll!PowerGui.Grid.GridView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 329 + 0x9 bytes C#

System.Windows.Forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.LayoutEventArgs
args) + 0xa7 bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement
affectedElement, string affectedProperty) + 0x2e bytes

System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutTransaction.DoLayout(System.Windows.Forms.Layout.IArrangedElement
elementToLayout, System.Windows.Forms.Layout.IArrangedElement
elementCausingLayout, string property) + 0x2c bytes

System.Windows.Forms.dll!System.Windows.Forms.Control.OnResize(System.EventArgs
e = {System.EventArgs}) + 0x48 bytes
##### PowerGui.dll!PowerGui.Controls.ScrollView.OnResize(System.EventArgs
e = {System.EventArgs}) Line 605 + 0xb bytes C#
##### PowerGui.dll!PowerGui.Grid.GridView.OnResize(System.EventArgs e =
{System.EventArgs}) Line 297 + 0x9 bytes C#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top