Form has minimum size after restoring from minimize state

I Added ClientSize to Application Settings and DataBindings in Properties window, in order to save size of the form after it was closed. And that worked. But when I minimize form and then activate it back, it has minimum size . Is it a bug or I'm doing something wrong

  • Create New Project (WindowForm Application)
  • Open Properties Window form Form1
  • In Application Settings choose PropertyBinding
  • Add Binding for Location and ClientSize
  • Run
  • Maximize and then Restore

  • I found answer in this topic. So to save size and location without side effects , need to remove binding and save application settings by hand

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
       Properties.Settings.Default.Size = this.Size;
       Properties.Settings.Default.Location = this.Location;
       Properties.Settings.Default.Save();
    }
    
    private void Form1_Load(object sender, EventArgs e)
    {
       this.Size = Properties.Settings.Default.Size;
       this.Location = Properties.Settings.Default.Location;
    }
    

    表单,控件和子控件之间的停靠,填充和自动调整的不良组合可能会产生这种效果。

    链接地址: http://www.djcxy.com/p/4972.html

    上一篇: 扭曲的启动/停止工厂/协议减少嘈杂的日志消息

    下一篇: 从最小化状态恢复后,表格具有最小尺寸