Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm a beginner in C# and i'm trying to draw a string with a custom color (using Windows Forms and System Drawing).

I already know how to change the color, but only using default colors of C#. I can draw a form, a polygon or something like that with a custom RGB color (Color.FromARGB), but i don't know how to do that with a DrawString.

This is an example of a string that i want to draw with a custom RGB color :

g.DrawString("test", Font, Brushes.Black, new Point(50, 50);


Thanks a lot.
Florent

What I have tried:

I tried to use a custom color pen that i used for my forms.
Posted
Updated 28-Feb-20 2:36am

1 solution

 
Share this answer
 
Comments
Mineodo68 28-Feb-20 8:55am    
Yeah but it's only to fill or draw shapes, not a font...
Richard MacCutchan 28-Feb-20 8:56am    
Did you actually read the page that I linked to above? Especially the link at the bottom titled "Using a Brush to Fill Shapes".
Mineodo68 28-Feb-20 9:03am    
Actually i did. I'm not sure you really understood what i was looking for. I need to fill a string with a custom RGB color, not a shape.
Richard MacCutchan 28-Feb-20 9:14am    
Your comment above clearly states, "it's only to fill or draw shapes".

Maybe if you showed your actual code and explained exactly what happens we can try to make some suggestions.
Mineodo68 28-Feb-20 9:55am    
There's a misunderstanding, i said that what you gave me was to fill or draw shapes, and i was looking for something to custom color a font

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900