Winform Designer border glitch in Windows 10

Viewed 674

i have a PictureBoxin a Form, Dock Property of PictureBox is set to Fill.
now to keep only borders of the form, i set ControlBox property to false and FormBorderStyle to SizableToolWindow. in Windows 7, it looks like below

enter image description here

but in Windows 10 same code looks like below enter image description here

can anybody explain why this white border appears at top?
i tried removing padding, margin & Rebuild Solution. none of that helped!

in windows 10 (Visual Studio 2015, Designer) form looks normal (without white top border)
.Net target framework version: v4.6

P.S: Image taken from here

Update: here's the Windows Form Designer generated code

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 Answers
Related