well..i am doin a button that will download a picture off the internet and in the end will show the downloaded picture in himself...but i am getting a g@y "out of memory"... grrr the code is the following:
this is where the error is:
the code that draws the picture is this:PHP Code:private void downloadProgress(downloadManager e)
{
if (this._currentProgress == 100)
{
string fn = "C:\\pic.jpg";
_parent.Image = Image.FromFile(fn);
}
else
{
this._currentProgress = (int)e.currentProgress;
}
}
PHP Code:private void OnPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Button button = ((Button)sender);
if (this.devImplementation.isProgressBarVisible == true)
{
if (!(this.devImplementation.currentProgress >= 0 && this.devImplementation.currentProgress <= 100))
{
throw (new System.ArithmeticException("The value must be between 0 and 100"));
}
double progress = ((double)this.devImplementation.currentProgress / (double)100) * (double)button.Width;
e.Graphics.FillRectangle(
new System.Drawing.SolidBrush(this.devImplementation.mainColor),
new Rectangle(
new Point(0, button.Height / 2 - 10),
new Size((int)progress , 20)
));
}
}




Reply With Quote