diff --git a/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.Designer.cs b/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.Designer.cs index 47b1ec8..07b963a 100644 --- a/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.Designer.cs +++ b/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.Designer.cs @@ -44,7 +44,6 @@ private void InitializeComponent() // // btn_Affirm // - this.btn_Affirm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btn_Affirm.AutoSize = true; this.btn_Affirm.Location = new System.Drawing.Point(93, 33); this.btn_Affirm.Name = "btn_Affirm"; @@ -56,7 +55,6 @@ private void InitializeComponent() // // btn_Deny // - this.btn_Deny.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btn_Deny.AutoSize = true; this.btn_Deny.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btn_Deny.Location = new System.Drawing.Point(12, 33); @@ -72,8 +70,6 @@ private void InitializeComponent() this.AcceptButton = this.btn_Affirm; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.CancelButton = this.btn_Deny; this.ClientSize = new System.Drawing.Size(181, 66); this.Controls.Add(this.btn_Deny); diff --git a/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.cs b/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.cs index e582cd4..591638d 100644 --- a/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.cs +++ b/CoordinateConverter/DCS/Tools/FormAskBinaryQuestion.cs @@ -60,11 +60,28 @@ public FormAskBinaryQuestion(string question, string yesButtonText = "Yes", stri btn_Affirm.Text = yesButtonText; btn_Deny.Text = noButtonText; - // Form will auto size to fit everything. + Rectangle screenRectangle = RectangleToScreen(ClientRectangle); + int titleHeight = screenRectangle.Top - Top; + int borderWidth = screenRectangle.Left - Left; - // Adjust positions, button X positions will be set by means of the anchor - btn_Affirm.Location = new Point(btn_Affirm.Location.X, lbl_QuestionText.Bottom + 4); - btn_Deny.Location = new Point(btn_Deny.Location.X, lbl_QuestionText.Bottom + 4); + const int MARGIN = 13; + + lbl_QuestionText.Location = new Point(MARGIN, MARGIN); + + int widthRequiredForButtons = btn_Deny.Width + MARGIN + btn_Affirm.Width; + int width = Math.Max(widthRequiredForButtons, lbl_QuestionText.Width) + (MARGIN * 2) + (borderWidth * 2); + int height = borderWidth + titleHeight + lbl_QuestionText.Top + lbl_QuestionText.Height + MARGIN + Math.Max(btn_Affirm.Height, btn_Deny.Height) + MARGIN; + + Size = new Size(width, height); + + // Left button + btn_Deny.Location = new Point(MARGIN, lbl_QuestionText.Location.Y + lbl_QuestionText.Height + MARGIN); + // btn_Deny.Location = new Point(btn_Deny.Location.X, lbl_QuestionText.Location.Y + lbl_QuestionText.Height + MARGIN); + // Right button + btn_Affirm.Location = new Point(btn_Deny.Location.X + btn_Deny.Width + MARGIN, btn_Deny.Location.Y); + // btn_Affirm.Location = new Point(btn_Affirm.Location.X, btn_Deny.Location.Y); + + } private void Btn_Deny_Click(object sender, EventArgs e) diff --git a/CoordinateConverter/MainForm.cs b/CoordinateConverter/MainForm.cs index 0f2c778..670ca19 100644 --- a/CoordinateConverter/MainForm.cs +++ b/CoordinateConverter/MainForm.cs @@ -19,7 +19,7 @@ namespace CoordinateConverter /// public partial class MainForm : Form { - private readonly GitHub.Version VERSION = new GitHub.Version(0, 5, 0); + private readonly GitHub.Version VERSION = new GitHub.Version(0, 5, 1); private readonly Color ERROR_COLOR = Color.Pink; private readonly Color DCS_ERROR_COLOR = Color.Yellow;