GRID標部分文字顏色

  • 1011
  • 0

摘要:GRID標部分文字顏色

        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (textEdit1.Text != "")
            {
                int iindex = e.DisplayText.IndexOf(textEdit1.Text);
                if (iindex > -1)
                {
                    e.Appearance.ForeColor = Color.Black;
                    DevExpress.Utils.Paint.XPaint.Graphics.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, textEdit1.Text
                        ,e.Appearance, Color.Black, Color.DarkOrange, false, iindex);
                    e.Handled = true;
                }                                 
            }
        }