/// <summary>Initializes the ok button.</summary> private void InitializeButtons() { var _buttonSpacing = 7; Size _buttonSize = new Size(75, 23); _okButton = new VisualButton { BackColor = SystemColors.Control, Text = @"OK", Size = _buttonSize, Location = new Point(_stackTextBox.Right - _buttonSize.Width, _stackTextBox.Bottom + 10), TabIndex = 0, Border = { Type = ShapeTypes.Rectangle } }; _okButton.Click += OkButton_Click; Controls.Add(_okButton); _saveButton = new VisualButton { BackColor = SystemColors.Control, Text = @"Save", Size = _buttonSize, Location = new Point(_okButton.Left - _buttonSpacing - _buttonSize.Width, _stackTextBox.Bottom + 10), TabIndex = 1, Border = { Type = ShapeTypes.Rectangle } }; _saveButton.Click += SaveButton_Click; Controls.Add(_saveButton); _copyButton = new VisualButton { BackColor = SystemColors.Control, Text = @"Copy", Size = _buttonSize, Location = new Point(_saveButton.Left - _buttonSpacing - _buttonSize.Width, _stackTextBox.Bottom + 10), TabIndex = 2, Border = { Type = ShapeTypes.Rectangle } }; _copyButton.Click += CopyButton_Click; Controls.Add(_copyButton); }
public static bool SetControlVisual(VisualButton button, PictureBox img, string tela, bool message = true) { if (GetPermission(tela)) { return(false); } img.Visible = true; button.Cursor = Cursors.No; if (message) { Alert.Message("Oppss", "Você não possui permissão para acessar essa área.", Alert.AlertType.warning); } return(true); }
/// <summary>Initialize the controls.</summary> private void InitializeControls() { label = new VisualLabel { Text = @"Enter your input: ", Size = new Size(90, 25), Location = new Point(BodyContainer.X, BodyContainer.Y) }; textBox = new VisualTextBox { Text = string.Empty, Watermark = { Visible = true, Text = "Enter your input..." }, Location = new Point(label.Right, BodyContainer.Y + 2), Size = new Size(200, 23) }; textBox.TextBoxWidth = textBox.GetTextBoxWidth(); textBox.TextChanged += TextBox_TextChanged; button = new VisualButton { Text = @"OK", Size = ButtonSize, Location = new Point(textBox.Right - ButtonSize.Width, textBox.Bottom + 5), Enabled = false }; button.Click += Button_Click; Controls.Add(label); Controls.Add(textBox); Controls.Add(button); }
/// <summary>Initializes a new instance of the <see cref="VisualForm" /> class.</summary> public VisualForm() { SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true); UpdateStyles(); _resizeCursors = new[] { Cursors.SizeNESW, Cursors.SizeWE, Cursors.SizeNWSE, Cursors.SizeWE, Cursors.SizeNS }; _resizedLocationsCommand = new Dictionary <int, int> { { FormConstants.HTTOP, FormConstants.WMSZ_TOP }, { FormConstants.HTTOPLEFT, FormConstants.WMSZ_TOPLEFT }, { FormConstants.HTTOPRIGHT, FormConstants.WMSZ_TOPRIGHT }, { FormConstants.HTLEFT, FormConstants.WMSZ_LEFT }, { FormConstants.HTRIGHT, FormConstants.WMSZ_RIGHT }, { FormConstants.HTBOTTOM, FormConstants.WMSZ_BOTTOM }, { FormConstants.HTBOTTOMLEFT, FormConstants.WMSZ_BOTTOMLEFT }, { FormConstants.HTBOTTOMRIGHT, FormConstants.WMSZ_BOTTOMRIGHT } }; _styleManager = new StyleManager(DefaultConstants.DefaultStyle); _border = new Border { Thickness = 3, Type = ShapeTypes.Rectangle }; _textPaddingTop = 10; _dropShadow = true; _headerMouseDown = false; FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.WindowsDefaultLocation; _windowTitleBarVisible = true; _magnetic = false; _magneticRadius = 100; Padding = new Padding(0, 0, 0, 0); Sizable = true; _titleAlignment = Alignment.TextAlignment.Center; TransparencyKey = Color.Fuchsia; _windowBarHeight = 30; _previousSize = Size.Empty; _moveable = true; _windowTitleBarRectangle = new Rectangle(0, 0, Width, _windowBarHeight); _vsImage = new VisualBitmap(Resources.VisualPlus, new Size(16, 16)) { Visible = true }; _vsImage.Point = new Point(5, (_windowBarHeight / 2) - (_vsImage.Size.Height / 2)); VisualControlBox = new VisualControlBox(); Controls.Add(VisualControlBox); VisualControlBox.Location = new Point(Width - VisualControlBox.Width - 16, _border.Thickness + 1); _contextMenuStrip = null; _windowContextMenuStripTitle = null; _defaultContextTitle = true; titleMaxLength = 50; TitleSuffix = @"..."; AcceptButton = new VisualButton(); // Fixes: The Form from hiding the TaskBar on maximized state. MaximizedBounds = Screen.FromHandle(Handle).WorkingArea; UpdateContextMenuStripTitle(); UpdateTheme(_styleManager.Theme); // This enables the form to trigger the MouseMove event even when mouse is over another control Application.AddMessageFilter(new MouseMessageFilter()); MouseMessageFilter.MouseMove += OnGlobalMouseMove; }
/// <summary>Initializes the message box buttons.</summary> private void InitializeMessageBoxButtons() { okButton = new VisualButton { Text = @"OK", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; okButton.Click += OkButton_Click; cancelButton = new VisualButton { Text = @"Cancel", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 1, Size = ButtonSize, Location = new Point(0, 0) }; cancelButton.Click += CancelButton_Click; abortButton = new VisualButton { Text = @"Abort", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; abortButton.Click += AbortButton_Click; noButton = new VisualButton { Text = @"No", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; noButton.Click += NoButton_Click; retryButton = new VisualButton { Text = @"Retry", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; retryButton.Click += RetryButton_Click; ignoreButton = new VisualButton { Text = @"Ignore", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; ignoreButton.Click += IgnoreButton_Click; yesButton = new VisualButton { Text = @"Yes", Anchor = AnchorStyles.Right & AnchorStyles.Bottom, TabIndex = 0, Size = ButtonSize, Location = new Point(0, 0) }; yesButton.Click += YesButton_Click; Controls.Add(okButton); Controls.Add(cancelButton); Controls.Add(abortButton); Controls.Add(noButton); Controls.Add(retryButton); Controls.Add(ignoreButton); Controls.Add(yesButton); }