473,804 Members | 4,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.G etHRgn(Region region)
at System.Windows. Forms.Control.O nHandleCreated( EventArgs e)
at System.Windows. Forms.Control.W mCreate(Message & m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr 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(PaintEv entArgs e)
{
if(this != null)
{
if(!this.IsDisp osed && !this.Disposing )
{
using(GraphicsP ath path = new
GraphicsPath(Fi llMode.Alternat e))
{
path.AddEllipse (0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Cl one())
{
ctrl.Region=rgn .Clone();
}
}

}
}
}

I'll appriciate if you can provide some help.

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

microsoft.publi c.dotnet.framew ork
microsoft.publi c.dotnet.genera l
microsoft.publi c.dotnet.langua ges.csharp
microsoft.publi c.dotnet.langua ges.vb

but not to

microsoft.publi c.dotnet.framew ork.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.goo glegroups.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.G etHRgn(Region region)
at System.Windows. Forms.Control.O nHandleCreated( EventArgs e)
at System.Windows. Forms.Control.W mCreate(Message & m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr 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(PaintEv entArgs e)
{
if(this != null)
{
if(!this.IsDisp osed && !this.Disposing )
{
using(GraphicsP ath path = new
GraphicsPath(Fi llMode.Alternat e))
{
path.AddEllipse (0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Cl one())
{
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.goo glegroups.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.G etHRgn(Region region)
at System.Windows. Forms.Control.O nHandleCreated( EventArgs e)
at System.Windows. Forms.Control.W mCreate(Message & m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr 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(PaintEv entArgs e)
{
if(this != null)
{
if(!this.IsDisp osed && !this.Disposing )
{
using(GraphicsP ath path = new
GraphicsPath(Fi llMode.Alternat e))
{
path.AddEllipse (0, 0, this.Width, this.Height);
using(Region rgn = new Region(path).Cl one())
{
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
1966
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 Basic .Net application. I have researched MSDN for help and found the example article 321900 (see below) and set up a test and everything works fine when I use SQL Server 2000 but when I modify the code and use data from Access 2000 using an...
8
3377
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 happens on an XPHome machine with both A97 and A2000 installed. I simplified the code and the error still occurs. In the following new test database containing only this procedure, dbSource refers to a brand new database with no objects which is...
0
3610
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 into byte from a stream. Exception (System.ArgumentException: Invalid parameter used) occurs when reading from byte over a memory-stream back to the Bitmap object. Please help, I'm really stuck here! Here's the code I use (Sorry for a long...
3
9392
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 System.Drawing.Bitmap.SetPixel(Int32 x, Int32 y, Color color) at binaryData2Image.Form1.button_Click(Object sender, EventArgs e) in c:\documents and settings\..\my documents\visual studio
0
1822
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 in the constructor of my UserControl to implement double buffering: // Enable double buffering this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint,
1
4911
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 specifiying my code: The Code used in Visual Studio: Function GetRank(ByVal ID As Integer, ByVal Comp As String, ByVal Sec As String, ByVal iDate As Date) As String 'Dim Ret As Integer
3
2592
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 As New SaveFileDialog Dim strCn As String = "Data Source=DATABASE\BARCA;" & _ "Initial Catalog=MIS;Integrated Security=SSPI" Dim cn As SqlConnection = New SqlConnection(strCn) Dim fs As IO.FileStream
9
8789
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 OleDbCommand("ImageBlobUpdate", dataConnection) Command.CommandType = CommandType.StoredProcedure)
4
3061
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 says: "Invalid parameter used". The gif an bmp files are valid image files, I can open them in any graphics software and windows can do the preview.
0
943
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 OleDbCommand("ImageBlobUpdate", dataConnection) Command.CommandType = CommandType.StoredProcedure)
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.