Example #1
0
        void DrawLine(ControlGraphicsInfoArgs info)
        {
            TextEditViewInfo vi = info.ViewInfo as TextEditViewInfo;
            Rectangle        r  = vi.ClientRect;

            r.Height = 3;

            r.Y = vi.ClientRect.Height - r.Height;
            Brush brush = Brushes.Green;

            switch (this.GetPasswordStrength(vi.EditValue, vi.ClientRect))
            {
            case 0:
                if (vi.EditValue == null || vi.EditValue.ToString().Length == 0)
                {
                    r.Width = 0;
                }
                else
                {
                    r.Width = r.Width / 3;
                }
                brush = Brushes.Red;
                break;

            case 1:
                r.Width = r.Width * 2 / 3;
                brush   = Brushes.Orange;
                break;
            }
            info.Paint.FillRectangle(info.Graphics, brush, r);
        }
Example #2
0
 public override void Paint(ControlGraphicsInfoArgs info)
 {
     ViewInfo.Calculate(info.Cache);
     ViewInfo.TopLine = 0;
     for (int i = 0; i < ViewInfo.Count; ++i)
     {
         FilterLabelInfoTextViewInfo textViewInfo = (FilterLabelInfoTextViewInfo)ViewInfo[i];
         NodeEditableElement         nodeElement  = textViewInfo.InfoText.Tag as NodeEditableElement;
         ElementType elementType             = null == nodeElement ? ElementType.None : nodeElement.ElementType;
         CustomDrawFilterLabelEventArgs args =
             new CustomDrawFilterLabelEventArgs(elementType, textViewInfo.InfoText.Text, info.Cache, textViewInfo.TextElement.Bounds);
         args.Font         = info.ViewInfo.Appearance.GetFont();
         args.ForeColor    = textViewInfo.InfoText.Color;
         args.StringFormat = info.ViewInfo.Appearance.GetStringFormat();
         MyFilterControl filterControl = OwnerControl as MyFilterControl;
         if (filterControl != null)
         {
             filterControl.RaiseCustomDrawFilterLabel(args);
         }
         if (!args.Handled)
         {
             ViewInfo[i].Draw(info.Cache, args.Font, args.ForeColor, args.StringFormat);
         }
     }
 }
        void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            GridGroupRowInfo info      = (GridGroupRowInfo)e.Info;
            string           groupText = info.GroupText;

            info.GroupText = "[#image]";

            //default drawing
            _GridPainter.ElementsPainter.GroupRow.DrawGroupRowBackground(e.Info);
            ObjectPainter.DrawObject(e.Cache, _GridPainter.ElementsPainter.GroupRow, e.Info);
            info.GroupText = groupText;

            //draw caption
            Rectangle bounds = info.ButtonBounds;

            bounds.X     = bounds.Right + 20;
            bounds.Width = info.Bounds.Right - bounds.Right - progressBarWidth;
            bounds.Offset(progressBarWidth, 0);
            info.CreateEditorInfo(bounds, info.Appearance.GetForeColor());
            ObjectPainter.DrawObject(e.Cache, info.CreatePainter(), info.EditorInfo);

            //draw progressbar
            bounds       = info.ButtonBounds;
            bounds.X     = bounds.Right + 5;
            bounds.Width = progressBarWidth;
            bounds.Inflate(0, 2);
            ProgressBarBaseViewInfo vi   = CreateViewInfo(bounds, (float)0.50, e.Graphics);
            ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(vi, e.Cache, bounds);

            _PBPainter.Draw(args);
            e.Handled = true;
        }
Example #4
0
        static void DrawSelection(ControlGraphicsInfoArgs args)
        {
            var info = (ItemSelectorViewInfo)args.ViewInfo;

            var selectionInfo = new SkinElementInfo(info.SelectionBackgroundElement, info.SelectionBounds)
            {
                ImageIndex = 1,
                Cache      = args.Cache
            };

            SkinElementPainter.Default.DrawObject(selectionInfo);
            args.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            Rectangle textArea = Rectangle.Inflate(info.SelectionBounds, -2, 0);

            info.AppearanceResult.DrawString(args.Cache, info.ResultCaption, textArea);

            var textWidth = 8 + (int)Math.Ceiling(info.AppearanceResult.CalcTextSize(args.Cache, info.ResultCaption, textArea.Width).Width);

            textArea.Width -= textWidth;
            textArea.X     += textWidth;

            foreach (var caption in info.AdditionalCaptions)
            {
                info.AppearanceResultInfo.DrawString(args.Cache, caption, textArea);

                textWidth = 4 + (int)Math.Ceiling(info.AppearanceResultInfo.CalcTextSize(args.Cache, caption, textArea.Width).Width);
                if (textWidth > textArea.Width)
                {
                    break;
                }
                textArea.Width -= textWidth;
                textArea.X     += textWidth;
            }
        }
