Пример #1
0
        protected internal virtual void RaiseOnIconSelection(OnIconSelectionEventArgs e)
        {
            OnIconSelectionEventHandler handler = (OnIconSelectionEventHandler)Events[_onIconSelection];

            if (handler != null)
            {
                handler(GetEventSender(), e);
            }
        }
Пример #2
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);
            }
        }