Develop and Download Open Source Software

Browse Subversion Repository

Contents of /NeoFT/Controls/AutoLayoutPanel.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download)
Tue Mar 25 12:06:05 2008 UTC (16 years ago) by c477
File size: 2275 byte(s)


1 using System;
2 using System.Drawing;
3 using System.Windows.Forms;
4 using System.ComponentModel;
5 using System.Collections;
6 using System.Diagnostics;
7
8 namespace nft.controls
9 {
10
11 /// <summary>
12 /// AutoLayoutPanel の概要の説明です。
13 /// </summary>
14 public class AutoLayoutPanel : Panel, ILayoutManagedControl
15 {
16
17 public AutoLayoutPanel(System.ComponentModel.IContainer container) {
18 ///
19 /// Windows.Forms クラス作成デザイナ サポートに必要です。
20 ///
21 container.Add(this);
22 //InitializeComponent();
23
24 }
25
26 public AutoLayoutPanel() {
27 //InitializeComponent();
28
29 }
30
31 protected override void OnSizeChanged(EventArgs e) {
32 Size sz = base.ClientSize;
33 bool wide = sz.Width>sz.Height;
34 DockStyle ds;
35 if(wide){
36 ds = DockStyle.Left;
37 sz.Width /= base.Controls.Count;
38 }else{
39 ds = DockStyle.Top;
40 sz.Height /= base.Controls.Count;
41 }
42 foreach(Control c in base.Controls){
43 c.Size = sz;
44 c.Dock = ds;
45 }
46 base.OnSizeChanged (e);
47 }
48
49 protected virtual void DoLayout( int width, int height ){
50
51 }
52
53 #region コンポーネント デザイナで生成されたコード
54 /*
55 /// <summary>
56 /// 必要なデザイナ変数です。
57 /// </summary>
58 private System.ComponentModel.Container components = null;
59
60 /// <summary>
61 /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
62 /// コード エディタで変更しないでください。
63 /// </summary>
64 private void InitializeComponent()
65 {
66 components = new System.ComponentModel.Container();
67 }
68
69 /// <summary>
70 /// 使用されているリソースに後処理を実行します。
71 /// </summary>
72 protected override void Dispose( bool disposing ) {
73 if( disposing ) {
74 if(components != null) {
75 components.Dispose();
76 }
77 }
78 base.Dispose( disposing );
79 }
80 */
81 #endregion
82
83 #region ILayoutManagedControl メンバ
84
85 public virtual Size LayoutHorizontal(int maxHeight) {
86 SuspendLayout();
87 // TODO: AutoLayoutPanel.LayoutHorizontal 実装を追加します。
88 ResumeLayout();
89 return Size;
90 }
91
92 public virtual Size LayoutVirtical(int maxWidth) {
93 SuspendLayout();
94 // TODO: AutoLayoutPanel.LayoutVirtical 実装を追加します。
95 ResumeLayout();
96 return Size;
97 }
98
99 #endregion
100 }
101 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26