Example #1
0
        /// <summary>
        ///     Override the parent, calculate the label number, than draw
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="rm"></param>
        public override void Draw(Graphics graphics, RenderMode rm)
        {
            graphics.SmoothingMode      = SmoothingMode.HighQuality;
            graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.PixelOffsetMode    = PixelOffsetMode.None;
            graphics.TextRenderingHint  = TextRenderingHint.AntiAliasGridFit;
            var text      = ((Surface)Parent).CountStepLabels(this).ToString();
            var rect      = new NativeRect(Left, Top, Width, Height).Normalize();
            var fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR);
            var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR);

            if (_drawAsRectangle)
            {
                RectangleContainer.DrawRectangle(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
            }
            else
            {
                EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
            }
            using (var fam = new FontFamily(FontFamily.GenericSansSerif.Name))
            {
                using (var font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel))
                {
                    TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);
                }
            }
        }
Example #2
0
        public override bool ClickableAt(int x, int y)
        {
            var rect      = new NativeRect(Left, Top, Width, Height).Normalize();
            var fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR);

            if (_drawAsRectangle)
            {
                return(RectangleContainer.RectangleClickableAt(rect, 0, fillColor, x, y));
            }
            return(EllipseContainer.EllipseClickableAt(rect, 0, fillColor, x, y));
        }