public virtual void Deserialize(ElementPropertyBag epb) { Id = epb.Id; if (!String.IsNullOrEmpty(epb.Json)) { Json = JsonConvert.DeserializeObject <Dictionary <string, string> >(epb.Json); } DisplayRectangle = epb.DisplayRectangle; BorderPen.Dispose(); BorderPen = new Pen(epb.BorderPenColor, epb.BorderPenWidth); FillBrush.Dispose(); FillBrush = new SolidBrush(epb.FillBrushColor); Text = epb.Text; TextColor = epb.TextColor; // If missing (backwards compatibility) middle-center align. TextAlign = epb.TextAlign == 0 ? ContentAlignment.MiddleCenter : epb.TextAlign; TextFont.Dispose(); FontStyle fontStyle = (epb.TextFontUnderline ? FontStyle.Underline : FontStyle.Regular) | (epb.TextFontItalic ? FontStyle.Italic : FontStyle.Regular) | (epb.TextFontStrikeout ? FontStyle.Strikeout : FontStyle.Regular); TextFont = new Font(epb.TextFontFamily, epb.TextFontSize, fontStyle); HasCornerAnchors = epb.HasCornerAnchors; HasCenterAnchors = epb.HasCenterAnchors; HasLeftRightAnchors = epb.HasLeftRightAnchors; HasTopBottomAnchors = epb.HasTopBottomAnchors; HasCornerConnections = epb.HasCornerConnections; HasCenterConnections = epb.HasCenterConnections; HasLeftRightConnections = epb.HasLeftRightConnections; HasTopBottomConnections = epb.HasTopBottomConnections; }
public virtual void Deserialize(ElementPropertyBag epb) { Id = epb.Id; DisplayRectangle = epb.DisplayRectangle; BorderPen.Dispose(); BorderPen = new Pen(epb.BorderPenColor, epb.BorderPenWidth); FillBrush.Dispose(); FillBrush = new SolidBrush(epb.FillBrushColor); Text = epb.Text; TextColor = epb.TextColor; TextFont.Dispose(); FontStyle fontStyle = (epb.TextFontUnderline ? FontStyle.Underline : FontStyle.Regular) | (epb.TextFontItalic ? FontStyle.Italic : FontStyle.Regular) | (epb.TextFontStrikeout ? FontStyle.Strikeout : FontStyle.Regular); TextFont = new Font(epb.TextFontFamily, epb.TextFontSize, fontStyle); HasCornerAnchors = epb.HasCornerAnchors; HasCenterAnchors = epb.HasCenterAnchors; HasLeftRightAnchors = epb.HasLeftRightAnchors; HasTopBottomAnchors = epb.HasTopBottomAnchors; HasCornerConnections = epb.HasCornerConnections; HasCenterConnections = epb.HasCenterConnections; HasLeftRightConnections = epb.HasLeftRightConnections; HasTopBottomConnections = epb.HasTopBottomConnections; }
void IDisposable.Dispose() { DataGridCache.Dispose(); BorderPen.Dispose(); BgBrush.Dispose(); BasePen.Dispose(); BgBrush2.Dispose(); BasePen2.Dispose(); dataIem.Clear(); dataIem2.Clear(); }
public void Draw(Graphics aGfx, int lX, int lY, bool abBorder, bool abHighLight, int alRotation) { Matrix Mtx = new Matrix(); float fX = (float)lX; float fY = (float)lY; //Stupid bad fix. if (alRotation == 1) { fY += 0.95f; } if (alRotation == 3) { fX += 0.95f; } PointF vRotPoint = new PointF((float)(lX + mTileImage.Width / 2), (float)(lY + mTileImage.Height / 2)); Mtx.RotateAt(alRotation * 90, vRotPoint, MatrixOrder.Append); aGfx.Transform = Mtx; aGfx.DrawImage(mTileImage, fX, fY, mTileImage.Width, mTileImage.Height); Mtx.Reset(); aGfx.Transform = Mtx; if (abBorder) { Pen BorderPen; if (abHighLight) { BorderPen = new Pen(Color.FromArgb(100, 255, 100)); } else { BorderPen = new Pen(Color.FromArgb(255, 0, 255)); } if (abHighLight) { aGfx.DrawRectangle(BorderPen, lX, lY, mTileImage.Width - 1, mTileImage.Height - 1); } else { aGfx.DrawRectangle(BorderPen, lX, lY, mTileImage.Width, mTileImage.Height); } BorderPen.Dispose(); } }
public virtual void Dispose(bool disposing) { if (!disposed) { disposed = true; if (disposing) { BorderPen.Dispose(); FillBrush.Dispose(); background?.Dispose(); selectionPen.Dispose(); altSelectionPen.Dispose(); anchorPen.Dispose(); anchorBrush.Dispose(); TextFont.Dispose(); connectionPointPen.Dispose(); } } }
protected override void OnPaint(PaintEventArgs e) { Graphics G = e.Graphics; base.OnPaint(e); Rectangle r2 = new Rectangle(0, 0, Width - 1, 25); Rectangle r3 = new Rectangle(0, 0, Width - 1, 25); Rectangle r4 = new Rectangle(2, 0, Width - 1, 13); Rectangle ItemBounds = new Rectangle(); SolidBrush TextBrush = new SolidBrush(Color.Empty); SolidBrush TabBrush = new SolidBrush(Color.DimGray); G.Clear(Color.FromArgb(32, 32, 32)); G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(28, 28, 28))), new Rectangle(1, 1, Width - 3, Height - 3)); G.FillRectangle(new SolidBrush(Color.FromArgb(35, 35, 35)), r2); for (int TabItemIndex = 0; TabItemIndex < this.TabCount; TabItemIndex++) { ItemBounds = this.GetTabRect(TabItemIndex); if (Convert.ToBoolean(TabItemIndex & 1)) { TabBrush.Color = Color.Transparent; } else { TabBrush.Color = Color.Transparent; } G.FillRectangle(TabBrush, ItemBounds); Pen BorderPen = null; if (TabItemIndex == SelectedIndex) { BorderPen = new Pen(Color.Transparent, 1F); LinearGradientBrush dgb = new LinearGradientBrush(new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 3, ItemBounds.Width - 8, ItemBounds.Height - 6), Color.FromArgb(50, 50, 50), Color.FromArgb(42, 42, 42), 90); LinearGradientBrush gloss = new LinearGradientBrush(new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 3, ItemBounds.Width - 8, (int)(ItemBounds.Height / 2.0 - 5)), Color.FromArgb(80, Color.White), Color.FromArgb(20, Color.White), 90); G.FillRectangle(dgb, new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 3, ItemBounds.Width - 8, ItemBounds.Height - 6)); G.FillRectangle(gloss, new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 3, ItemBounds.Width - 8, (int)(ItemBounds.Height / 2.0 - 4))); G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(10, 10, 10))), new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 3, ItemBounds.Width - 8, ItemBounds.Height - 6)); G.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(100, 50, 50, 50))), new Rectangle(ItemBounds.Location.X + 4, ItemBounds.Location.Y + 4, ItemBounds.Width - 10, ItemBounds.Height - 8)); Rectangle r1 = new Rectangle(1, 1, Width - 1, 3); } else { BorderPen = new Pen(Color.Transparent, 1F); } G.DrawRectangle(BorderPen, new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 1, ItemBounds.Width - 8, ItemBounds.Height - 4)); BorderPen.Dispose(); StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; if (this.SelectedIndex == TabItemIndex) { TextBrush.Color = TabTextColor; } else { TextBrush.Color = Color.DimGray; } G.DrawString(this.TabPages[TabItemIndex].Text, this.Font, TextBrush, (RectangleF)(this.GetTabRect(TabItemIndex)), sf); try { this.TabPages[TabItemIndex].BackColor = Color.FromArgb(40, 40, 40); } catch { } } try { foreach (TabPage tabpg in this.TabPages) { tabpg.BorderStyle = BorderStyle.None; } } catch { } G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(10, 10, 10))), 2, 24, Width - 2, 24); G.DrawRectangle((new Pen(new SolidBrush(Color.Black))), new Rectangle(1, 1, Width - 3, Height - 3)); G.DrawRectangle((new Pen(new SolidBrush(Color.FromArgb(70, 70, 70)))), new Rectangle(0, 0, Width - 1, Height - 1)); G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), 0, 0, Width, 0); G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), 0, 0, 0, Height); G.DrawLine(new Pen(new SolidBrush(Color.FromArgb(45, 45, 45))), Width - 1, 0, Width - 1, Height); //G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(31, 31, 31))), 2, 2, Width - 3, 2) }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Rectangle r2 = new Rectangle(2, 0, Width, 25); Rectangle r3 = new Rectangle(2, 0, Width, 25); e.Graphics.Clear(Color.FromArgb(18, 18, 18)); Rectangle ItemBounds = default(Rectangle); SolidBrush TextBrush = new SolidBrush(Color.Empty); SolidBrush TabBrush = new SolidBrush(Color.FromArgb(15, 15, 15)); DrawGradientBrush2 = new LinearGradientBrush(r3, Color.FromArgb(25, 25, 25), Color.FromArgb(42, 42, 42), LinearGradientMode.ForwardDiagonal); e.Graphics.FillRectangle(DrawGradientBrush2, r2); for (int TabItemIndex = 0; TabItemIndex <= this.TabCount - 1; TabItemIndex++) { ItemBounds = this.GetTabRect(TabItemIndex); if (Convert.ToBoolean(TabItemIndex & 1)) { TabBrush.Color = Color.Transparent; } else { TabBrush.Color = Color.Transparent; } e.Graphics.FillRectangle(TabBrush, ItemBounds); Pen BorderPen = default(Pen); if (TabItemIndex == SelectedIndex) { BorderPen = new Pen(Color.Black, 1); } else { BorderPen = new Pen(Color.Black, 1); } Rectangle rPen = new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 0, ItemBounds.Width - 4, ItemBounds.Height - 2); e.Graphics.DrawRectangle(BorderPen, rPen); DrawGradientBrushPen = new LinearGradientBrush(rPen, Color.FromArgb(5, 5, 5), Color.FromArgb(24, 24, 24), LinearGradientMode.Vertical); e.Graphics.FillRectangle(DrawGradientBrushPen, rPen); BorderPen.Dispose(); StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; if (this.SelectedIndex == TabItemIndex) { TextBrush.Color = TabTextColor; } else { TextBrush.Color = Color.Gray; } e.Graphics.DrawString(this.TabPages[TabItemIndex].Text, this.Font, TextBrush, new RectangleF(this.GetTabRect(TabItemIndex).Location.X + 3, GetTabRect(TabItemIndex).Location.Y + 0, GetTabRect(TabItemIndex).Width - 4, GetTabRect(TabItemIndex).Height - 2), sf); try { this.TabPages[TabItemIndex].BackColor = Color.FromArgb(15, 15, 15); } catch { } } try { foreach (TabPage Page in this.TabPages) { Page.BorderStyle = BorderStyle.None; } } catch { } e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(255, Color.Black))), 2, 0, Width - 3, Height - 3); e.Graphics.DrawRectangle(new Pen(new SolidBrush(LighterBlack)), new Rectangle(3, 24, Width - 5, Height - 28)); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(255, Color.Black))), 2, 23, Width - 2, 23); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(35, 35, 35))), 0, 0, 1, 1); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(70, 70, 70))), 2, Height - 2, Width + 1, Height - 2); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.Clear(Color.FromArgb(18, 18, 18)); Rectangle ItemBounds = new Rectangle(); SolidBrush TextBrush = new SolidBrush(Color.Empty); SolidBrush TabBrush = new SolidBrush(Color.Black); for (int TabItemIndex = 0; TabItemIndex < this.TabCount; TabItemIndex++) { ItemBounds = this.GetTabRect(TabItemIndex); e.Graphics.FillRectangle(TabBrush, ItemBounds); Pen BorderPen = null; if (TabItemIndex == SelectedIndex) { BorderPen = new Pen(Color.Black, 1F); } else { BorderPen = new Pen(Color.Black, 1F); } Rectangle rPen = new Rectangle(ItemBounds.Location.X + 3, ItemBounds.Location.Y + 0, ItemBounds.Width - 4, ItemBounds.Height - 2); e.Graphics.DrawRectangle(BorderPen, rPen); //Dim B1 As Brush = New HatchBrush(HatchStyle.Percent10, Color.FromArgb(35, 35, 35), Color.FromArgb(10, 10, 10)) Brush B1 = new LinearGradientBrush(rPen, Color.FromArgb(15, 15, 15), Color.FromArgb(24, 24, 24), LinearGradientMode.Vertical); e.Graphics.FillRectangle(B1, rPen); BorderPen.Dispose(); StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; if (this.SelectedIndex == TabItemIndex) { TextBrush.Color = TabTextColor; } else { TextBrush.Color = Color.Gray; } e.Graphics.DrawString(this.TabPages[TabItemIndex].Text, this.Font, TextBrush, (RectangleF)(this.GetTabRect(TabItemIndex)), sf); try { this.TabPages[TabItemIndex].BackColor = Color.FromArgb(15, 15, 15); } catch { } } try { foreach (TabPage Page in this.TabPages) { Page.BorderStyle = BorderStyle.None; } } catch { } e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(255, Color.Black))), 2, 0, Width - 3, Height - 3); e.Graphics.DrawRectangle(new Pen(new SolidBrush(LighterBlack)), new Rectangle(3, 2, Width - 5, Height - 7)); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(255, Color.Black))), 2, 2, Width - 2, 2); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(35, 35, 35))), 0, 0, 1, 1); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.FromArgb(70, 70, 70))), 2, Height - 2, Width + 1, Height - 2); }