Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

datagridview and color string-C#

$
0
0

Hello

I found this link: (DataGridView: multiple forecolors in one cell) in vbcity.com/forums/p/164978/704119.aspx#704119

I used this code into C#

        private void button1_Click(object sender, EventArgs e)
        {
            RTF.RTFBuilder sb = new RTF.RTFBuilder();
            DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
            DataGridViewColumn newcoll = new DataGridViewColumn(cell);
            newcoll.CellTemplate=cell;
            newcoll.DefaultCellStyle.Font = Font;
            dataGridView1.Columns.Add(newcoll);
            DataGridViewRow row = (DataGridViewRow)dataGridView1.Rows[1];
            sb.AppendLine("Line 1");
            sb.ForeColor(KnownColor.Red).AppendLine("Line 2");
            sb.AppendLine("Line 3");
            row.Cells[0].Value = sb.ToString();
        }

but I do not have a good result.


Viewing all articles
Browse latest Browse all 2535

Trending Articles