Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ContextMenuManager/BluePointLilac.Controls/SelectDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public string[] Items
{
cmbItems.Items.Clear();
cmbItems.Items.AddRange(value);
// Recalculate layout after items are added to accommodate auto-sized combobox
AdjustLayout();
}
}

Expand Down Expand Up @@ -124,8 +126,14 @@ private void InitializeComponents()
Controls.AddRange(new Control[] { cmbItems, btnOK, btnCancel });
var a = 20.DpiZoom();
cmbItems.Left = a;
cmbItems.Width = 85.DpiZoom();
cmbItems.Top = btnOK.Top = btnCancel.Top = a;
// Layout will be adjusted when items are added via the Items property setter
}

private void AdjustLayout()
{
var a = 20.DpiZoom();
// Position buttons after combobox (which may have auto-adjusted its width)
btnOK.Left = cmbItems.Right + a;
btnCancel.Left = btnOK.Right + a;
ClientSize = new Size(btnCancel.Right + a, btnCancel.Bottom + a);
Expand Down
Loading