Example #5
0
        protected override void DrawRadioGroupItems(ControlGraphicsInfoArgs info)
        {
            RadioGroupViewInfo vi = info.ViewInfo as RadioGroupViewInfo;

            foreach (RadioGroupItemViewInfo itemInfo in vi.ItemsInfo)
            {
                itemInfo.Cache = info.Cache;
                try
                {
                    CustomDrawEventArgs            e    = new CustomDrawEventArgs(info.Graphics, itemInfo, vi.RadioPainter, false);
                    RepositoryItemCustomRadioGroup item = vi.Item as RepositoryItemCustomRadioGroup;
                    item.RaiseCustomDrawItem(e);
                    if (!e.Handled)
                    {
                        vi.RadioPainter.DrawObject(itemInfo);
                    }
                    if (itemInfo.Focused)
                    {
                        ControlPaint.DrawFocusRectangle(info.Graphics, vi.GetFocusRect(itemInfo));
                    }
                }
                finally
                {
                    itemInfo.Cache = null;
                }
            }
        }
Example #6
0
        protected override void DoDrawGlyph(ControlGraphicsInfoArgs info, TokenEditTokenInfo tokenInfo)
        {
            base.DoDrawGlyph(info, tokenInfo);
            if (editor.Properties.CheckBoxCollection.Images.Count != 0)
            {
                int index = 0;
                CustomTokenEditTokenInfo customTokenInfo = tokenInfo as CustomTokenEditTokenInfo;
                int offset = customTokenInfo.Checked == true ? 4 : 0;
                switch (customTokenInfo.CheckBoxState)
                {
                case ObjectState.Normal:
                    index = offset;
                    break;

                case ObjectState.Hot:
                    index = offset + 1;
                    break;

                case ObjectState.Hot | ObjectState.Pressed:
                    index = offset + 2;
                    break;
                }
                Rectangle rect = customTokenInfo.CheckBoxGlyphBounds;
                info.Graphics.DrawImage(editor.Properties.CheckBoxCollection.Images[index], new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height));
            }
        }
Example #7
0
 public override void Draw(ControlGraphicsInfoArgs info)
 {
     base.Draw(info);
     (info.ViewInfo as ToggleSwitchViewInfo).CalculateRectangles();
     DrawBody(info);
     DrawThumbButton(info);
 }
Example #8
0
        protected void DrawBody(ControlGraphicsInfoArgs info)
        {
            Rectangle bound       = (info.ViewInfo as ToggleSwitchViewInfo).BodyRectangle;
            Skin      currentSkin = EditorsSkins.GetSkin((info.ViewInfo as ToggleSwitchViewInfo).LookAndFeel);
            Rectangle bodyRect    = (info.ViewInfo as ToggleSwitchViewInfo).BodyRectangle;

            bodyRect.Inflate(-3, -3);
            currentSkin = CommonSkins.GetSkin((info.ViewInfo as ToggleSwitchViewInfo).LookAndFeel);
            SkinElement element     = currentSkin[CommonSkins.SkinTextBorder];
            Color       borderColor = element.Border.Top;

            info.Cache.FillRectangle(info.Cache.GetSolidBrush(DevExpress.LookAndFeel.LookAndFeelHelper.GetSystemColorEx((info.ViewInfo as ToggleSwitchViewInfo).LookAndFeel,
                                                                                                                        SystemColors.Control)), info.Bounds);
            Color skinBackColor = currentSkin.CommonSkin.Colors["Control"];

            if ((info.ViewInfo as ToggleSwitchViewInfo).BodyState == DevExpress.Utils.Drawing.ObjectState.Hot)
            {
                using (SolidBrush sb = new SolidBrush(ConvertColor(skinBackColor, 100))) {
                    info.Graphics.FillRectangle(sb, bodyRect);
                }
            }

            bound.Width--;
            bound.Height--;
            info.Graphics.DrawRectangle(new Pen(borderColor), bound);
        }
