// show settings dialog private void mni_Settings_Click(object sender, EventArgs e) { Frm_Settings dia_settings = new Frm_Settings(); DialogResult res = dia_settings.ShowDialog(); if (res == DialogResult.OK) { // set new settings values Reference.maxSize = dia_settings.maxSize; Reference.minSize = dia_settings.minSize; Reference.minArea = dia_settings.minArea; Reference.minWidth = dia_settings.minWidth; Reference.Ratio = dia_settings.ratio; Reference.SplitTries = dia_settings.tries; // refresh panel size PuzzlePiece pp = (PuzzlePiece)pan_PuzzlePanel.Controls[0]; pan_PuzzlePanel.Size = new Size(Reference.currentImage.Width * Reference.Ratio, Reference.currentImage.Height * Reference.Ratio); pp.Location = new Point((pp.Image.Width * Reference.Ratio - pp.Image.Width) / 2, (pp.Image.Height * Reference.Ratio - pp.Image.Height) / 2); adjustSize(); this.Refresh(); } }