public override void Paint(StiComponent component, StiPaintEventArgs e) { DrawingContext dc = e.Context as DrawingContext; RectangleD rectD = component.GetPaintRectangle(true, false); Rect rect = new Rect(rectD.Left, rectD.Top, rectD.Width, rectD.Height); if (rect.Width > 0 && rect.Height > 0) { MyCustomComponent customComponent = component as MyCustomComponent; #region Fill rectangle PaintBackground(customComponent, dc, rect); #endregion #region Markers if (customComponent.HighlightState == StiHighlightState.Hide && customComponent.Border.Side != StiBorderSides.All) { PaintMarkers(customComponent, dc, rect); } #endregion //Own drawing #region Border base.PaintBorder(customComponent, dc, rect, true, true); #endregion } PaintEvents(component, dc, rect); PaintConditions(component, dc, rect); PaintInteraction(component, dc); }
/// <summary> /// Paints a component. /// </summary> /// <param name="e">Argument for painting.</param> public override void Paint(StiPaintEventArgs e) { InvokePainting(this, e); if (!e.Cancel) { Graphics g = e.Graphics; RectangleD rect = GetPaintRectangle(); if (rect.Width > 0 && rect.Height > 0 && (e.ClipRectangle.IsEmpty || rect.IntersectsWith(e.ClipRectangle))) { #region Fill rectangle if (this.Brush is StiSolidBrush && ((StiSolidBrush)this.Brush).Color == Color.Transparent && Report.Info.FillComponent && IsDesigning) { Color color = Color.FromArgb(150, Color.GreenYellow); StiDrawing.FillRectangle(g, color, rect.Left, rect.Top, rect.Width, rect.Height); } else { StiDrawing.FillRectangle(g, Brush, rect); } #endregion //****************** //Draw control //****************** #region Markers PaintMarkers(g, rect); #endregion #region Border if (this.HighlightState == StiHighlightState.Hide) { Border.Draw(g, rect, Page.Zoom); } #endregion PaintEvents(e.Graphics, rect); } } e.Cancel = false; InvokePainted(this, e); }
public override void Paint(StiComponent component, StiPaintEventArgs e) { Graphics g = e.Graphics; RectangleD rect = component.GetPaintRectangle(); RectangleF rectF = rect.ToRectangleF(); g.DrawRectangle(Pens.Gray, rectF.Left, rectF.Top, rectF.Width, rectF.Height); MyCustomComponentWithExpression customComponent = component as MyCustomComponentWithExpression; using (StringFormat stringFormat = new StringFormat()) using (Font font = new Font("Arial", (float)(15 * component.Page.Zoom))) using (Brush brush = new SolidBrush(Color.Gray)) { stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; string value = component.IsDesigning ? customComponent.CustomCode.Value : customComponent.CustomCodeValue; StiTextDrawing.DrawString(g, value, font, brush, new RectangleD(rect.Left, rect.Top, rect.Width, rect.Height), stringFormat); } }
public override void Paint(StiComponent component, StiPaintEventArgs e) { Graphics g = e.Graphics; RectangleD rect = component.GetPaintRectangle(); if (rect.Width > 0 && rect.Height > 0 && (e.ClipRectangle.IsEmpty || rect.IntersectsWith(e.ClipRectangle))) { MyCustomComponent customComponent = component as MyCustomComponent; #region Fill rectangle PaintBackground(customComponent, g, rect); #endregion #region Markers if (customComponent.HighlightState == StiHighlightState.Hide && customComponent.Border.Side != StiBorderSides.All) { PaintMarkers(customComponent, g, rect); } #endregion RectangleD borderRect = rect; //Own drawing #region Border base.PaintBorder(customComponent, g, borderRect); #endregion } PaintEvents(component, e.Graphics, rect); PaintConditions(component, e.Graphics, rect); PaintQuickButtons(component, e.Graphics); PaintInteraction(component, e.Graphics); }