Example #1
0
        // 控件自绘制
        private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }
            e.DrawBackground();
            Font drawFont = e.Font;
            bool outFont  = false;

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                outFont  = true;
                drawFont = new Font(drawFont, FontStyle.Bold); // 黑体显示
            }

            using (Brush brush = new SolidBrush(e.ForeColor))
            {
                CmmDataRecord cd  = (CmmDataRecord)comboBox1.Items[e.Index];
                string        str = cd.ServerName;
                if (cd.IsFault)
                {
                    str = cd.ServerName + "   " + "错误";
                }
                e.Graphics.DrawString(str, drawFont, brush, e.Bounds);
                if (outFont)
                {
                    drawFont.Dispose();
                }
            }

            e.DrawFocusRectangle();
        }
Example #2
0
 private void AddClientView(CmmServerConfig arg1, ClientState arg2)
 {
     ClientUICommon.syncContext.Post(o =>
     {
         CmmDataRecord cmmRecord = new CmmDataRecord(arg1, true, arg2);
         cmmRecordList.Add(cmmRecord);
     }, null);
 }