首页 新闻 赞助 找找看

C# WinForm Panel里叠放两个PictureBox Dock属性设置为Fill时,其中一个尺寸不会随着Panel尺寸而修改大小

0
悬赏园豆:15 [已关闭问题] 关闭于 2020-09-02 10:57

MainForm.designer.cs

partial class MainForm
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
            this.panel3 = new System.Windows.Forms.Panel();
            this.panel2 = new System.Windows.Forms.Panel();
            this.panoPanel = new System.Windows.Forms.Panel();
            this.picPanorama = new System.Windows.Forms.PictureBox();
            this.picPanoramaEenhance = new System.Windows.Forms.PictureBox();
            this.tableLayoutPanel1.SuspendLayout();
            this.panoPanel.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picPanorama)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.picPanoramaEenhance)).BeginInit();
            this.SuspendLayout();
            // 
            // tableLayoutPanel1
            // 
            this.tableLayoutPanel1.ColumnCount = 3;
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F));
            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 0);
            this.tableLayoutPanel1.Controls.Add(this.panel2, 2, 0);
            this.tableLayoutPanel1.Controls.Add(this.panoPanel, 1, 0);
            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
            this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
            this.tableLayoutPanel1.RowCount = 1;
            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tableLayoutPanel1.Size = new System.Drawing.Size(1200, 600);
            this.tableLayoutPanel1.TabIndex = 10;
            // 
            // panel3
            // 
            this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel3.Location = new System.Drawing.Point(0, 0);
            this.panel3.Margin = new System.Windows.Forms.Padding(0);
            this.panel3.Name = "panel3";
            this.panel3.Size = new System.Drawing.Size(240, 600);
            this.panel3.TabIndex = 12;
            // 
            // panel2
            // 
            this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panel2.Location = new System.Drawing.Point(960, 0);
            this.panel2.Margin = new System.Windows.Forms.Padding(0);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(240, 600);
            this.panel2.TabIndex = 11;
            // 
            // panoPanel
            // 
            this.panoPanel.Controls.Add(this.picPanorama);
            this.panoPanel.Controls.Add(this.picPanoramaEenhance);
            this.panoPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panoPanel.Location = new System.Drawing.Point(243, 3);
            this.panoPanel.Name = "panoPanel";
            this.panoPanel.Size = new System.Drawing.Size(714, 594);
            this.panoPanel.TabIndex = 0;
            // 
            // picPanorama
            // 
            this.picPanorama.BackColor = System.Drawing.Color.Transparent;
            this.picPanorama.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.picPanorama.Dock = System.Windows.Forms.DockStyle.Fill;
            this.picPanorama.Location = new System.Drawing.Point(0, 0);
            this.picPanorama.Margin = new System.Windows.Forms.Padding(0);
            this.picPanorama.Name = "picPanorama";
            this.picPanorama.Size = new System.Drawing.Size(714, 594);
            this.picPanorama.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.picPanorama.TabIndex = 9;
            this.picPanorama.TabStop = false;
            this.picPanorama.Visible = false;
            // 
            // picPanoramaEenhance
            // 
            this.picPanoramaEenhance.BackColor = System.Drawing.Color.Transparent;
            this.picPanoramaEenhance.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.picPanoramaEenhance.Dock = System.Windows.Forms.DockStyle.Fill;
            this.picPanoramaEenhance.Location = new System.Drawing.Point(0, 0);
            this.picPanoramaEenhance.Margin = new System.Windows.Forms.Padding(0);
            this.picPanoramaEenhance.Name = "picPanoramaEenhance";
            this.picPanoramaEenhance.Size = new System.Drawing.Size(714, 594);
            this.picPanoramaEenhance.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.picPanoramaEenhance.TabIndex = 22 ;
            this.picPanoramaEenhance.TabStop = false;
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(40)))), ((int)(((byte)(60)))));
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.ClientSize = new System.Drawing.Size(1200, 600);
            this.Controls.Add(this.tableLayoutPanel1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "MainForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Load += new System.EventHandler(this.MainForm_Load);
            this.SizeChanged += new System.EventHandler(this.MainForm_SizeChanged);
            this.tableLayoutPanel1.ResumeLayout(false);
            this.panoPanel.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.picPanorama)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.picPanoramaEenhance)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion
        private System.Windows.Forms.Panel panel2;
        public System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
        private System.Windows.Forms.Panel panel3;
        private System.Windows.Forms.Panel panoPanel;
        public System.Windows.Forms.PictureBox picPanorama;
        public System.Windows.Forms.PictureBox picPanoramaEenhance;
    }

问题

先有tableLayoutPanel1,然后分成一行三列,第一列装了panel3,啥也没有,第二列装了panoPanel,套着两个PictureBox:picPanoramapicPanoramaEenhance,然后当我改变tableLayoutPanel1各列的百分比时,picPanorama可以随着改变大小,但是picPanoramaEenhance的size就不会改变。我想问问原因。

picPanoramapicPanoramaEenhance是叠加在一起的,实际使用时会根据情况控制一个显示,另一个隐藏,两个不会同时显示。

echo_lovely的主页 echo_lovely | 小虾三级 | 园豆:1422
提问于:2020-09-02 09:41
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册