我在表单中有PictureBox
,PictureBox
的Dock属性设置为Fill。
现在只保留表单的边框,我将ControlBox
属性设置为false,将FormBorderStyle
设置为SizableToolWindow
。
在Windows 7中,它看起来像下面的
任何人都可以解释为什么这个白色边框出现在顶部?我试图删除填充,边距和&重建解决方案。没有一个帮助!
在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);
}