C# 標準畫面分割元件[ SplitContainer ]

C# 標準畫面分割元件[ SplitContainer ]

C# 標準畫面分割元件[ SplitContainer ]

 


GITHUB: https://github.com/jash-git/CS_Spliter


藍色的地方就是利用開發工具進行元件新增和屬性設定所產生的程式。

Form1.Designer.cs

namespace CS_Spliter

{

    partial class Form1

    {

        /// <summary>

        /// 設計工具所需的變數。

        /// </summary>

        private System.ComponentModel.IContainer components = null;

 

        /// <summary>

        /// 清除任何使用中的資源。

        /// </summary>

        /// <param name=”disposing”>如果應該處置 Managed 資源則為 true,否則為 false。</param>

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }

 

        #region Windows Form 設計工具產生的程式碼

 

        /// <summary>

        /// 此為設計工具支援所需的方法 – 請勿使用程式碼編輯器

        /// 修改這個方法的內容。

        /// </summary>

        private void InitializeComponent()

        {

            this.splitContainer1 = new System.Windows.Forms.SplitContainer();

            this.button1 = new System.Windows.Forms.Button();

            this.button2 = new System.Windows.Forms.Button();

            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();

            this.splitContainer1.Panel1.SuspendLayout();

            this.splitContainer1.Panel2.SuspendLayout();

            this.splitContainer1.SuspendLayout();

            this.SuspendLayout();

            //

            // splitContainer1

            //

            this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;

            this.splitContainer1.Location = new System.Drawing.Point(0, 0);

            this.splitContainer1.Name = “splitContainer1”;

            //

            // splitContainer1.Panel1

            //

            this.splitContainer1.Panel1.Controls.Add(this.button1);

            //

            // splitContainer1.Panel2

            //

            this.splitContainer1.Panel2.Controls.Add(this.button2);

            this.splitContainer1.Size = new System.Drawing.Size(943, 543);

            this.splitContainer1.SplitterDistance = 247;

            this.splitContainer1.TabIndex = 0;

            //

            // button1

            //

            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));

            this.button1.Location = new System.Drawing.Point(155, 13);

            this.button1.Name = “button1”;

            this.button1.Size = new System.Drawing.Size(77, 30);

            this.button1.TabIndex = 0;

            this.button1.Text = “button1”;

            this.button1.UseVisualStyleBackColor = true;

            //

            // button2

            //

            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));

            this.button2.Location = new System.Drawing.Point(572, 13);

            this.button2.Name = “button2”;

            this.button2.Size = new System.Drawing.Size(106, 30);

            this.button2.TabIndex = 0;

            this.button2.Text = “button2”;

            this.button2.UseVisualStyleBackColor = true;

            //

            // Form1

            //

            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(943, 543);

            this.Controls.Add(this.splitContainer1);

            this.Name = “Form1”;

            this.Text = “Form1”;

            this.splitContainer1.Panel1.ResumeLayout(false);

            this.splitContainer1.Panel2.ResumeLayout(false);

            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();

            this.splitContainer1.ResumeLayout(false);

            this.ResumeLayout(false);

 

        }

 

        #endregion

 

        private System.Windows.Forms.SplitContainer splitContainer1;

        private System.Windows.Forms.Button button1;

        private System.Windows.Forms.Button button2;

    }

}

 

 

 

Form1.cs

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace CS_Spliter

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

    }

}

 

 

One thought on “C# 標準畫面分割元件[ SplitContainer ]

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *