473,657 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

system.drawing. dll - Invalid parameter used

I have Panel embedded in a Form. The panel has a PaintEventHandl er to
catch PaintEvents. When a PaintEvent occurs a new Thread which moves a
Ellipse should be created.

The Code:

private void pnlTest_Paint(o bject sender, System.Windows. Forms
PaintEventArgs e)
{
if(.....)
{
this.graphics = e.Graphics;
Thread t = new Thread( new ThreadStart(thi s.draw) );
t.Start();//throws Exception
}
}
private void draw()
{
this.graphics.F illEllipse( new SolidBrush(Colo r.Red),10,10,30 ,30);
//should move the Ellipse later
}

When running the Application I get the following Error Message:

An unhandled exception of type 'System.Argumen tException' occurred in
system.drawing. dll
Additional information: Invalid parameter used.

When I call the draw Method directly without creating a Thread it
works fine.

private void pnlTest_Paint(o bject sender, System.Windows. Forms
PaintEventArgs e)
{
if(.....)
{
this.graphics = e.Graphics;
this.draw();//works fine
}
}
Any Ideas?

Thanks
Nov 15 '05 #1
0 1617

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

Similar topics

0
3596
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...
2
13459
by: Josema | last post by:
Hi, I get from database a field of type binary (its a gif image) into byte until here no problem, cause i veryfied that the binary its stored into the byte variable (called arrayb in my application). Im trying show into Internet explorer this byte (arrayb its the name of the variable) this way: 1) MemoryStream imgStream=new MemoryStream(arrayb,0,arrayb.Length, false,
0
1172
by: test | last post by:
Hi, I have the following method: private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e) { string tmpPath = e.FullPath; tmpPath = tmpPath.Replace("\\", "\\\\"); Bitmap testtest = new Bitmap(tmpPath);
1
4876
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
2
5954
by: Tyler Foreman | last post by:
Hello, I had an earlier post regarding a strange exception I (thought) I was getting in my windows form. I have since been able to trace the problem to a picturebox control on my form. I can reproduce the exception consistently, but it seems to be timing dependent. Here is what happens: I have a subform that I open, load an image from a file into my PictureBox, take some user input, then I hide the
1
8144
by: Mchuck | last post by:
I've seen several newsgroup topics everywhere concerning this, as well as a couple of articles from the MSDN website, but this error still baffles me. It has to do with using the Image.FromStream(...) function to load an image into a PictureBox control from a byte array received from an SQL Server database. Here's a snippet of what I've been trying to achieve: ----------------------------
2
2087
by: Kyjan | last post by:
Greetings to all! I was wondering if anyone had ever seen this error before: Exception message: Invalid parameter used. (source='System.Drawing', method='GetHeight') Portion of the stack trace: System.Drawing.Font.GetHeight(Graphics graphics) at System.Drawing.Font.GetHeight()
4
3639
by: Darrel | last post by:
I'm grabbing a file from a file upload form field. This is a 'system.web.httppostedfile' I would like to modify the image (Cropping/scaling) using system.drawing.image. Is there anyway to go from 'system.web.httppostedfile' directly to 'system.drawing.image'? Normally, I'd grab the System.Drawing.Image from a file itself:
2
3269
by: ouzsharp | last post by:
The follwing class works well when used in a C# console application: namespace ScreenShotDemo { /// <summary> /// Provides functions to capture the entire screen, or a particular window, and save it to a file. /// </summary> public class ScreenCapture {
0
8394
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
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
8605
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...
1
6164
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
5632
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
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.