开发者

Dock layout issues in WinForms + Devexpress

开发者 https://www.devze.com 2023-03-02 21:04 出处:网络
I have a WinForms dialog with a lot of DevExpress elements on it. The form has few SplitContainers and a TextEdit element and DevExpress XtraGrid controls.

I have a WinForms dialog with a lot of DevExpress elements on it. The form has few SplitContainers and a TextEdit element and DevExpress XtraGrid controls.

All of the controls are Dock=Fill or, in the case of the toolbars, Dock=Top.

When I resize the form it doesn't relayout all the elements, with these results: ht开发者_C百科tp://dl.dropbox.com/u/51344/winforms1.png.

It's not until I resize one of the SplitContainers manually that the form relayouts and everything is ok again ( http://dl.dropbox.com/u/51344/winforms2.png ).

I've tried to invoke all of the "PerformLayout, Refresh, Redraw" function I could find in the OnResize event of the form with no luck.

The problem results in even worse layout issues when running in RemoteDesktop.

Does anyone have an idea how to debug this issue?


Edit:

I hate to answer my own question, been battling with this on and off for few days. This ugly piece of code seems to do the trick. Resize the splitcontainers by one pixel to force a re-layout:

splitContainerControlQuery1.SplitterPosition += (splitContainerControlQuery1.SplitterPosition % 2 == 1) ? 1 : -1;

splitContainerControlQuery2.SplitterPosition += (splitContainerControlQuery2.SplitterPosition % 2 == 1) ? 1 : -1;
0

精彩评论

暂无评论...
验证码 换一张
取 消