private Button buildBtn(IWindowEntry win, int setElementWidth, int setElementMargin) { // http://www.bubuko.com/infodetail-2282119.html // https://blog.csdn.net/honantic/article/details/48781543 //https://bbs.csdn.net/topics/392094061 //https://social.msdn.microsoft.com/Forums/vstudio/en-US/99856840-f8ef-4547-9150-c4c46ec2f3df/need-dashed-focus-box?forum=wpf Button btn = new Button(); btn.Width = btn.Height = setElementWidth; btn.Margin = new Thickness(setElementMargin, 0, setElementMargin, 0); var backImg = CoreSearchResult.LoadIcon(win); if (backImg == null && !string.IsNullOrEmpty(win.ProcessName)) { btn.Background = GoToWindow.Plugins.Core.Utils.IconLoader.DrawText(win.ProcessName, null, System.Drawing.Color.White, System.Drawing.Color.Transparent); } else { btn.Background = new ImageBrush(backImg); } btn.BorderBrush = null; btn.GotFocus += Btn_GotFocus; btn.FocusVisualStyle = null; btn.PreviewMouseDown += Btn_PreviewMouseDown; btn.Tag = win; SetHotkey(win); return(btn); }
private Button buildBtn(IWindowEntry win, int setElementWidth, int setElementMargin) { // http://www.bubuko.com/infodetail-2282119.html // https://blog.csdn.net/honantic/article/details/48781543 //https://bbs.csdn.net/topics/392094061 //https://social.msdn.microsoft.com/Forums/vstudio/en-US/99856840-f8ef-4547-9150-c4c46ec2f3df/need-dashed-focus-box?forum=wpf Button btn = new Button(); btn.Width = btn.Height = setElementWidth; btn.Margin = new Thickness(setElementMargin, 0, setElementMargin, 0); btn.Background = new ImageBrush(CoreSearchResult.LoadIcon(win)); btn.BorderBrush = null; btn.GotFocus += Btn_GotFocus; btn.FocusVisualStyle = (Style)FindResource("newFocusStyle"); btn.PreviewMouseDown += Btn_PreviewMouseDown; btn.Tag = win; //win.onHotkeyUpdate = OnHotkeyUpdateEvent; SetHotkey(win); return(btn); }