datagridview cell color
-
hi, can someone tell me how to change the color of a part of a string in a cell from a datagridview. for example if the text of a cell is "125/art" how can i show the "art" in red color ? i know, i can use the Richtextbox but i dont want to change the color of the complete text. thanks for your help jogi
-
hi, can someone tell me how to change the color of a part of a string in a cell from a datagridview. for example if the text of a cell is "125/art" how can i show the "art" in red color ? i know, i can use the Richtextbox but i dont want to change the color of the complete text. thanks for your help jogi
You can't unless you write your own code to custom draw the cells. There is no built-in support for what you want to do. The cells in the DGV work nothing like a RichTextBox.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
hi, can someone tell me how to change the color of a part of a string in a cell from a datagridview. for example if the text of a cell is "125/art" how can i show the "art" in red color ? i know, i can use the Richtextbox but i dont want to change the color of the complete text. thanks for your help jogi
-
hi, can someone tell me how to change the color of a part of a string in a cell from a datagridview. for example if the text of a cell is "125/art" how can i show the "art" in red color ? i know, i can use the Richtextbox but i dont want to change the color of the complete text. thanks for your help jogi
Yes, I also agree with Eddy. If you want you can make the 2 cols width (in Properties of that particular col) very small - just till what your text fixes, alos make Resizable = False & Padding (Cell style) = 0, 0, 0, 0. With this atleast you can amke min space/gap between both the cols and paint the other col or set its background/foreground color as per your choice. To set properties of a particular cool, select grid, Column Collection, and then select your col & proceed.
Thanks & Regards,