Hack Forums
[C#] Parameter not valid on form resize? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Parameter not valid on form resize? (/showthread.php?tid=6089578)

Pages: Pages 1 2


Parameter not valid on form resize? - Lor‌d - Jun 23, 2020

I'm really not sure what's going on here but an application I've been working on for a while, I just noticed, throws an error when the form is minimized then re-opened.
I can't for the life of me figure out what's causing this so I'm posting here as sort of a last resort. Anyone know what's going on or have any sorta ideas?
The error throws up on the Program.cs on Application.Run(new Form1());
Here's a copy of the stacktrace
Code
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at Theme.FaderComboBox.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Edit: solved, I guess there was an issue with the dll I compiled the theme into. Thanks for all the help!


RE: Parameter not valid on form resize? - Roses - Jul 4, 2020

That stack trace isn't worth much if you don't share the event code for form redraw. That's probably what's triggering the error. Are you using a theme?


RE: Parameter not valid on form resize? - Lor‌d - Jul 4, 2020

(Jul 4, 2020 05:12 PM)Roses Wrote:  That stack trace isn't worth much if you don't share the event code for form redraw. That's probably what's triggering the _error_. Are you using a theme?

I am, I'm using the FaderTheme compiled as a dll.
Quick google search brings this back for a vb.net version of it. I've had it compiled and saved for ages so I'm not 100% sure if this is the same exact code I'm using or not tho.
https://pastebin.com/TTZPRGyD

Edit: Turns out I do still have the original code. I uploaded it here. https://pastebin.com/G6wUUXLA
Pretty much the same thing.


RE: Parameter not valid on form resize? - SaketSaket - Jul 5, 2020

(Jul 4, 2020 06:19 PM)Lord Psychotic Wrote:  I am, I'm using the FaderTheme compiled as a dll.
Quick google search brings this back for a vb.net version of it. I've had it compiled and saved for ages so I'm not 100% sure if this is the same exact code I'm using or not tho.
https://pastebin.com/TTZPRGyD

Edit: Turns out I do still have the original code. I uploaded it here. https://pastebin.com/G6wUUXLA
Pretty much the same thing.

It's my theme... written some 6 years ago.... will recode again with latest framework...

Give me couple of days...

Regards
Saket


RE: Parameter not valid on form resize? - Roses - Jul 5, 2020

Well ding ding ding. Looks like we solved it! @SaketSaket, if you open source it, I'll help you fix whatever is causing OPs issue so he can move along quickly.


RE: Parameter not valid on form resize? - Lor‌d - Jul 5, 2020

(Jul 5, 2020 09:14 AM)SaketSaket Wrote:  It's my theme... written some 6 years ago.... will recode again with latest framework...

Give me couple of days...

Regards
Saket

You're amazing, I love this theme and have been using it for a while. Hope you don't mind that.
Since you're looking at redoing it would it be possible to add the ability to resize the form as well?


RE: Parameter not valid on form resize? - n0$f3ratu$ - Jul 5, 2020

(Jul 5, 2020 10:49 AM)Lord Psychotic Wrote:  You're amazing, I love this theme and have been using it for a while. Hope you don't mind that.
Since you're looking at redoing it would it be possible to add the ability to resize the form as well?

Your problem is not from the theme.
The theme is working perfectly.


RE: Parameter not valid on form resize? - SaketSaket - Jul 5, 2020

(Jul 5, 2020 09:33 AM)Roses Wrote:  Well ding ding ding. Looks like we solved it! @SaketSaket, if you open source it, I'll help you fix whatever is causing OPs issue so he can move along quickly.

It's already open source... posted as public on pastebin...

(Jul 5, 2020 10:49 AM)Lord Psychotic Wrote:  You're amazing, I love this theme and have been using it for a while. Hope you don't mind that.
Since you're looking at redoing it would it be possible to add the ability to resize the form as well?

Yes i can do that...

Regards
Saket


RE: Parameter not valid on form resize? - Lor‌d - Jul 5, 2020

(Jul 5, 2020 12:45 PM)n0$f3ratu$ Wrote:  Your problem is not from the theme.
The theme is working perfectly.

And that's what I was thinking too but whenever I minimize the form and re-open it it crashes with the error I originally posted. I don't have any code that runs when the form minimizes or re-opens so I don't know what it could possibly be.


RE: Parameter not valid on form resize? - n0$f3ratu$ - Jul 5, 2020

(Jul 5, 2020 02:24 PM)Lord Psychotic Wrote:  And that's what I was thinking too but whenever I minimize the form and re-open it it crashes with theerror I originally posted. I don't have any code that runs when the form minimizes or re-opens so I don't know what it could possibly be.

I test it under 4.5 framework both as dll as well as code and both times worked perfect.


RE: Parameter not valid on form resize? - Lor‌d - Jul 5, 2020

(Jul 5, 2020 02:26 PM)n0$f3ratu$ Wrote:  I test it under 4.5 framework both as dll as well as code and both times worked perfect.

Any ideas what could it be then cause I'm totally lost here.


RE: Parameter not valid on form resize? - n0$f3ratu$ - Jul 5, 2020

(Jul 5, 2020 02:29 PM)Lord Psychotic Wrote:  Any ideas what could it be then cause I'm totally lost here.

Send me your project as it is?!


RE: Parameter not valid on form resize? - Lor‌d - Jul 5, 2020

(Jul 5, 2020 05:14 PM)n0$f3ratu$ Wrote:  Send me your project as it is?!

Sending you a private message now


RE: Parameter not valid on form resize? - n0$f3ratu$ - Jul 5, 2020

(Jul 5, 2020 05:20 PM)Lord Psychotic Wrote:  Sending you a private message now

Replace the theme .dll with this one: https://easyupload.io/enpzsf
Good luck.


Also I noticed that for you or your users to run this program you need to install wpcap.
You should add wpcap.dll as reference.


RE: Parameter not valid on form resize? - SaketSaket - Jul 5, 2020

(Jul 5, 2020 06:45 PM)n0$f3ratu$ Wrote:  Replace the theme .dll with this one: https://easyupload.io/enpzsf
Good luck.


Also I noticed that for you or your users to run this program you need to install wpcap.
You should add wpcap.dll as reference.

Have you changed any code before compiling .dll?