C# 控件调整

            //最大化
            this.WindowState = FormWindowState.Maximized;
            //去掉标题栏
            this.FormBorderStyle = FormBorderStyle.None;

            //设置picbox
            this.pictureBox1.Width = this.Width;
            this.pictureBox1.Height = this.Height;
            this.pictureBox1.Left = 0;
            this.pictureBox1.Top = 0;
            this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
           | System.Windows.Forms.AnchorStyles.Left)
           | System.Windows.Forms.AnchorStyles.Right)));
            this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;//设置背景图像布局
            this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; //随着父级一起改变
            this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;//自适应
  //最大化
            this.WindowState = FormWindowState.Maximized;
            ////去掉标题栏
            //this.FormBorderStyle = FormBorderStyle.None;

            //设置picbox
            this.axWindowsMediaPlayer1.Width = this.Width;
            this.axWindowsMediaPlayer1.Height = this.Height;
            this.axWindowsMediaPlayer1.Left = 0;
            this.axWindowsMediaPlayer1.Top = 0;
            this.axWindowsMediaPlayer1.Dock = System.Windows.Forms.DockStyle.Fill; //随着父级一起改变

猜你喜欢

转载自www.cnblogs.com/enych/p/9987339.html