public AxButton() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); if (Palette == null) { _hoverStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _normalStyle.PropertyChanged += (propertyName) => this.Refresh(); _disabledStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; } }
public State(uint fileLine, string name, uint line, int process) { this.mName = name; this.mLine = line; this.mProcess = new int[1]{process}; this.mItemPen = new Pen(Color.Black, 1); this.mStyle = StateStyle.Box; this.mFileLine = fileLine; this.mPos = ItemPos.Top; }
public AxCaptionLabel() { _captionNormalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _captionNormalStyle.PropertyChanged += (propertyName) => this.Refresh(); Caption = string.Empty; CaptionFlatStyle = true; }
/// <summary> /// Конструктор /// </summary> public AxPanel() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); base.BorderStyle = BorderStyle.None; _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _normalStyle.PropertyChanged += (property) => this.Refresh(); }
public static void RepertoryImage(Graphics drawDestination, StateStyle style, MscStyle style2) { StringFormat itemStringFormat = new StringFormat(); RectangleF itemBox = new RectangleF(15, 30, 50, 20); itemStringFormat.Alignment = StringAlignment.Center; itemStringFormat.LineAlignment = StringAlignment.Center; drawDestination.DrawLine(Pens.DarkGray,40,10,40,70); if (style2 == MscStyle.SDL){ if (style == StateStyle.Box){ PointF[] statePolygon = new PointF[6]; statePolygon[0] = new PointF(5,40); statePolygon[1] = new PointF(15,30); statePolygon[2] = new PointF(65,30); statePolygon[3] = new PointF(75,40); statePolygon[4] = new PointF(65,50); statePolygon[5] = new PointF(15,50); drawDestination.FillPolygon(Brushes.White,statePolygon); drawDestination.DrawString("State",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); drawDestination.DrawPolygon(Pens.Black,statePolygon); } else if(style == StateStyle.Bracket){ drawDestination.FillRectangle(Brushes.White,itemBox); drawDestination.DrawString("{State}",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } } else if(style2 == MscStyle.UML2){ if (style == StateStyle.Box){ drawDestination.FillRectangle(Brushes.White,itemBox); drawDestination.FillEllipse(Brushes.White,5,30,20,20); drawDestination.FillEllipse(Brushes.White,55,30,20,20); drawDestination.DrawLine(Pens.Black,15,30,65,30); drawDestination.DrawLine(Pens.Black,15,50,65,50); drawDestination.DrawArc(Pens.Black,5,30,20,20,90,180); drawDestination.DrawArc(Pens.Black,55,30,20,20,270,180); drawDestination.DrawString("State",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } else if(style == StateStyle.Bracket){ drawDestination.FillRectangle(Brushes.White,itemBox); drawDestination.DrawString("{State}",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } } itemStringFormat.Dispose(); }
public AxRadioButton() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _normalStyle.PropertyChanged += (propertyName) => { Refresh(); }; //BorderColor = Color.Black; ThumbColor = Color.Gray; ThumbRadius = 10; Spacing = 5; FillBackground = true; }
public AxCaptionControlBase() { this.Width = 150; this.Height = 60; Caption = string.Empty; DrawCaptionBackground = false; _captionNormalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _captionNormalStyle.PropertyChanged += (propertyName) => this.Refresh(); _innerControl = new T(); _innerControl.Parent = this; ResizeInnerControl(); }
public AxGrid() { base.BorderStyle = BorderStyle.FixedSingle; AllowUserToAddRows = false; EditMode = DataGridViewEditMode.EditProgrammatically; this.SelectionMode = DataGridViewSelectionMode.FullRowSelect; MultiSelect = false; _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _normalStyle.PropertyChanged += (propertyName) => { Refresh(); }; //OnColumnAdded += ( s, e ) => { // e.Column.HeaderCell = new AxHeaderCell(); //}; }
public AxControlPalette() { _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _hoverStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _disabledStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; }
public AxForm() { FormBorderStyle = FormBorderStyle.None; Padding = new Padding(Padding.Left, _headerHeight, Padding.Right, Padding.Bottom); _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _normalStyle.PropertyChanged += (propertyName) => Refresh(); _normalHeaderStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _normalHeaderStyle.PropertyChanged += (propertyName) => Refresh(); _normalButtonStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _normalButtonStyle.PropertyChanged += (propertyName) => Refresh(); _hoverButtonStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Gray }; _hoverButtonStyle.PropertyChanged += (propertyName) => Refresh(); }
public AxToggleBox() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); _toggleButtonStyle = new StateStyle() { BackColor = Color.White, BorderColor = Color.Black, ForeColor = Color.Empty }; ToggleCheckedBackColor = Color.White; ToggleCheckedHoverBackColor = Color.White; ToggleUncheckedBackColor = Color.White; ToggleUncheckedHoverBackColor = Color.White; //ToggleButtonBackColor = Color.White; ToggleButtonHoverBackColor = Color.White; //ToggleBorderColor = Color.Black; ToggleBorderHoverColor = Color.Black; ForeHoverColor = Color.Black; ForeChechedColor = Color.Black; ForeUnchechedColor = Color.Black; ToggleCheckedText = "on"; ToggleFlatStyle = true; LineHalfLength = 4; ToggleShowIcon = false; _toggleRect = new Rectangle(ClientRectangle.X, ClientRectangle.Y, (ClientRectangle.Height - 1) * 2, ClientRectangle.Height - 1); }
public InterpretResult AddState(uint fileLine, string[] processName, uint line, string name,StateStyle style, ItemPos pos ) { Process process; int[] proc = new int[processName.Length]; IEnumerator enumerator = processes.GetEnumerator(); for (int j=0;j<processName.Length;j++){ proc[j]=-1; enumerator.Reset(); for(int i=0;i<processes.Count;i++){ enumerator.MoveNext(); process = (Process) enumerator.Current; if(process.ProcessName == processName[j]){ proc[j]=i; break; } } } for (int j=0;j<processName.Length;j++){ if (proc[j]==-1) return InterpretResult.InstanceNotFound; } items.Add(new State(fileLine, name, line, proc,style,pos)); mLines = Math.Max(mLines, line); return InterpretResult.Ok; }
public InterpretResult AddState(uint fileLine, string processName, uint line, string name,StateStyle style,ItemPos pos ) { Process process; IEnumerator enumerator = processes.GetEnumerator(); bool instanceFound = false; for(int i=0;i<processes.Count;i++){ enumerator.MoveNext(); process = (Process) enumerator.Current; if(process.ProcessName == processName){ items.Add(new State(fileLine, name, line, i, style, pos)); instanceFound = true; break; } } if (instanceFound == false) return InterpretResult.InstanceNotFound; mLines = Math.Max(mLines, line); return InterpretResult.Ok; }
public InterpretResult AddState(uint fileLine, uint line, string name,StateStyle style ) { int[] proc = new int[processes.Count]; for (int j=0;j<processes.Count;j++){ proc[j]=j; } items.Add(new State(fileLine, name, line,proc,style)); mLines = Math.Max(mLines, line); return InterpretResult.Ok; }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; switch (CaptionTextAlignment) { case HorizontalAlignment.Center: sf.Alignment = StringAlignment.Center; break; case HorizontalAlignment.Left: sf.Alignment = StringAlignment.Near; break; case HorizontalAlignment.Right: sf.Alignment = StringAlignment.Far; break; } StateStyle style = NormalStyle; if (!Error) { if (_isSelected) { style = HoverStyle; } } else { style = ErrorStyle; } if (!Enabled) { style = DisabledStyle; } if (Parent != null) { g.FillRectangle(new SolidBrush(Parent.BackColor), ClientRectangle); } g.SmoothingMode = SmoothingMode.HighQuality; Rectangle textRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - BorderThickness, ClientRectangle.Height - BorderThickness); Rectangle captionRect = new Rectangle(); GraphicsPath textPath = ExtendedForms.RoundedRect(textRect, BorderRadius); GraphicsPath captionPath = null; if (_captionSize.Width > 0) { switch (CaptionPosition) { case ContentPosition.Left: captionRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y, _captionSize.Width + 2 * BorderPadding, Height - BorderThickness); textRect = new Rectangle( captionRect.Width, ClientRectangle.Y, ClientRectangle.Width - BorderThickness - captionRect.Width, ClientRectangle.Height - BorderThickness); if (CaptionShowBorder) { textPath = ExtendedForms.RoundedRightRect(textRect, BorderRadius); captionPath = ExtendedForms.RoundedLeftRect(captionRect, BorderRadius); } else { textPath = ExtendedForms.RoundedRect(textRect, BorderRadius); } break; case ContentPosition.Right: captionRect = new Rectangle( ClientRectangle.Right - (_captionSize.Width + 2 * BorderPadding) - BorderThickness, ClientRectangle.Y, _captionSize.Width + 2 * BorderPadding, Height - BorderThickness); textRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - BorderThickness - captionRect.Width, ClientRectangle.Height - BorderThickness); if (CaptionShowBorder) { textPath = ExtendedForms.RoundedLeftRect(textRect, BorderRadius); captionPath = ExtendedForms.RoundedRightRect(captionRect, BorderRadius); } else { textPath = ExtendedForms.RoundedRect(textRect, BorderRadius); } break; case ContentPosition.Top: captionRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - BorderThickness, ClientRectangle.Y + _captionSize.Height + BorderPadding); textRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y + captionRect.Height, ClientRectangle.Width - BorderThickness, ClientRectangle.Height - captionRect.Height - BorderThickness); if (CaptionShowBorder) { textPath = ExtendedForms.RoundedBottomRect(textRect, BorderRadius); captionPath = ExtendedForms.RoundedTopRect(captionRect, BorderRadius); } else { textPath = ExtendedForms.RoundedRect(textRect, BorderRadius); } break; case ContentPosition.Bottom: captionRect = new Rectangle( ClientRectangle.X, ClientRectangle.Height - (_captionSize.Height + BorderPadding) - 1, ClientRectangle.Width - BorderThickness, _captionSize.Height + BorderPadding); textRect = new Rectangle( ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - BorderThickness, ClientRectangle.Height - captionRect.Height - BorderThickness); if (CaptionShowBorder) { textPath = ExtendedForms.RoundedTopRect(textRect, BorderRadius); captionPath = ExtendedForms.RoundedBottomRect(captionRect, BorderRadius); } else { textPath = ExtendedForms.RoundedRect(textRect, BorderRadius); } break; } } g.FillPath(new SolidBrush(style.BackColor), textPath); if (_captionSize.Width > 0 && captionPath != null && CaptionShowBorder) { if (CaptionFlatStyle) { g.FillPath(new SolidBrush(CaptionNormalStyle.BackColor), captionPath); } else { g.FillPath(new LinearGradientBrush(captionRect, CaptionNormalStyle.BackColor.Lighten(20), CaptionNormalStyle.BackColor, 90), captionPath); switch (CaptionPosition) { case ContentPosition.Left: g.DrawLine(new Pen(CaptionNormalStyle.BackColor.Lighten(40)), captionRect.X + BorderRadius, captionRect.Top + 1, captionRect.Right, captionRect.Top + 1); break; case ContentPosition.Right: g.DrawLine(new Pen(CaptionNormalStyle.BackColor.Lighten(40)), captionRect.X, captionRect.Top + 1, captionRect.Right - BorderRadius, captionRect.Top + 1); break; } } } if (_captionSize.Width > 0 && captionPath != null) { g.DrawPath(new Pen(style.BorderColor, BorderThickness), captionPath); } g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; Rectangle captionTempRect = new Rectangle(captionRect.Location, captionRect.Size); if (CaptionPosition == ContentPosition.Left || CaptionPosition == ContentPosition.Right) { captionTempRect.Inflate(0, -BorderPadding / 2 - 2 * BorderThickness); } else { captionTempRect.Inflate(-BorderPadding / 2 - 2 * BorderThickness, 0); if (CaptionImage != null) { captionTempRect.Offset(CaptionImageSize.Width + BorderPadding - 1, 0); } } g.DrawString(Caption, this.Font, new SolidBrush(CaptionNormalStyle.ForeColor), captionTempRect, sf); if (CaptionImage != null) { int imageY = captionTempRect.Y + (captionTempRect.Bottom - captionTempRect.Y) / 2 - CaptionImageSize.Height / 2; g.DrawImage(CaptionImage, captionTempRect.X - (_captionSize.Height + BorderPadding), imageY, CaptionImageSize.Width, CaptionImageSize.Height); } if (_captionSize.Width > 0 && CaptionShowBorder) { switch (CaptionPosition) { case ContentPosition.Left: g.DrawLine(new Pen(style.BorderColor, BorderThickness), captionRect.Right, 0, captionRect.Right, Height); break; case ContentPosition.Right: g.DrawLine(new Pen(style.BorderColor, BorderThickness), captionRect.Left, 0, captionRect.Left, Height); break; } } g.DrawPath(new Pen(style.BorderColor, BorderThickness), textPath); }
public AxBorderTextBox() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); InitializeComponent(); //_captionPosition = ContentPosition.Left; CaptionImageSize = new Size(16, 16); CaptionTextAlignment = HorizontalAlignment.Center; _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _normalStyle.PropertyChanged += (propertyName) => { NormalStyleChanged(); Refresh(); }; _hoverStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _errorStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _disabledStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _captionNormalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _captionNormalStyle.PropertyChanged += (propertyName) => { Refresh(); }; Error = false; BorderThickness = 1; Height = textBox1.Size.Height + BorderPadding * 2; textBox1.Resize += (s, e) => AxBorderTextBox_Resize(s, e); textBox1.GotFocus += (source, e) => { if (string.IsNullOrEmpty(Text)) { WindowsNative.SendMessage(textBox1.Handle, WindowsNative.EM_SETCUEBANNER, 1, ""); } }; textBox1.LostFocus += (source, e) => { if (string.IsNullOrEmpty(Text) && !string.IsNullOrEmpty(Hint)) { WindowsNative.SendMessage(textBox1.Handle, WindowsNative.EM_SETCUEBANNER, 1, Hint); } }; if (!Error) { textBox1.ForeColor = NormalStyle.ForeColor; textBox1.BackColor = NormalStyle.BackColor; } else { textBox1.BackColor = ErrorStyle.BackColor; textBox1.ForeColor = ErrorStyle.ForeColor; } _captionSize = GetCaptionSize(); }
public AxNumericUpDown() { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true); Width = 60; //Height = 20; _value = 0; _textBox1.Text = _value.ToString(); _textBox1.KeyDown += textBox1_KeyDown; _textBox1.BorderStyle = BorderStyle.None; //_textBox.BackColor = Color.Red; _textBox1.Font = this.Font; _textBox1.KeyPress += textBox1_KeyPress; _textBox1.Parent = this; _buttonDown.Width = _buttonUp.Width = 18; _buttonUp.Text = "+"; _buttonUp.Click += ButtonUp_Click; _buttonUp.MouseDown += ButtonUp_MouseDown; _buttonUp.MouseUp += ButtonUp_MouseUp; _buttonDown.Top = 0; _buttonDown.Text = "-"; _buttonDown.MouseDown += ButtonDown_MouseDown; _buttonDown.MouseUp += ButtonDown_MouseUp; _buttonDown.Click += ButtonDown_Click; _buttonDown.FigureType = _buttonUp.FigureType = FigureType.Rounded; _buttonDown.DrawPushAnimation = _buttonUp.DrawPushAnimation = true; //_buttonDown.FlashAlpha = _buttonUp.FlashAlpha = 40; _buttonDown.Parent = _buttonUp.Parent = this; _normalStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; _hoverStyle = new StateStyle() { BackColor = Color.White, ForeColor = Color.Black, BorderColor = Color.Black }; this.Invalidate(); this.OnResize(null); _timer = new Timer() { Interval = 400 }; _timer.Tick += timer_Tick; MouseEnter += AxNumericUpDown_MouseEnter; MouseLeave += AxNumericUpDown_MouseLeave; _textBox1.MouseEnter += textBox1_MouseEnter; _textBox1.MouseLeave += textBox1_MouseLeave; _textBox1.Enter += textBox1_Enter; _textBox1.Leave += textBox1_Leave; _buttonUp.MouseEnter += axButton_MouseEnter; _buttonUp.MouseLeave += axButton_MouseLeave; _buttonDown.MouseEnter += axButton_MouseEnter; _buttonDown.MouseLeave += axButton_MouseLeave; }
public State(uint fileLine, string name, uint line, int[] process, StateStyle style, ItemPos pos) { this.mName = name; this.mLine = line; this.mProcess = process; this.mItemPen = new Pen(Color.Black, 1); this.mStyle = style; this.mFileLine = fileLine; this.mPos = pos; }