Ejemplo n.º 1
0
        protected override void Assign(BaseControlViewInfo info)
        {
            base.Assign(info);
            ImageTextEditViewInfo be = info as ImageTextEditViewInfo;

            if (be == null)
            {
                return;
            }
            this.fIconRect = be.fIconRect;
        }
Ejemplo n.º 2
0
        protected override void DrawContent(ControlGraphicsInfoArgs info)
        {
            base.DrawContent(info);
            ImageTextEditViewInfo vi = info.ViewInfo as ImageTextEditViewInfo;

            if (vi.MaskBoxRect.IsEmpty)
            {
                info.Cache.FillRectangle(vi.PaintAppearance.GetBackBrush(info.Cache), info.Bounds);
            }
            DrawIcon(info);
        }
Ejemplo n.º 3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            ImageTextEditViewInfo vi = ViewInfo as ImageTextEditViewInfo;

            if (vi.IsIconClick(e.Location))
            {
                int            newX = e.X - vi.IconRect.Left;
                int            newY = e.Y - vi.IconRect.Top;
                MouseEventArgs ee   = new MouseEventArgs(e.Button, e.Clicks, newX, newY, e.Delta);
                Properties.RaiseIconClick(ee);
            }
            base.OnMouseDown(e);
        }
Ejemplo n.º 4
0
        protected virtual void DrawIcon(ControlGraphicsInfoArgs info)
        {
            ImageTextEditViewInfo    vi = info.ViewInfo as ImageTextEditViewInfo;
            OnIconSelectionEventArgs e  = new OnIconSelectionEventArgs(vi.ImageList, vi.ImageIndex);

            vi.Item.RaiseOnIconSelection(e);

            // calculate vertical offset to center icon vertically
            int       offsetY  = (info.Bounds.Height / 2) - (vi.IconRect.Height / 2);
            Rectangle iconRect = vi.IconRect;

            iconRect.Y += offsetY;

            if (e.ImageList != null && e.ImageIndex != -1)
            {
                info.Cache.Paint.DrawImage(info.Cache, e.ImageList, e.ImageIndex, iconRect, true);
            }
            else
            {
                info.Graphics.FillRectangle(info.Cache.GetSolidBrush(Color.White), vi.IconRect);
            }
        }