Ejemplo n.º 1
0
 void inner_ListControl_FetchDisplayText(object sender, FetchDisplayTextEventArgs e)
 {
     if (internal_source == null)
     {
         e.DisplayText = string.Empty;
     }
     else if (e.ItemIndex >= internal_source.ItemCount)
     {
         e.DisplayText = string.Empty;
     }
     else
     {
         e.DisplayText = e.ItemIndex == -1 ? string.Empty : internal_source.GetItemDisplayName(e.ItemIndex);
         //if (internal_source.GetItemIsContainer(e.ItemIndex))
         //{
         //if container, use alt text color
         //e.UseAltColors = true;
         //e.AltTextColor = color_alt;
         //}
     }
     e.Colors = Options.GetItemColors
                    (e.DisplayText,
                    e.State,
                    internal_source == null ? ItemCategory.Default : internal_source.GetItemCategory(e.ItemIndex));
 }
Ejemplo n.º 2
0
 private void OnFetchDisplayInfo(FetchDisplayTextEventArgs e)
 {
     if (FetchDisplayText != null)
     {
         FetchDisplayText(this, e);
     }
 }
Ejemplo n.º 3
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            FetchDisplayTextEventArgs eArgs = new FetchDisplayTextEventArgs(-1, ItemState.None);

            OnFetchDisplayInfo(eArgs);

            Brush b_brush = brushes.GetBrush(eArgs.Colors.BackgroundColor);

            e.Graphics.FillRectangle(b_brush, e.ClipRectangle);
        }
Ejemplo n.º 4
0
        protected void render_cell(int cell_index, Graphics g, Rectangle clip_rectangle)
        {
            int item_index = cell_index_2_item_index(cell_index);

            if (item_index == -1)
            {
                return; //empty cell
            }
            ItemState state             = GetItemState(item_index);
            FetchDisplayTextEventArgs e = new FetchDisplayTextEventArgs(item_index, state);

            OnFetchDisplayInfo(e);
            //ColorSchemeForItem scheme = e.ColorScheme;

            Brush b_brush = brushes.GetBrush(e.Colors.BackgroundColor);
            Brush f_brush = brushes.GetBrush(e.Colors.ForegroundColor);

            //highlights focus only on focused list
            //if (((state & ItemState.Focused) == ItemState.Focused)&&(this.Focused))
            //{
            //    b_brush = brush_background_focused;
            //}
            //else
            //{
            //    b_brush = brush_background;
            //}

            //if ((state & ItemState.Selected) == ItemState.Selected)
            //{
            //    f_brush = brush_foreground_selected;
            //}
            //else
            //{
            //    if (e.UseAltColors)
            //    {
            //        f_brush = new SolidBrush(e.AltTextColor);
            //    }
            //    else
            //    {
            //        f_brush = brush_foreground;
            //    }
            //}

            g.FillRectangle(b_brush, cell_rects[cell_index]);
            g.DrawString
                (e.DisplayText,
                this.Font,
                f_brush,
                cell_rects[cell_index],
                string_format);

            //focus rectangle
            if (item_index == FocusedIndex)
            {
                ControlPaint.DrawFocusRectangle(g, cell_rects[cell_index], e.Colors.ForegroundColor, e.Colors.BackgroundColor);
                //if ((state & ItemState.Selected) == ItemState.Selected)
                //{
                //    ControlPaint.DrawFocusRectangle(g, cell_rects[cell_index], color_selected_fore, color_focused_back);
                //}
                //else
                //{
                //    if (e.UseAltColors)
                //    {
                //        ControlPaint.DrawFocusRectangle(g, cell_rects[cell_index], e.AltTextColor, color_focused_back);
                //    }
                //    else
                //    {
                //        ControlPaint.DrawFocusRectangle(g, cell_rects[cell_index], color_fore, color_focused_back);
                //    }
                //}
            }
        }