1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-08 02:34:06 +02:00

Fix button positioning in FormMessage

This commit is contained in:
chylex 2017-03-23 20:34:56 +01:00
parent f1db1ba708
commit 29a02db07d
3 changed files with 14 additions and 6 deletions

View File

@ -33,7 +33,7 @@ private void InitializeComponent() {
this.panelActions.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelActions.Location = new System.Drawing.Point(0, 84);
this.panelActions.Name = "panelActions";
this.panelActions.Size = new System.Drawing.Size(233, 49);
this.panelActions.Size = new System.Drawing.Size(98, 49);
this.panelActions.TabIndex = 0;
//
// labelMessage
@ -66,6 +66,7 @@ private void InitializeComponent() {
this.Name = "FormMessage";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.SizeChanged += new System.EventHandler(this.FormMessage_SizeChanged);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -19,7 +19,7 @@ public FormMessage(string caption, string text, MessageBoxIcon messageIcon){
this.prevLabelWidth = labelMessage.Width;
this.prevLabelHeight = labelMessage.Height;
this.minFormWidth = 18;
this.minFormWidth = 20;
switch(messageIcon){
case MessageBoxIcon.Information:
@ -50,11 +50,18 @@ public FormMessage(string caption, string text, MessageBoxIcon messageIcon){
this.labelMessage.Text = text;
}
private void FormMessage_SizeChanged(object sender, EventArgs e){
for(int index = 0; index < buttonCount; index++){
Control control = panelActions.Controls[index];
control.Location = new Point(Width-110-index*96, control.Location.Y);
}
}
public Button AddButton(string title, DialogResult result = DialogResult.OK){
Button button = new Button{
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
Anchor = AnchorStyles.Bottom,
Font = SystemFonts.MessageBoxFont,
Location = new Point(Width-112-buttonCount*96, 12),
Location = new Point(Width-110-buttonCount*96, 12),
Size = new Size(88, 26),
TabIndex = buttonCount,
Text = title,
@ -99,7 +106,7 @@ private void labelMessage_SizeChanged(object sender, EventArgs e){
prevLabelHeight -= 8;
}
realFormWidth = Width-(icon == null ? 32+35+(labelMessage.Margin.Left-labelMessage.Margin.Right) : 0)+labelMessage.Margin.Right+labelMessage.Width-prevLabelWidth;
realFormWidth = Width-(icon == null ? 67+(labelMessage.Margin.Left-labelMessage.Margin.Right) : 46)+labelMessage.Margin.Right+labelMessage.Width-prevLabelWidth;
Width = Math.Max(realFormWidth, minFormWidth);
Height += labelMessage.Height-prevLabelHeight;

View File

@ -54,7 +54,7 @@ public void HandleException(string caption, string message, bool canIgnore, Exce
Anchor = AnchorStyles.Bottom | AnchorStyles.Left,
Enabled = loggedSuccessfully,
Font = SystemFonts.MessageBoxFont,
Location = new Point(12, 12),
Location = new Point(6, 12),
Margin = new Padding(0, 0, 48, 0),
Size = new Size(88, 26),
Text = "Show Error Log",