Resolved application is freezing while running.

Kamen

Active member
Joined
Nov 30, 2020
Messages
28
Programming Experience
1-3
Hello.
How are you?
I'd like to ask another help now.
I made a c# windows form application, which have 2 thread and customized controls such as rounded button, gradient panel, rounded form dialog.
And also it has some additional custom dll, too.
I'll share current error text here.
I hope your professional assistance again.
Thank you.
Best Regards.
 

Attachments

  • error.txt
    8.5 KB · Views: 38
Solution
Never do this:
C#:
using (Graphics g = e.Graphics)
{
    :
}

Never dispose something that you don't own. In this case, the e.Graphics belongs to the framework code that is calling your event handler. The assignment g = e.Graphics is just taking a reference. It is not giving you a brand new [il]Graphics[/icode] object that you can dispose on your own.
While debuging LinearGradientBrush , I got to know error msg like this.
"To use interpolation colors, the property must be set to a valid ColorBlend object. The ColorBlend object must be constructed with the same number of positions and color values. Positions start at 0.0. Must be in the range up to 1.0. 1.0 must be the last element of the array."
maybe I think it is problem.
LinearGradientBrush's color parameters may be invalid now?
is it right?
Thank you for your kind explanation.
In fact, as I said before, I'm a beginner in c# application development and therefore I have so lots of unknow things.
I hope your kind help again.
 
Last edited:
LinearGradientBrush(Rect, this.ColorTop, this.ColorBottom, 90F)
You're using LinearGradientBrush(RectangleF, Color, Color, Single) constructor, which is valid.
 
Never do this:
C#:
using (Graphics g = e.Graphics)
{
    :
}

Never dispose something that you don't own. In this case, the e.Graphics belongs to the framework code that is calling your event handler. The assignment g = e.Graphics is just taking a reference. It is not giving you a brand new [il]Graphics[/icode] object that you can dispose on your own.
 

Attachments

  • 1616771276527.png
    1616771276527.png
    92.1 KB · Views: 21
Solution
Never do this:
C#:
using (Graphics g = e.Graphics)
{
    :
}

Never dispose something that you don't own. In this case, the e.Graphics belongs to the framework code that is calling your event handler. The assignment g = e.Graphics is just taking a reference. It is not giving you a brand new [il]Graphics[/icode] object that you can dispose on your own.
Awesome. the problem was because of Graphics you pointed out.
I'm very happy to fix it with you and JohnH, jmcilhinney's help.
Thanks for your staff's kind explanation.
I love this forum really.
Best Regards.
 
Back
Top Bottom