Minor behavior tweaks (preference)

fix initial box width to 4 with scrollbar, remove always-on-top for main
window
This commit is contained in:
Kurt 2018-01-22 21:58:53 -08:00
parent f073585592
commit d65393c6f6

View file

@ -13,7 +13,6 @@ namespace PKHeX.WinForms
{ {
InitializeComponent(); InitializeComponent();
// initialize boxes dynamically // initialize boxes dynamically
var sav = p.SAV; var sav = p.SAV;
@ -23,12 +22,10 @@ namespace PKHeX.WinForms
AllowDrop = true; AllowDrop = true;
AddEvents(); AddEvents();
CenterToParent(); CenterToParent();
p.ParentForm.TopMost = true;
FormClosing += (sender, e) => FormClosing += (sender, e) =>
{ {
foreach (var b in Boxes) foreach (var b in Boxes)
b.M.Boxes.Remove(b); b.M.Boxes.Remove(b);
p.ParentForm.TopMost = false;
}; };
} }
@ -65,10 +62,12 @@ namespace PKHeX.WinForms
int height = Math.Min(5, (int)Math.Ceiling(sqrt)); int height = Math.Min(5, (int)Math.Ceiling(sqrt));
int width = (int)Math.Ceiling((float)count / height); int width = (int)Math.Ceiling((float)count / height);
Debug.Assert(height * width >= count); Debug.Assert(height * width >= count);
width = Math.Min(4, width);
var padWidth = Boxes[0].Margin.Horizontal * 2 + 1; var padWidth = Boxes[0].Margin.Horizontal * 2 + 1;
Width = (Boxes[0].Width + padWidth) * width - padWidth/2 + 0x10;
var padHeight = Boxes[0].Margin.Vertical * 2 + 1; var padHeight = Boxes[0].Margin.Vertical * 2 + 1;
Width = (Boxes[0].Width + padWidth) * width - padWidth/2;
Height = (Boxes[0].Height + padHeight) * height - padHeight/2; Height = (Boxes[0].Height + padHeight) * height - padHeight/2;
} }