Example #9
0
        protected virtual void DrawMinute(ControlGraphicsInfoArgs info)
        {
            DateTapeViewInfo dateViewInfo = info.ViewInfo as DateTapeViewInfo;

            DrawDigit(info.Graphics, dateViewInfo, dateViewInfo.MinuteBounds, DateInfoType.Minute);
            info.Graphics.DrawRectangle(Pens.Black, dateViewInfo.MinuteBounds);
        }
Example #10
0
        protected override void DoDrawGlyph(ControlGraphicsInfoArgs info, TokenEditTokenInfo tokenInfo)
        {
            base.DoDrawGlyph(info, tokenInfo);

            if (editor.Properties.CheckBoxSkinElement != null)
            {
                int index = 0;
                CustomTokenEditTokenInfo customTokenInfo = tokenInfo as CustomTokenEditTokenInfo;
                int             offset          = customTokenInfo.Checked == true ? 4 : 0;
                Rectangle       rect            = customTokenInfo.CheckBoxGlyphBounds;
                Rectangle       r               = new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height);
                SkinElementInfo skinElementInfo = new SkinElementInfo(editor.Properties.CheckBoxSkinElement, r);
                switch (customTokenInfo.CheckBoxState)
                {
                case ObjectState.Normal:
                    index = offset;
                    break;

                case ObjectState.Hot:
                    index = offset + 1;
                    break;

                case ObjectState.Hot | ObjectState.Pressed:
                    index = offset + 2;
                    break;
                }
                skinElementInfo.ImageIndex = index;


                ImageCollection imageCollection = editor.Properties.CheckBoxSkinElement.Image.GetImages();
                info.Graphics.DrawImage(imageCollection.Images[index], new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height));
                ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, skinElementInfo);
            }
        }
 /// <summary>
 ///     Перегружаемый метод прорисовки
 /// </summary>
 protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e)
 {
     base.DrawItemCore(info, itemInfo, e);
     var customInfo = itemInfo as CustomCheckedListBoxViewInfo.CustomCheckedItemInfo;
     if (customInfo == null)
     {
         return;
     }
     var rec = new Rectangle(itemInfo.Bounds.Location, new Size(itemInfo.Bounds.Width, LineWidth));
     var lineColor = ((CustomCheckedListBoxViewInfo) info.ViewInfo).DragDropLineColor;
     if (itemInfo.Index == 0)
     {
         var font = new Font(itemInfo.PaintAppearance.Font.FontFamily, itemInfo.PaintAppearance.Font.Size, FontStyle.Bold);
         info.Graphics.FillRectangle(Brushes.Lavender, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
         e.Graphics.DrawString(itemInfo.Text, font, Brushes.Black, e.Bounds.X, e.Bounds.Y + 2);
     }
     if (customInfo.IsOverLine)
     {
         if (customInfo.Index == 0)
         {
             rec.Height++;
         }
         info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec);
     }
     if (!customInfo.IsUnderLine)
     {
         return;
     }
     rec.Offset(0, itemInfo.Bounds.Height - LineWidth);
     if (customInfo.Index == ((CustomCheckedListBoxViewInfo) info.ViewInfo).ItemCountAccessMethod() - 1)
     {
         rec.Height++;
     }
     info.Graphics.FillRectangle(info.Cache.GetSolidBrush(lineColor), rec);
 }
Example #12
0
        protected override void DrawText(ControlGraphicsInfoArgs info)
        {
            var vi = (TextEditViewInfo)info.ViewInfo;

            if (vi.AllowDrawText)
            {
                if (!BaseEditViewInfo.ShowFieldBindings ||
                    string.IsNullOrEmpty(vi.GetDataBindingText()))
                {
                    var r = vi.MaskBoxRect;
                    if (!CheckDrawMatchedText(info))
                    {
                        var sf    = vi.PaintAppearance.GetStringFormat(vi.DefaultTextOptions);
                        var newSf = new StringFormat(sf);

                        // TODO: Not yet perfect.

                        newSf.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
                        newSf.Alignment    = StringAlignment.Far;

                        var text = /*'\x202E' +*/ vi.DisplayText;

                        info.Cache.DrawString(
                            text,
                            vi.PaintAppearance.Font,
                            vi.PaintAppearance.GetForeBrush(info.Cache),
                            r,
                            newSf);
                    }
                }
            }
        }
