在 DevExpress 停靠面板中調整內容大小 (Resizing contents inside DevExpress Docking Panels)


問題描述

在 DevExpress 停靠面板中調整內容大小 (Resizing contents inside DevExpress Docking Panels)

I am attempting to add three panels to a window using a Devexpress Docking manager and dockable panels. Here are the current results:

The three panels are placed and sized how I would like them however their contents will not correctly resize as I resize the window. This first image indicates this by the Picturebox that fails to fill the window. My current attempt to regulate this is: (Panel3 refers to a panel that contains pictureBox1. which in turn is contained by dp3.) 

  void dp3_SizeChanged(object sender, EventArgs e)
  {
     panel3.Size = panel3.Parent.Size;
     pictureBox1.Width = dp3.Width;
     pictureBox1.Height = dp3.Height;
  }

The Same is true for the Controls Window. I have controls that do not appear unless the window is grossly oversized.

The controls are contained in 4 seperate panels that are themselves contained in the dockable window.

How do I make things appear the correct size and location whendocking and resizing?

‑‑‑‑‑

參考解法

方法 1:

  

Go throught this DevX article ‑ Designing Resizable Windows Forms in   Visual Studio .NET‑2,   that i like most for understanding about layout in Winforms.

You should set the Anchor and Dock properties on the controls in the forms.

The Anchor property controls which edges of a control are "bound" or "tied" to the corresponding edges of its form. For example, if you set Anchor to Bottom, the distance between the control's bottom edge and the bottom of its parent will not change, so the control will move down as you resize the form. If you set Anchor to Top | Bottom, the control will resize vertically as you resize the form.

To make a control resize with the form, set the Anchor to all four sides, or set Dock to Fill.

You can set the control's Dock property to Fill.  This will cause the control to fill it's parent container.

You may still need to write some code to handle laying out the child controls.  You can either do this by handling the Resize event, or by using a container that supports resizing for you (such as FlowLayoutPanel or TableLayoutPanel).

Use your Control's Anchor property. You'll probably need to set it to all sides, Top, Bottom, Left, Right, if you want it to resize according to parent control in all four directions


If you want to Maintain the controls Aspect Ratio on Resize, You'll need to store off the aspect ratio somehow, whether it's something known to you at design time or if you just want to calculate it in the constructor of the form after InitializeComponent(). In your form's Resize event,

(by jth41Niranjan Singh)

參考文件

  1. Resizing contents inside DevExpress Docking Panels (CC BY‑SA 3.0/4.0)

#devexpress #dockpanel #docking #resize #C#






相關問題

修改 aspxgrid 中的列以顯示超鏈接和支持組 (Modify column in aspxgrid to display a hyper link and support group by)

沒有標誌的Javascript不區分大小寫的正則表達式 (Javascript case insensitive regex without flags)

MVC 4 - Gặp lỗi khi cố gắng thêm một báo cáo mới (MVC 4 - Getting error while trying to add a new report)

網格列包含 int64 值,但過濾器顯示字符串並且不起作用/ (Grid column contains int64 values but filter shows strings and doesn't work/)

我應該每年為保持 devexpress 應用程序的運行付費嗎 (Should I pay every year for keep devexpress app running)

Excel 和 Word DevExpress (Excel & Word DevExpress)

用於 ASP.NET Web 應用程序的 DevExpress 與 Telerik 網格 (DevExpress vs. Telerik grids for ASP.NET web applications)

添加控件會導致 Silverlight 掛起 (Adding controls causes silverlight to hang)

根據用戶控件的大小調整面板的大小 (Resizing a Panels based on the size of user control)

vs2010 asp.net設置斷點問題 (Problem in setting breakpoint in vs2010 asp.net)

單擊按鈕後行命令不觸發 (Rowcommand do not fire after clicking button)

DevExpress 11.1 在 IIS 7+ 中不起作用 (DevExpress 11.1 not functional in IIS 7+)







留言討論