1

我遇到了一个问题。我有一个 .net 用户控件,上面有一个 splitcontainer 控件。.net 用户控件实际上托管在更旧的非 .net 遗留代码(可视对象)中的控件容器中。

我遇到的问题是,当将用户控件呈现给用户时,我在 splitcontainer 控件上触发了一个 splitter_moved 事件,但是我无法找到导致它实际移动的原因。在 VO 代码和 .net 内容之间的这种交互中,我遇到了许多奇怪的行为,但是我在 VO 容器控件中嵌入了其他几个用户控件,它们工作得很好。只是这个特殊的似乎有问题。

VO 容器控件都是相同的。嵌入其中的 .net 用户控件也是如此(它们都继承自同一个基类)。这就是为什么我很难理解为什么只有这个。

我想我真正想知道的是如何确定是什么导致拆分器在 splitcontainer 控件内移动。sender 和 eventargs 没有多大帮助,因为它们都只是引用 splitcontainer 控件(显然)。

帮助??

编辑: splitter_moved 事件处理程序中的调用堆栈如下:

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*)

编辑:好的,看起来 VO 容器控件上的 resize 事件在向用户显示时正在触发此事件,但在其他事件上未触发。

很纠结?!?

4

0 回答 0