Example #13
0
        protected override void DrawItemCore(ControlGraphicsInfoArgs info, BaseListBoxViewInfo.ItemInfo itemInfo, ListBoxDrawItemEventArgs e)
        {
            base.DrawItemCore(info, itemInfo, e);
            Sample.CustomCheckedListBoxViewInfo.CustomCheckedItemInfo customInfo =
                itemInfo as Sample.CustomCheckedListBoxViewInfo.CustomCheckedItemInfo;
            if (customInfo == null)
            {
                return;
            }
            Rectangle rec       = new Rectangle(itemInfo.Bounds.Location, new Size(itemInfo.Bounds.Width, lineWidth));
            Color     lineColor = ((CustomCheckedListBoxViewInfo)info.ViewInfo).DragDropLineColor;

            if (customInfo.IsOverLine)
            {
                if (customInfo.Index == 0)
                {
                    rec.Height++;
                }
                e.Cache.FillRectangle(lineColor, rec);
            }
            if (customInfo.IsUnderLine)
            {
                rec.Offset(0, itemInfo.Bounds.Height - lineWidth);
                if (customInfo.Index == ((CustomCheckedListBoxViewInfo)info.ViewInfo).ItemCountAccessMethod() - 1)
                {
                    rec.Height++;
                }
                e.Cache.FillRectangle(lineColor, rec);
            }
        }
Example #14
0
        /// <summary>
        /// Copied, because was originally internal.
        /// </summary>
        internal bool CheckDrawMatchedText(ControlGraphicsInfoArgs info)
        {
            var vi = (TextEditViewInfo)info.ViewInfo;
            var r  = vi.MaskBoxRect;

            if (vi.MatchedString.Length > 0)
            {
                var matchedText = vi.MatchedString;
                if (IsTextMatch(vi, out var containsIndex, out var matchedLength))
                {
                    matchedText = matchedText.Substring(0, matchedLength);
                    if (!vi.MatchedStringUseContains)
                    {
                        containsIndex = -1;
                    }

                    DrawMatchedString(
                        info,
                        r,
                        vi.DisplayText,
                        matchedText,
                        vi.PaintAppearance,
                        vi.IsInvertIncrementalSearchString,
                        containsIndex);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Example #15
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);
            }
        }
Example #16
0
    protected override void DrawContent(ControlGraphicsInfoArgs info)
    {
        MyProgressBarViewInfo vi = info.ViewInfo as MyProgressBarViewInfo;

        info.Graphics.FillRectangle(new SolidBrush(info.ViewInfo.PaintAppearance.BackColor), info.Bounds);
        DrawObject(info.Cache, vi.ProgressInfo);
    }
Example #17
0
        protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked, ObjectState state)
        {
            CheckEditViewInfo       info;
            CheckEditPainter        painter;
            ControlGraphicsInfoArgs args;

            _checkEdit.EditValue = Checked;

            info    = _checkEdit.Properties.CreateViewInfo() as CheckEditViewInfo;
            painter = _checkEdit.Properties.CreatePainter() as CheckEditPainter;

            info.State = state;

            //info.Appearance.BackColor = Color.White;
            //info.AppearanceDisabled.BackColor = Color.Aqua;
            info.Item.UseParentBackground = true;

            info.EditValue = Checked;
            info.Bounds    = r;

            info.CalcViewInfo(g);
            args = new ControlGraphicsInfoArgs(info, new GraphicsCache(g), r);

            painter.Draw(args);
            args.Cache.Dispose();
        }
 public override void Draw(ControlGraphicsInfoArgs info)
 {
     calc = new MyProgressBarCalculator(info.ViewInfo as ProgressBarViewInfo);
     info.ViewInfo.PaintAppearance.FillRectangle(info.Cache, info.Bounds);
     DrawCenterLine(info);
     DrawValue(info);
     DrawTitle(info);
 }
        protected override void DrawContent(ControlGraphicsInfoArgs info)
        {
            SliderViewInfo vi = info.ViewInfo as SliderViewInfo;

            vi.TrackInfo.Bounds = info.Bounds;
            vi.TrackInfo.State  = vi.TrackInfo.ViewInfo.State;
            ObjectPainter.DrawObject(info.Cache, vi.SliderPainter, vi.TrackInfo);
        }
