473,320 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Invalid parameter used

I am facing a problem with my GDI++ code in C# control.

Though i have tried many things from last 6 months, i am not able to
get completely rid of this bug.

Whenever the user is opening a window or closing a window, i'm getting
following exception.

This is a very rare exception but it causes the whole application
crash
and has become a nigtmare for me.

This problem is more frequent on Citrix client as compared to normal
desktop environment.

InnnerException: Invalid parameter used.

Stack Trace: at System.Drawing.Region.GetHrgn(Graphics g)
at System.Windows.Forms.Control.GetHRgn(Region region)
at System.Windows.Forms.Control.OnHandleCreated(Event Args e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
Source: System.Drawing

I have done following coding in a control which is derived from
System.Windows.Forms.Button

protected override void OnPaint(PaintEventArgs e)
{
if(this != null)
{
if(!this.IsDisposed && !this.Disposing)
{
using(GraphicsPath path = new
GraphicsPath(FillMode.Alternate))
{
path.AddEllipse(0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Clone())
{
ctrl.Region=rgn.Clone();
}
}

}
}
}

I'll appriciate if you can provide some help.

Jan 29 '07 #1
2 2086
You posted this to at least the following newsgroups:

microsoft.public.dotnet.framework
microsoft.public.dotnet.general
microsoft.public.dotnet.languages.csharp
microsoft.public.dotnet.languages.vb

but not to

microsoft.public.dotnet.framework.drawing.

When you post a message to multiple groups, please post all of
them at once. That way, if someone in one group provides a
solution, the solution will be posted to all of the groups.
Also, if someone in another group is working on a solution,
they will know it has been solved, and they can work on helping
somebody else.

Also please do not post to newsgroups that are not pertinent,
like in this case, the VB newsgroups, when you have a C# issue.

Robin S.
-------------------------------------------
"JayvardhanPune" <ja**************@tietoenator.inwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
>I am facing a problem with my GDI++ code in C# control.

Though i have tried many things from last 6 months, i am not able to
get completely rid of this bug.

Whenever the user is opening a window or closing a window, i'm getting
following exception.

This is a very rare exception but it causes the whole application
crash
and has become a nigtmare for me.

This problem is more frequent on Citrix client as compared to normal
desktop environment.

InnnerException: Invalid parameter used.

Stack Trace: at System.Drawing.Region.GetHrgn(Graphics g)
at System.Windows.Forms.Control.GetHRgn(Region region)
at System.Windows.Forms.Control.OnHandleCreated(Event Args e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
Source: System.Drawing

I have done following coding in a control which is derived from
System.Windows.Forms.Button

protected override void OnPaint(PaintEventArgs e)
{
if(this != null)
{
if(!this.IsDisposed && !this.Disposing)
{
using(GraphicsPath path = new
GraphicsPath(FillMode.Alternate))
{
path.AddEllipse(0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Clone())
{
ctrl.Region=rgn.Clone();
}
}

}
}
}

I'll appriciate if you can provide some help.

Jan 29 '07 #2
PS

"JayvardhanPune" <ja**************@tietoenator.inwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
>I am facing a problem with my GDI++ code in C# control.

Though i have tried many things from last 6 months, i am not able to
get completely rid of this bug.

Whenever the user is opening a window or closing a window, i'm getting
following exception.

This is a very rare exception but it causes the whole application
crash
and has become a nigtmare for me.

This problem is more frequent on Citrix client as compared to normal
desktop environment.

InnnerException: Invalid parameter used.

Stack Trace: at System.Drawing.Region.GetHrgn(Graphics g)
at System.Windows.Forms.Control.GetHRgn(Region region)
at System.Windows.Forms.Control.OnHandleCreated(Event Args e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
Source: System.Drawing

I have done following coding in a control which is derived from
System.Windows.Forms.Button

protected override void OnPaint(PaintEventArgs e)
{
if(this != null)
{
if(!this.IsDisposed && !this.Disposing)
{
using(GraphicsPath path = new
GraphicsPath(FillMode.Alternate))
{
path.AddEllipse(0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Clone())
{
ctrl.Region=rgn.Clone();
}
}

}
}
}
This is just a guess but throw in a check that this.Width and this.Height
are both not zero.

PS

Jan 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
8
by: Owen Jenkins | last post by:
Hello. For years I've been using the DBEngine.CompactDatabase code to make backups of backend databases. But now I've struck a baffling problem where I get an Invalid Argument error. This...
0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
3
by: halise | last post by:
Hi, i am in trouble with an exception in .net platform with c#. The exception thrown is exactly as follows: System.ArgumentException: Invalid parameter used. at...
0
by: David Veeneman | last post by:
This post is for the Google archive and does not require a reply. I received an 'Invalid parameter used' error when trying to do double-buffering with the .Net SetStyles method. I used this code...
1
by: Hifni Shahzard | last post by:
Hi, I got a stored procedure, where it returns a value. But if I execute it. It gives an error as "Invalid cast from System.Int32 to System.Byte.". To make clear how do I execute this, below I'm...
3
by: Arnold | last post by:
I am having problem loading the image from the database. It gives this error: "Invalid parameter used." This is my source code: Private abyt() As Byte Private fo As New OpenFileDialog Private sf...
9
by: Tom John | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New...
4
by: escristian | last post by:
Hello. I'm trying to create an Image so I use something like this: Image newImage = Image.FromFile(filename); Now when it's a bmp file and certain .gif files it gives me an exception that...
0
by: jaffar | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.