/// <summary> /// Creates a rounded corner version of this widget /// </summary> /// <param name="drawBorder">set to true to draw a border</param> /// <param name="radius">radius of the rounded corner</param> protected void createRoundedControl(bool drawBorder, int radius = 8) { if (UIControl != null) { graphicsPath = RoundedCornerControl.Create(-1, -1, UIControl.Width - 1, UIControl.Height - 1, radius); if (graphicsPath != null) { var reg = new Region(graphicsPath); Windows.SetRegion(UIControl, reg); } } }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ACATMuteForm() { InitializeComponent(); _syncObj = new SyncLock(); ShowInTaskbar = false; if (!initialize()) { Log.Debug("Initialization error!"); } TopMost = true; RoundedCornerControl.CreateRoundedControl(Title); Windows.ShowWindowBorder(this, Common.AppPreferences.ScannerShowBorder); Windows.SetWindowPosition(this, Windows.WindowPosition.CenterScreen); _windowOverlapWatchdog = new WindowOverlapWatchdog(this); updateDateTime(); // Title isn't used on this form, but we keep it hidden instead of removing it // so we don't have to modify the IScreenInterface GetTitle() method Title.Hide(); // timer used for displaying the time timer.Start(); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; Load += MuteForm_Load; FormClosing += MuteForm_FormClosing; var actuator = ActuatorManager.Instance.GetActuator(typeof(KeyboardActuator)); if (actuator != null) { _keyboardActuator = actuator as KeyboardActuator; if (_keyboardActuator != null) { _keyboardActuator.EvtKeyDown += _keyboardActuator_EvtKeyDown; _keyboardActuator.EvtKeyUp += _keyboardActuator_EvtKeyUp; } } }
/// <summary> /// Paint handler. Round the corners if indicated so. /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void label_Paint(object sender, PaintEventArgs e) { if (isDisposing) { return; } try { if (DrawBorder && graphicsPath != null) { RoundedCornerControl.DrawBorder(graphicsPath, e, Color.Black); } } catch (Exception ex) { Log.Debug(ex.ToString()); } }
/// <summary> /// Creates a rounded corner version of this widget /// </summary> /// <param name="drawBorder">set to true to draw a border</param> /// <param name="radius">radius of the rounded corner</param> protected void createRoundedControl(bool drawBorder, int radius = 8) { if (UIControl != null) { #if SUPPORTS_BORDER if (drawBorder) { graphicsPath = RoundedCornerControl.Create(0, 0, UIControl.Width, UIControl.Height, 0, RoundedCornerControl.Corners.None); } else #endif { graphicsPath = RoundedCornerControl.Create(-1, -1, UIControl.Width - 1, UIControl.Height - 1, radius); } if (graphicsPath != null) { var reg = new Region(graphicsPath); Windows.SetRegion(UIControl, reg); } } }