Beispiel #1
0
        protected void DrawCircledProgressBarString(ControlGraphicsInfoArgs info)
        {
            ProgressBarBaseViewInfo vi   = info.ViewInfo as ProgressBarBaseViewInfo;
            Brush             emptyBrush = vi.ProgressAppearance.GetForeBrush(info.Cache);
            Brush             fillBrush  = vi.ProgressAppearance.GetFore2Brush(info.Cache);
            GraphicsClipState clip       = info.Cache.ClipInfo.SaveAndSetClip(info.Bounds);

            try
            {
                if (vi.ProgressInfo.ProgressBounds.Width == 0)
                {
                    info.Cache.DrawString(vi.DisplayText, vi.PaintAppearance.Font, emptyBrush, vi.ContentRect, vi.StrFormat);
                    return;
                }
                info.Cache.ClipInfo.ExcludeClip(vi.ProgressInfo.ProgressBounds);
                DrawEllipseAroundTheText(info);
                info.Cache.DrawString(vi.DisplayText, vi.PaintAppearance.Font, emptyBrush, vi.ContentRect, vi.StrFormat);
                info.Cache.ClipInfo.SetClip(vi.ProgressInfo.ProgressBounds);
                DrawEllipseAroundTheText(info);
                info.Cache.DrawString(vi.DisplayText, vi.PaintAppearance.Font, emptyBrush, vi.ContentRect, vi.StrFormat);
            }
            finally
            {
                info.Cache.ClipInfo.RestoreClipRelease(clip);
            }
        }
Beispiel #2
0
        public void Draw(GraphicsCache cache)
        {
            GraphicsClipState clip = null;

            if (Bounds.Width < Width)
            {
                clip = cache.ClipInfo.SaveAndSetClip(bounds);
            }
            foreach (var button in ButtonsInfo)
            {
                DrawButton(cache, button);
            }
            if (clip != null)
            {
                cache.ClipInfo.RestoreClipRelease(clip);
            }
        }
        protected virtual void DrawImage(ControlGraphicsInfoArgs info)
        {
            DragImageEditViewInfo vi = info.ViewInfo as DragImageEditViewInfo;

            if (!(vi.EditValue is EditValueInstance))
            {
                vi.PaintAppearance.DrawString(info.Cache, "incorrect editvalue", new Rectangle(new Point(vi.Bounds.Location.X + 5, vi.Bounds.Location.Y), vi.Bounds.Size), vi.PaintAppearance.GetStringFormat(vi.DefaultTextOptions));
                return;
            }
            Size imageSize = Size.Empty;

            try { if (vi.Image != null)
                  {
                      imageSize = vi.Image.Size;
                  }
            }
            catch { }
            if (vi.Image == null || imageSize.IsEmpty)
            {
                string text = Localizer.Active.GetLocalizedString(StringId.DataEmpty);
                if (vi.Item.NullText != null && vi.Item.NullText.Length > 0)
                {
                    text = vi.Item.NullText;
                }
                vi.PaintAppearance.DrawString(info.Cache, text, vi.Bounds, vi.PaintAppearance.GetStringFormat(vi.DefaultTextOptions));
                return;
            }
            int       x, y;
            Rectangle r = vi.Bounds;

            x = -vi.HorizontOffset;
            y = -vi.VerticalOffset;
            GraphicsClipState state = info.Cache.ClipInfo.SaveAndSetClip(vi.ContentRect);

            try {
                info.Cache.Paint.DrawImage(info.Graphics, vi.Image,
                                           new Rectangle(r.X + x, r.Y + y, vi.Image.Width, vi.Image.Height),
                                           new Rectangle(0, 0, vi.Image.Width, vi.Image.Height), true);
            }
            finally {
                info.Cache.ClipInfo.RestoreClipRelease(state);
            }
        }