1

I've got an issue that's doing my head in. I have a .net usercontrol with a splitcontainer control on it. The .net usercontrol is actually hosted in a control container in much older non .net legacy code (Visual Objects).

The problem I'm having is that I'm getting a splitter_moved event firing on the splitcontainer control when the usercontrol is presented to the user, but I'm at a loss to find what's causing it to actually move. I've come across a number of curious behaviours with this interaction between the VO code and .net stuff, but I've got several other usercontrols embedded in VO container controls that work just fine. It's just this particular one that seems to be having a problem.

The VO container controls are all identical. So are the .net usercontrols that are embedded in them (they all inherit from the same base class). This is why I'm having so much difficulty in understanding why it's just this one.

I guess what I really want to know is how to determine what caused the splitter to move inside the splitcontainer control. The sender and eventargs aren't much help, because they all just refer to the splitcontainer control (obviously).

Help??

EDIT: The call stack from within the splitter_moved event handler is as follows:

00000072    0.26412687  Method: Void splitContainerMain_SplitterMoved(System.Object, System.Windows.Forms.SplitterEventArgs)    
    00000073    0.26649699  Method: Void OnSplitterMoved(System.Windows.Forms.SplitterEventArgs)    
    00000074    0.26906940  Method: Void set_SplitterDistance(Int32)    
    00000075    0.27223459  Method: Void ApplySplitterDistance()    
    00000076    0.27425244  Method: Void ResizeSplitContainer()     
    00000077    0.27621472  Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs)     
    00000078    0.27813032  Method: Void PerformLayout(System.Windows.Forms.LayoutEventArgs)    
    00000079    0.28007442  Method: Void System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement, System.String)    
    00000080    0.28211826  Method: Void DoLayout(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.Layout.IArrangedElement, System.String)    
    00000081    0.28451827  Method: Void OnResize(System.EventArgs)     
    00000082    0.28713536  Method: Void OnSizeChanged(System.EventArgs)    
    00000083    0.28970191  Method: Void UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)     
    00000084    0.29425862  Method: Void UpdateBounds()     
    00000085    0.29450893  Method: Void WmWindowPosChanged(System.Windows.Forms.Message ByRef)     
    00000086    0.29477015  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000087    0.29508862  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000088    0.29539761  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000089    0.29568058  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000090    0.29596806  Method: Void OnMessage(System.Windows.Forms.Message ByRef)  
    00000091    0.29627341  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000092    0.29659048  Method: IntPtr Callback(IntPtr, Int32, IntPtr, IntPtr)  
    00000093    0.29688439  Method: Boolean SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32)     
    00000094    0.29714754  Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)    
    00000095    0.29755905  Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)    
    00000096    0.29781467  Method: Void System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle, System.Windows.Forms.BoundsSpecified)     
    00000097    0.29814151  Method: Void xLayoutDockedControl(System.Windows.Forms.Layout.IArrangedElement, System.Drawing.Rectangle, Boolean, System.Drawing.Size ByRef, System.Drawing.Rectangle ByRef)   
    00000098    0.29844967  Method: System.Drawing.Size LayoutDockedControls(System.Windows.Forms.Layout.IArrangedElement, Boolean)     
    00000099    0.29872790  Method: Boolean xLayout(System.Windows.Forms.Layout.IArrangedElement, Boolean, System.Drawing.Size ByRef)   
    00000100    0.29901370  Method: Boolean LayoutCore(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.LayoutEventArgs)  
    00000101    0.29931039  Method: Boolean Layout(System.Object, System.Windows.Forms.LayoutEventArgs)     
    00000102    0.29965651  Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs)     
    00000103    0.29993618  Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs)     
    00000104    0.30027559  Method: Void OnLayout(System.Windows.Forms.LayoutEventArgs)     
    00000105    0.30064937  Method: Void PerformLayout(System.Windows.Forms.LayoutEventArgs)    
    00000106    0.30087790  Method: Void System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement, System.String)    
    00000107    0.30116984  Method: Void DoLayout(System.Windows.Forms.Layout.IArrangedElement, System.Windows.Forms.Layout.IArrangedElement, System.String)    
    00000108    0.30157101  Method: Void OnResize(System.EventArgs)     
    00000109    0.30196688  Method: Void OnResize(System.EventArgs)     
    00000110    0.30212274  Method: Void OnSizeChanged(System.EventArgs)    
    00000111    0.30244765  Method: Void UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)     
    00000112    0.30264741  Method: Void UpdateBounds()     
    00000113    0.30294549  Method: Void WmWindowPosChanged(System.Windows.Forms.Message ByRef)     
    00000114    0.30337656  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000115    0.30359614  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000116    0.30389002  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000117    0.30451524  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000118    0.30456889  Method: Void OnMessage(System.Windows.Forms.Message ByRef)  
    00000119    0.30483985  Method: Void WndProc(System.Windows.Forms.Message ByRef)    
    00000120    0.30507788  Method: IntPtr Callback(IntPtr, Int32, IntPtr, IntPtr)  
    00000121    0.30540919  Method: Boolean SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32)     
    00000122    0.30566931  Method: Void SetBoundsCore(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)    
    00000123    0.30598581  Method: Void SetBounds(Int32, Int32, Int32, Int32, System.Windows.Forms.BoundsSpecified)    
    00000124    0.30637357  Method: Void set_Height(Int32)  
    00000125    0.30679765  Method: Void ContainerCtrl.ResizeForm(ContainerCtrl*, WTL.CRect)    
    00000126    0.30718428  Method: Int32 ContainerCtrl.OnSize(ContainerCtrl*, UInt32, UInt32, Int32, Int32*)   
    00000127    0.30755892  Method: Int32 ContainerCtrl.ProcessWindowMessage(ContainerCtrl*, HWND__*, UInt32, UInt32, Int32, Int32*, UInt32)    
    00000128    0.30793831  Method: Int32 ATL.CDialogImplBaseT<ATL::CWindow>.DialogProc(HWND__*, UInt32, UInt32, Int32)     
    00000129    0.30838418  Method: Int32 ATL.CAxDialogImpl<ContainerCtrl,ATL::CWindow>.DialogProc(HWND__*, UInt32, UInt32, Int32)  
    00000130    0.30881271  Method: Int32 SetWindowPos(HWND__*, HWND__*, Int32, Int32, Int32, Int32, UInt32)    
    00000131    0.30922171  Method: Int32 ATL.CComControlBase.IOleInPlaceObject_SetObjectRects(ATL.CComControlBase*, tagRECT*, tagRECT*)    
    00000132    0.30961114  Method: Int32 ATL.IOleInPlaceObjectWindowlessImpl<ContainerCtrl>.SetObjectRects(ATL.IOleInPlaceObjectWindowlessImpl<ContainerCtrl>*, tagRECT*, tagRECT*)

Edit: Ok, it looks like the resize event on the VO container control is firing on this one when it's shown to the user, but not on the others.

Confusing much?!?

MrBonk
  • 11
  • 3
  • Is the SplitterDistance property being modified anywhere in your code? – HasaniH Sep 10 '12 at 00:30
  • The SplitterDistance is being set prior to the splitter_moved event being attached to the control. However, even if I comment out the code that sets the SplitterDistance change, the splitter_moved event still fires. – MrBonk Sep 10 '12 at 00:32

0 Answers0