protected override void Update_Bounds() { int cnt = GroupManager.Items.Count + 1; GHBaseStyle style = GHManager.Settings.Style.Launcher; bool isVertical = GHManager.IsVertical; // 縦向きまたは横向きのサイズを設定 int w = isVertical ? style.Width : style.Height; int h = style.ItemSize * cnt + style.ItemSpace * (cnt - 1) + (isVertical ? style.WindowPadding.HSize : style.WindowPadding.HSize); int x = Left; int y = Top; if (!isVertical) { int t = w; w = h; h = t; } // 表示位置修正 if (GHManager.IsVertical && (Bottom <= 0 || GHManager.ScreenSize.Bottom <= y)) { y = (GHManager.ScreenSize.Height - Height) / 2; } else if (!GHManager.IsVertical && (Right <= 0 || GHManager.ScreenSize.Right <= x)) { x = (GHManager.ScreenSize.Width - Width) / 2; } Bounds = new Rectangle(x, y, w, h); }
public GHBaseStyle(GHBaseStyle baseStyle) { ItemSizeHeight = baseStyle.ItemSizeHeight; ItemSizeWidth = baseStyle.ItemSizeWidth; ItemSpace = baseStyle.ItemSpace; WindowPadding = new GHPadding(baseStyle.WindowPadding); ItemPadding = new GHPadding(baseStyle.ItemPadding); }
protected override void Update_ItemPos() { GHBaseStyle style = GHManager.Settings.Style.Launcher; Rectangle rect = new Rectangle(style.WindowPadding.Left, style.WindowPadding.Top, style.ItemSize, style.ItemSize); // マイセットアイコンの位置・サイズを設定 MysetIcon.SetRect(ref rect); // グループの位置・サイズを設定 GroupManager.SetRectGroups(ref rect); }
// 余白・位置調整のボタン private void Button_Click(object sender, EventArgs e) { string buttonName = Regex.Replace(Regex.Replace( ((Button)sender).Name, "^Button", string.Empty), "Padding", string.Empty).ToLower(); int flag = 0; if (buttonName.IndexOf("launcher") != -1) { flag += 1; } else if (buttonName.IndexOf("myset") != -1) { flag += 2; } else if (buttonName.IndexOf("itemlist") != -1) { flag += 4; } if (buttonName.IndexOf("icon") != -1) { flag += 8; } else if (buttonName.IndexOf("text") != -1) { flag += 16; } else { flag += 32; } GHBaseStyle style = (flag & 1) == 1 ? GHManager.TempSettings.Style.Launcher : (flag & 2) == 2 ? GHManager.TempSettings.Style.MysetList : (flag & 4) == 4 ? GHManager.TempSettings.Style.ItemList : null; GHPadding padding = (flag & 8) == 8 ? style?.ItemPadding : (flag & 16) == 16 ? GHManager.TempSettings.Style.ItemList.TextPadding : style?.WindowPadding; if (padding == null) { return; } GHPadding temp = new GHPadding { Left = padding.Left, Top = padding.Top, Right = padding.Right, Bottom = padding.Bottom }; using (Config_Sub f = new Config_Sub(ref padding)) { f.Text = Regex.Replace(((Button)sender).Text, "\\(&[A-Z]?\\)", string.Empty); if (f.ShowDialog() != DialogResult.OK) { padding.Left = temp.Left; padding.Top = temp.Top; padding.Right = temp.Right; padding.Bottom = temp.Bottom; } } }