Example #20
0
        protected virtual void DrawSelection(ControlGraphicsInfoArgs info)
        {
            DateTapeViewInfo dateViewInfo = info.ViewInfo as DateTapeViewInfo;

            HighlightedItemInfo.Bounds   = dateViewInfo.SelectionBounds;
            HighlightedItemInfo.Graphics = info.Graphics;
            ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, HighlightedItemInfo);
        }
    protected override void DrawContent(ControlGraphicsInfoArgs info)
    {
        RatingControlViewInfo vi = info.ViewInfo as RatingControlViewInfo;

        info.Graphics.FillRectangle(new SolidBrush(info.ViewInfo.PaintAppearance.BackColor), info.Bounds);
        maximum = vi.Item.Maximum;
        images  = vi.Images;
        DrawObject(info.Cache, vi.ProgressInfo);
    }
Example #22
0
        protected override void DrawContent(ControlGraphicsInfoArgs info)
        {
            ProgressBarBaseViewInfo          vi   = info.ViewInfo as ProgressBarBaseViewInfo;
            RepositoryItemCircledProgressBar item = (RepositoryItemCircledProgressBar)vi.Item;

            ObjectPainter.DrawObject(info.Cache, vi.ProgressPainter, vi.ProgressInfo);
            info.Graphics.DrawEllipse(new Pen(item.Appearance.BackColor), CalcProportionalBorderRectangle(info.Bounds, item.CustomBehavior.MinWidthHeightProportion));
            DrawCircledProgressBarString(info);
        }
Example #23
0
        public override void Draw(ControlGraphicsInfoArgs info)
        {
            base.Draw(info);
            BaseEditViewInfo vi = info.ViewInfo as BaseEditViewInfo;
            RepositoryItemInplaceDataNavigator cri = vi.Item as RepositoryItemInplaceDataNavigator;
            PaintEventArgs e = new PaintEventArgs(info.Graphics, vi.Bounds);

            cri.EditNavigator.Draw(e);
        }
        protected override void DrawText(ControlGraphicsInfoArgs info)
        {
            MemoEditViewInfo        vi   = GetViewInfo(info);
            ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(vi, info.Cache, vi.Bounds);

            vi.Painter.Draw(args);
            //info.Graphics.FillRectangle(Brushes.Red, vi.Bounds);
            //RichTextEditPainter.DrawRTF(GetViewInfo(info), info.Cache);
        }
Example #25
0
 public virtual void Paint(ControlGraphicsInfoArgs info)
 {
     ViewInfo.Calculate(info.Graphics);
     ViewInfo.TopLine = 0;
     for (int i = 0; i < ViewInfo.Count; i++)
     {
         ViewInfo[i].Draw(info.Cache, info.ViewInfo.Appearance.GetFont(), ViewInfo[i].InfoText.Color, info.ViewInfo.Appearance.GetStringFormat());
     }
 }
Example #26
0
        private void DrawString(ControlGraphicsInfoArgs info, DevExpress.Utils.AppearanceObject appearance,
                                ref Rectangle valRect, string str)
        {
            int width = TextUtils.GetStringSize(info.Graphics, str, appearance.Font).Width;

            valRect.Width = width;
            base.DrawString(info, valRect, str, appearance);
            valRect.X += width;
        }
Example #27
0
 protected override void DrawContent(ControlGraphicsInfoArgs info)
 {
     base.DrawContent(info);
     FillRectangle(info);
     DrawSelection(info);
     DrawDay(info);
     DrawHour(info);
     DrawMinute(info);
 }
Example #28
0
        public static int GetFullWidth(Node node, ControlGraphicsInfoArgs info, FilterControlLabelInfo labelInfo, Font font, StringFormat format)
        {
            int ret = 0;

            for (int i = 0; i < labelInfo.Texts.Count; i++)
            {
                ret += GetElementWidth(LabelInfoHelper.EditorItem(node.OwnerControl, labelInfo.Texts[i]), labelInfo.Texts[i].Text, info.Cache, font, format);
            }
            return(ret);
        }
