|
-
Sep 11th, 2005, 12:13 AM
#1
Thread Starter
Fanatic Member
A puzzling GDI+ Q...;)
Hello everyone...
Heres a puzzling question..
I want to draw bars across a form...and I am not able to draw all across the form..(Not doing a very serious project,just having fun doing something crazy.)
Code:
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
drawbars(e.Graphics,Color.Red,Color.Blue,3,0);
drawbars(e.Graphics,Color.Yellow,Color.Red,(this.Width/6),0);
drawbars(e.Graphics,Color.Green,Color.Blue,(this.Width/3),0);
drawbars(e.Graphics,Color.Chocolate,Color.White,(this.Width/2),0);
//drawbars(e.Graphics,Color.BlueViolet,Color.Honeydew,(this.Width/-1),0);
}
private void drawbars(Graphics g,Color x,Color y,int i,int j)
{
System.Drawing.Rectangle rec=new Rectangle(i,j,(this.Width/5),(this.Height));
LinearGradientBrush grad=new LinearGradientBrush(rec,x,y,10,true);
g.FillRectangle(grad,rec);
}
private void Form1_Resize(object sender, System.EventArgs e)
{
this.Invalidate();
}
So,can someone help me achieve drawing bars till the right end of the form?
Thank Youuu
Godwin
Help someone else with what someone helped you! 
-
Sep 11th, 2005, 12:24 AM
#2
Re: A puzzling GDI+ Q...;)
well just the wrong math
drawbars(e.Graphics,Color.Red,Color.Blue,3,0);
drawbars(e.Graphics,Color.Yellow,Color.Red,(this.Width/4),0);
drawbars(e.Graphics,Color.Green,Color.Blue,(this.Width/2),0);
drawbars(e.Graphics,Color.Chocolate,Color.White,(int)(this.Width *3.0/4),0);
I just changed the width * whatever's
and inside the draw function, change /5 to /4
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Sep 11th, 2005, 12:49 AM
#3
Thread Starter
Fanatic Member
Re: A puzzling GDI+ Q...;)
Wow Mr Polite,You're too good at Math too...Awesomeeee
hmmm,but,this correction you made leaves a white gap between each bar.Its perfect apart from that.
Godwin
Help someone else with what someone helped you! 
-
Sep 11th, 2005, 12:52 AM
#4
Thread Starter
Fanatic Member
Re: A puzzling GDI+ Q...;)
I was actually trying to draw many bars all across the form..without any gaps between the bars and no empty space on the right side.I dont know what math i should use though.
Forgive me since Im bad at math.
Godwin
Help someone else with what someone helped you! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|