コード例 #1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            int num1 = this.GetIndex(e.Index);

            if (((this.provider == null) || (num1 < 0)) || (num1 >= this.provider.Count))
            {
                base.OnDrawItem(e);
            }
            else
            {
                bool flag1 = (e.State & DrawItemState.Disabled) != DrawItemState.None;
                bool flag2 = ((e.State & DrawItemState.Focus) != DrawItemState.None) && ((e.State & DrawItemState.NoFocusRect) == DrawItemState.None);
                bool flag3 = (e.State & DrawItemState.Selected) != DrawItemState.None;
                Size size1 = (this.images != null) ? new Size(this.images.ImageSize.Width + EditConsts.DefaultColumnSeparator, this.images.ImageSize.Height) : new Size(0, 0);
                if (this.images != null)
                {
                    int num2 = ((CodeCompletionProvider)this.provider).GetImageIndex(num1);
                    if ((num2 >= 0) && (num2 < this.images.Images.Count))
                    {
                        this.images.Draw(e.Graphics, e.Bounds.Left, e.Bounds.Top + ((e.Bounds.Height - size1.Height) / 2), num2);
                    }
                    e.Graphics.TranslateTransform((float)size1.Width, 0f);
                }
                e.DrawBackground();
                if (flag2)
                {
                    e.DrawFocusRectangle();
                }
                int num3 = e.Bounds.Left + size1.Width;
                for (int num4 = 0; num4 < this.provider.ColumnCount; num4++)
                {
                    ICodeCompletionColumn column1 = (num4 < this.columns.Count) ? this.GetColumn(num4) : null;
                    if ((column1 == null) || column1.Visible)
                    {
                        Color     color1     = (column1 != null) ? column1.ForeColor : this.ForeColor;
                        int       num5       = (int)this.columnWidths[num4];
                        Rectangle rectangle1 = new Rectangle(num3, e.Bounds.Top, num5, e.Bounds.Height);
                        if (flag1)
                        {
                            color1 = EditConsts.DefaultDisabledForeColor;
                        }
                        else if (flag3)
                        {
                            color1 = EditConsts.DefaultHighlightForeColor;
                        }
                        this.DrawColumn(e.Graphics, rectangle1, this.provider.GetColumnText(num1, num4), color1, (column1 != null) ? column1.FontStyle : FontStyle.Regular);
                        num3 += num5;
                    }
                }
            }
        }
コード例 #2
0
 protected virtual void ProviderChanged()
 {
     base.BeginUpdate();
     try
     {
         base.Items.Clear();
         this.columnWidths.Clear();
         this.itemWidth = 0;
         if (this.provider != null)
         {
             for (int num1 = 0; num1 < this.provider.Count; num1++)
             {
                 string text1 = this.provider.Strings[num1];
                 if (this.IsFiltered(text1))
                 {
                     base.Items.Add(num1.ToString() + "|" + text1);
                 }
             }
             for (int num3 = 0; num3 < this.provider.ColumnCount; num3++)
             {
                 int num2 = 0;
                 ICodeCompletionColumn column1 = (num3 < this.columns.Count) ? this.GetColumn(num3) : null;
                 for (int num4 = 0; num4 < this.provider.Count; num4++)
                 {
                     if (this.IsFiltered(this.provider.Strings[num4]))
                     {
                         num2 = Math.Max(num2, this.MeasureWidth(this.provider.GetColumnText(num4, num3), (column1 != null) ? column1.FontStyle : FontStyle.Regular));
                     }
                 }
                 num2           += EditConsts.DefaultColumnSeparator;
                 this.itemWidth += num2;
                 this.columnWidths.Add(num2);
             }
         }
         if (this.images != null)
         {
             this.itemWidth += (this.images.ImageSize.Width + EditConsts.DefaultColumnSeparator);
         }
         this.UpdateControlSize();
     }
     finally
     {
         base.EndUpdate();
     }
 }