473,387 Members | 3,684 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,387 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 1410
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**********************@h3g2000cwc.googlegro ups.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
"JayvardhanPune" <ja**************@tietoenator.inschrieb:
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 am wondering why you are cloing regions here. Why not just write:

\\\
using (Region r = ctrl.Region)
ctrl.Region = new Region(path);
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
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...
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...
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...
10
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...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.