Windows 10中的Winform Designer边界故障

时间:2017-05-23 16:55:31

标签: c# .net winforms windows-forms-designer designer

我在表单中有PictureBoxPictureBox的Dock属性设置为Fill。
现在只保留表单的边框,我将ControlBox属性设置为false,将FormBorderStyle设置为SizableToolWindow。 在Windows 7中,它看起来像下面的

enter image description here

但在Windows 10中,相同的代码如下所示 enter image description here

任何人都可以解释为什么这个白色边框出现在顶部?我试图删除填充,边距和&重建解决方案。没有一个帮助!

在Windows 10(Visual Studio 2015,Designer)表单看起来正常(没有白色顶部边框)
.Net目标框架版本:v4.6

P.S:图片取自here

更新:这是Windows窗体设计器生成的代码

private void InitializeComponent()
{
    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Preview_Image));
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
    this.SuspendLayout();
    // 
    // pictureBox1
    // 
    this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
    this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
    this.pictureBox1.Location = new System.Drawing.Point(0, 0);
    this.pictureBox1.Name = "pictureBox1";
    this.pictureBox1.Size = new System.Drawing.Size(284, 261);
    this.pictureBox1.TabIndex = 0;
    this.pictureBox1.TabStop = false;
    // 
    // Preview_Image
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(284, 261);
    this.ControlBox = false;
    this.Controls.Add(this.pictureBox1);
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
    this.Name = "Preview_Image";
    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
    this.ResumeLayout(false);

}

0 个答案:

没有答案