public override void PaintLabel(System.Drawing.Graphics g, Rectangle rect, Rectangle clipRect, bool selected, bool paintFullLabel)
        {
            base.PaintLabel(g, rect, clipRect, selected, paintFullLabel);

            IPropertyValueUIService propValSvc = this.PropertyValueUIService;

            if (propValSvc == null)
            {
                return;
            }

            pvUIItems = propValSvc.GetPropertyUIValueItems(this, propertyInfo);

            if (pvUIItems != null)
            {
                if (uiItemRects == null || uiItemRects.Length != pvUIItems.Length)
                {
                    uiItemRects = new Rectangle[pvUIItems.Length];
                }
                for (int i = 0; i < pvUIItems.Length; i++)
                {
                    uiItemRects[i] = new Rectangle(rect.Right - ((IMAGE_SIZE + 1) * (i + 1)), (rect.Height - IMAGE_SIZE) / 2, IMAGE_SIZE, IMAGE_SIZE);
                    g.DrawImage(pvUIItems[i].Image, uiItemRects[i]);
                }
                GridEntryHost.LabelPaintMargin = (IMAGE_SIZE + 1) * pvUIItems.Length;
            }
        }
        public override void PaintLabel(System.Drawing.Graphics g, Rectangle rect, Rectangle clipRect, bool selected, bool paintFullLabel)
        {
            base.PaintLabel(g, rect, clipRect, selected, paintFullLabel);

            IPropertyValueUIService propValSvc = this.PropertyValueUIService;

            if (propValSvc == null)
            {
                return;
            }

            pvUIItems = propValSvc.GetPropertyUIValueItems(this, propertyInfo);

            if (pvUIItems != null)
            {
                if (uiItemRects == null || uiItemRects.Length != pvUIItems.Length)
                {
                    uiItemRects = new Rectangle[pvUIItems.Length];
                }

                if (!isScalingInitialized)
                {
                    if (DpiHelper.IsScalingRequired)
                    {
                        scaledImageSizeX = DpiHelper.LogicalToDeviceUnitsX(IMAGE_SIZE);
                        scaledImageSizeY = DpiHelper.LogicalToDeviceUnitsY(IMAGE_SIZE);
                    }
                    isScalingInitialized = true;
                }

                for (int i = 0; i < pvUIItems.Length; i++)
                {
                    uiItemRects[i] = new Rectangle(rect.Right - ((scaledImageSizeX + 1) * (i + 1)), (rect.Height - scaledImageSizeY) / 2, scaledImageSizeX, scaledImageSizeY);
                    g.DrawImage(pvUIItems[i].Image, uiItemRects[i]);
                }
                GridEntryHost.LabelPaintMargin = (scaledImageSizeX + 1) * pvUIItems.Length;
            }
        }
Beispiel #3
0
        public override void PaintLabel(Graphics g, Rectangle rect, Rectangle clipRect, bool selected, bool paintFullLabel)
        {
            base.PaintLabel(g, rect, clipRect, selected, paintFullLabel);
            IPropertyValueUIService propertyValueUIService = this.PropertyValueUIService;

            if (propertyValueUIService != null)
            {
                this.pvUIItems = propertyValueUIService.GetPropertyUIValueItems(this, this.propertyInfo);
                if (this.pvUIItems != null)
                {
                    if ((this.uiItemRects == null) || (this.uiItemRects.Length != this.pvUIItems.Length))
                    {
                        this.uiItemRects = new Rectangle[this.pvUIItems.Length];
                    }
                    for (int i = 0; i < this.pvUIItems.Length; i++)
                    {
                        this.uiItemRects[i] = new Rectangle(rect.Right - (9 * (i + 1)), (rect.Height - 8) / 2, 8, 8);
                        g.DrawImage(this.pvUIItems[i].Image, this.uiItemRects[i]);
                    }
                    this.GridEntryHost.LabelPaintMargin = 9 * this.pvUIItems.Length;
                }
            }
        }