Exemple #1
0
        public void Drawitem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }
            e.DrawBackground();
            e.DrawFocusRectangle();

            e.Graphics.SmoothingMode     = SmoothingMode.HighQuality;
            e.Graphics.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            e.Graphics.InterpolationMode = (InterpolationMode)7;
            e.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;

            //-- if selected
            if (String.Compare(e.State.ToString(), "Selected,") > 0)
            {
                //-- Base
                e.Graphics.FillRectangle(new SolidBrush(_SelectedColor), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

                //-- Text
                e.Graphics.DrawString(" " + ListBx.GetItemText(ListBx.Items[e.Index]), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
            }
            else
            {
                //-- Base
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51, 53, 55)), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));

                //-- Text
                e.Graphics.DrawString(" " + ListBx.GetItemText(ListBx.Items[e.Index]), new Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 2);
            }

            e.Graphics.Dispose();
        }
        protected void ToolTipShow(object sender, MouseEventArgs e)
        {
            string txt = ListBx.Items[ListBx.IndexFromPoint(e.Location)].ToString();

            if (this.tip.GetToolTip(ListBx) != txt)
            {
                this.tip.SetToolTip(ListBx, txt);
            }
            base.OnMouseMove(e);
        }