Yes, I believed that drawing rectangle is maybe my only choice. But I have to draw a line. So I could draw very thin rectangle - Ill have some trouble with rotation, but I can firuge it out. brrrrrr....
Ill have to take a pen and paper into my hands and do some mathematics...
mutant said:
Look into the System.Drawing.Drawing2D.LinearGradientbrush class. Here is an example:
C#:
Graphics gr = this.CreateGraphics();
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(0,0,100,100), Color.NavajoWhite, Color.Red, LinearGradientMode.Vertical);
gr.FillRectangle(br, br.Rectangle);
gr.Dispose();
Oh, im sorry, for some reason I didnt think about you needing a line when i wrote the code . You can create a Pen object used to draw the line from the brush so that is not a problem.
C#:
Graphics gr = this.CreateGraphics();
LinearGradientBrush br = new LinearGradientBrush(new Rectangle(0,0,100,100), Color.NavajoWhite, Color.Red, LinearGradientMode.Vertical);
Pen lpen = new Pen(br, 1);
gr.DrawLine(lpen,0,0,100,200);
gr.Dispose();
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.