Пример #1
0
        //Serial port description tooltip
        private void cbxPort_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }                            // added this line thanks to Andrew's comment
            cbxPortEntry item = (cbxPortEntry)cbxPort.Items[e.Index];

            e.DrawBackground();
            using (SolidBrush br = new SolidBrush(e.ForeColor))
            { e.Graphics.DrawString(item.Name, e.Font, br, e.Bounds); }
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                toolTip1.Show(item.Description, cbxPort, e.Bounds.Right, e.Bounds.Bottom);
            }
            e.DrawFocusRectangle();
        }
Пример #2
0
        public int CompareTo(object obj)
        {
            cbxPortEntry cbxObj = (cbxPortEntry)obj;

            return(string.Compare(this.Name, cbxObj.Name));
        }