Example #29
0
        protected override void DrawBorder(ControlGraphicsInfoArgs info)
        {
            ProgressBarBaseViewInfo          vi   = info.ViewInfo as ProgressBarBaseViewInfo;
            RepositoryItemCircledProgressBar item = (RepositoryItemCircledProgressBar)vi.Item;

            if (item.OwnerEdit != null && item.OwnerEdit.InplaceType == DevExpress.XtraEditors.Controls.InplaceType.Standalone)
            {
                info.Graphics.FillRectangle(new SolidBrush(item.OwnerEdit.Parent.BackColor), info.Bounds);
            }
        }
 internal static void DrawTextSelection(string PaintText, int Offset, ControlGraphicsInfoArgs info, TextSelectionData SelectTextData)
 {
     if (SelectTextData != null && SelectTextData.Markers != null)
     {
         foreach (var i in SelectTextData.Markers)
         {
             DrawTextSelection(PaintText, Offset, info, SelectTextData.color, i.Start, i.Length);
         }
     }
 }
        void DrawCenterLine(ControlGraphicsInfoArgs info)
        {
            AppearanceObject obj = new AppearanceObject();

            obj.BackColor    = Color.Gray;
            obj.BackColor2   = Color.Black;
            obj.GradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
            obj.FillRectangle(info.Cache, calc.CenterBounds);
            obj.Dispose();
        }
Example #32
0
        private RichTextEditViewInfo GetViewInfo(ControlGraphicsInfoArgs info)
        {
            RepositoryItemMyButtonEdit ri = (info.ViewInfo as ButtonEditViewInfo).Item as RepositoryItemMyButtonEdit;
            RichTextEditViewInfo       vi = new RichTextEditViewInfo(ri.RichEdit);

            vi.Bounds    = info.ViewInfo.ContentRect;
            vi.EditValue = info.ViewInfo.DisplayText;
            vi.CalcViewInfo(info.Graphics);
            return(vi);
        }
Example #33
0
 protected void DrawCheckBox(Graphics g, RepositoryItemCheckEdit edit, Rectangle r, bool Checked)
 {
     var info = edit.CreateViewInfo() as CheckEditViewInfo;
     var painter = edit.CreatePainter() as CheckEditPainter;
     info.EditValue = Checked;
     info.Bounds = r;
     info.CalcViewInfo(g);
     var args = new ControlGraphicsInfoArgs(info, new GraphicsCache(g), r);
     painter.Draw(args);
     args.Cache.Dispose();
 }
 protected override void DrawContent(ControlGraphicsInfoArgs info)
 {
     info.Graphics.FillRectangle(info.Cache.GetSolidBrush(Color.White), info.ViewInfo.ClientRect);
     var icon = ((QuickHideEditViewInfo)info.ViewInfo).GetIcon;
     if (icon.Image == null)
     {
         icon.Image = Resources.Customization;
     }
     var attr = new ImageAttributes();
     attr.SetColorKey(icon.TransperentColor, icon.TransperentColor);
     info.Graphics.DrawImageUnscaled(icon.Image, info.ViewInfo.ClientRect);
 }
        private static void DrawTextSelection(string PaintText, int Offset, ControlGraphicsInfoArgs info, Color Color, int StartIndex, int Length)
        {
            if (StartIndex != -1)
            {
                string strPrec = PaintText.Substring(0, StartIndex);

                string str = PaintText.Substring(StartIndex, Length);

                SizeF sizePrec = info.ViewInfo.PaintAppearance.CalcTextSize(info.Cache, strPrec, info.Bounds.Width);

                SizeF size = info.ViewInfo.PaintAppearance.CalcTextSize(info.Cache, str, info.Bounds.Width);

                RectangleF rect = new RectangleF(Offset + info.ViewInfo.ContentRect.X + sizePrec.Width, info.Bounds.Y + info.ViewInfo.ContentRect.Y, size.Width, size.Height);

                info.Cache.FillRectangle(new SolidBrush(Color), rect);
            }        
        }
 internal void DrawTextSelection(ControlGraphicsInfoArgs info)
 {
     DrawTextSelection(info.ViewInfo.DisplayText, 0, info, TextSelection);
 }
		protected override void DrawContent(ControlGraphicsInfoArgs info)
		{
			var viewInfo = (HtmlColorEditViewInfo)info.ViewInfo;
			var color = (Color)viewInfo.EditValue;
			viewInfo.PaintAppearance.BackColor = color;
			viewInfo.PaintAppearance.ForeColor = color.GetNegativeColor();
			viewInfo.ColorHexValue = color.ToHex();
			base.DrawContent(info);
		}
                protected override void DrawText(ControlGraphicsInfoArgs info)
                {
                    base.DrawText(info);

                    Painter.DrawTextSelection(info);
                }
                protected override void DrawCheck(ControlGraphicsInfoArgs info)
                {
                    /*
                    Skin currentSkin = CommonSkins.GetSkin(info.ViewInfo.LookAndFeel);
                    string elementName = CommonSkins.SkinGroupPanelLeft;
                    SkinElement element = currentSkin[elementName];
                    SkinElementInfo args = new SkinElementInfo(element, info.Bounds);
                    args.Cache = info.Cache;
                    args.State = info.ViewInfo.CalcBorderState();
                    args.ImageIndex = -1;
                    args.CalcRectangle(info.Bounds);
                    SkinElementPainter.Default.DrawObject(args);
                     */

                    base.DrawCheck(info);

                    //info.Cache.FillRectangle(Color.FromArgb(90, Color.Gold), info.CalcRectangle(info.Bounds));
                }
 internal void DrawTextSelection(string PaintText, int Offset, ControlGraphicsInfoArgs info)
 {
     DrawTextSelection(PaintText, Offset, info, TextSelection);
 }
