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);
        }
Beispiel #2
0
        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);
                    }
        }
Beispiel #3
0
        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);
        }