Example #41
0
 protected void DrawCustomBorder(ControlGraphicsInfoArgs info)
 {
     SmoothingMode smoothing = info.Graphics.SmoothingMode;
     try {
         info.Graphics.SmoothingMode = SmoothingMode.HighQuality;
         using (GraphicsPath path = new GraphicsPath()) {
             int halfWidth = -(int)Math.Ceiling(highlightPen.Width / 2.0) - InnerIndent;
             Rectangle bounds = Rectangle.Inflate(info.Bounds, halfWidth, halfWidth);
             int fraction = 6;
             int right = bounds.Right - fraction - 1;
             int bottom = bounds.Bottom - fraction - 1;
             path.AddArc(bounds.X, bounds.Y, fraction, fraction, 180, 90);
             path.AddArc(right, bounds.Y, fraction, fraction, 270, 90);
             path.AddArc(right, bottom, fraction, fraction, 0, 90);
             path.AddArc(bounds.Left, bottom, fraction, fraction, 90, 90);
             path.CloseFigure();
             info.Graphics.DrawPath(highlightPen, path);
         }
     }
     finally {
         info.Graphics.SmoothingMode = smoothing;
     }
 }
Example #42
0
 protected override void DrawFocusRect(ControlGraphicsInfoArgs info)
 {
     BaseEditViewInfo vi = info.ViewInfo as BaseEditViewInfo;
     if (vi != null && vi.DrawFocusRect) {
         DrawCustomBorder(info);
         return;
     }
     base.DrawFocusRect(info);
 }
		protected override void DrawText(ControlGraphicsInfoArgs info)
		{
			var vi = (TextEditViewInfo)info.ViewInfo;
			if (vi.AllowDrawText)
			{
				if (!BaseEditViewInfo.ShowFieldBindings || 
					string.IsNullOrEmpty(vi.GetDataBindingText()))
				{
					var r = vi.MaskBoxRect;
					if (!CheckDrawMatchedText(info))
					{
						var sf = vi.PaintAppearance.GetStringFormat(vi.DefaultTextOptions);
						var newSf = new StringFormat(sf);

						// TODO: Not yet perfect.

						newSf.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
						newSf.Alignment = StringAlignment.Far;

						var text = /*'\x202E' +*/ vi.DisplayText;

						info.Cache.DrawString(
							text,
							vi.PaintAppearance.Font,
							vi.PaintAppearance.GetForeBrush(info.Cache),
							r,
							newSf);
					}
				}
			}
		}
		/// <summary>
		/// Copied, because was originally internal.
		/// </summary>
		internal bool CheckDrawMatchedText(ControlGraphicsInfoArgs info)
		{
			var vi = (TextEditViewInfo)info.ViewInfo;
			var r = vi.MaskBoxRect;

			if (vi.MatchedString.Length > 0)
			{
				var matchedText = vi.MatchedString;
				int containsIndex, matchedLength;
				if (IsTextMatch(vi, out containsIndex, out matchedLength))
				{
					matchedText = matchedText.Substring(0, matchedLength);
					if (!vi.MatchedStringUseContains)
					{
						containsIndex = -1;
					}

					DrawMatchedString(
						info,
						r,
						vi.DisplayText,
						matchedText,
						vi.PaintAppearance,
						vi.IsInvertIncrementalSearchString,
						containsIndex);

					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}