Click here to Skip to main content
15,892,697 members
Home / Discussions / C#
   

C#

 
GeneralRe: Something with a delegate Pin
Joramq28-Apr-09 0:17
Joramq28-Apr-09 0:17 
GeneralRe: Something with a delegate Pin
Tom Deketelaere28-Apr-09 1:20
professionalTom Deketelaere28-Apr-09 1:20 
GeneralRe: Something with a delegate Pin
N a v a n e e t h28-Apr-09 1:59
N a v a n e e t h28-Apr-09 1:59 
AnswerRe: Something with a delegate Pin
Luc Pattyn28-Apr-09 1:17
sitebuilderLuc Pattyn28-Apr-09 1:17 
GeneralRe: Something with a delegate Pin
Joramq28-Apr-09 2:03
Joramq28-Apr-09 2:03 
Questionhow can i send mail to all the members at a once...database contains the user details and email addresses........ Pin
jiya131127-Apr-09 21:10
jiya131127-Apr-09 21:10 
AnswerRe: how can i send mail to all the members at a once...database contains the user details and email addresses........ Pin
dotnetmember27-Apr-09 21:26
dotnetmember27-Apr-09 21:26 
QuestionImage to bitmap conversion error...again! Pin
sebogawa27-Apr-09 21:02
sebogawa27-Apr-09 21:02 
I have the following two functions:

private void freezeFrame_MouseClick(object sender, MouseEventArgs e)
   {


       txtMouseX.Text = e.X.ToString();
       txtMouseY.Text = e.Y.ToString();

       getPixel();



   }



   private void getPixel()
   {
       int rangeLimit = 20;
       int mouseX = int.Parse(txtMouseX.Text);
       int mouseY = int.Parse(txtMouseY.Text);
       Bitmap refBitmap = null;
       System.Drawing.Image refImage = null;
       refImage = freezeFrame.Image;
       refBitmap = new Bitmap(refImage);

       Color currentPixel = (refBitmap.GetPixel(mouseX, mouseY));

       curPixelRed.Text = currentPixel.R.ToString();
       curPixelGreen.Text = currentPixel.G.ToString();
       curPixelBlue.Text = currentPixel.B.ToString();

       redMinUpDown.Value = currentPixel.R - rangeLimit;
       redMaxUpDown.Value = currentPixel.R + rangeLimit;

       greenMinUpDown.Value = currentPixel.G - rangeLimit;
       greenMaxUpDown.Value = currentPixel.G + rangeLimit;

       blueMinUpDown.Value = currentPixel.B - rangeLimit;
       blueMaxUpDown.Value = currentPixel.B + rangeLimit;

   }



when i run the code, and click on the picturebox i get the following error "ArgumentException was unhandeled" with the statement "Parameter is not valid" for the line refBitmap = new Bitmap(refImage). I tried changing up the way i declare the refImage and refBitmap as suggested by people on my previous question and nothing works. What should I do?

When I debug, the Locals are as follows:

rangeLimit = 20
mouseX = 70 (red)
mouseY = 91 (red)
reBitmap = null
refImage = {System.Drawing.Bitmap}
currentPixel = "{Name=0, ARGB=(0,0,0,0)}"

Is there a direct way to convert a System.Drawing.Image to System.Drawing.Bitmap? I tried what someone else instructed me to do and I keep getting the same error and if I ask this question again, people just bash me on the fact that the code is low quality or other non-constructive criticism. All i need is to figure out what is wrong with my code, not a lecture on why i suck as a programmer. We all start somewhere and we all make mistakes but I digress. Can anyone help me solve this dilemma?
AnswerRe: Image to bitmap conversion error...again! Pin
stancrm27-Apr-09 21:24
stancrm27-Apr-09 21:24 
GeneralRe: Image to bitmap conversion error...again! Pin
Christian Graus27-Apr-09 22:08
protectorChristian Graus27-Apr-09 22:08 
AnswerRe: Image to bitmap conversion error...again! Pin
Christian Graus27-Apr-09 22:09
protectorChristian Graus27-Apr-09 22:09 
AnswerRe: Image to bitmap conversion error...again! Pin
Henry Minute28-Apr-09 0:56
Henry Minute28-Apr-09 0:56 
QuestionVersion of Confog File Pin
Chapooki27-Apr-09 20:45
Chapooki27-Apr-09 20:45 
AnswerRe: Version of Confog File Pin
12Code27-Apr-09 20:57
12Code27-Apr-09 20:57 
GeneralRe: Version of Confog File Pin
Chapooki27-Apr-09 21:00
Chapooki27-Apr-09 21:00 
QuestionNot all path return a value? Pin
Megidolaon27-Apr-09 20:43
Megidolaon27-Apr-09 20:43 
AnswerRe: Not all path return a value? Pin
12Code27-Apr-09 20:48
12Code27-Apr-09 20:48 
GeneralRe: Not all path return a value? Pin
Megidolaon27-Apr-09 21:52
Megidolaon27-Apr-09 21:52 
AnswerRe: Not all path return a value? Pin
Murugesan G27-Apr-09 20:48
Murugesan G27-Apr-09 20:48 
GeneralRe: Not all path return a value? Pin
Megidolaon27-Apr-09 21:54
Megidolaon27-Apr-09 21:54 
AnswerRe: Not all path return a value? Pin
Spunky Coder27-Apr-09 22:27
Spunky Coder27-Apr-09 22:27 
GeneralRe: Not all path return a value? Pin
Megidolaon28-Apr-09 20:45
Megidolaon28-Apr-09 20:45 
QuestionI need some information on enabling-disabling a software (registration-activation) Pin
Roshanakak27-Apr-09 20:38
Roshanakak27-Apr-09 20:38 
AnswerRe: I need some information on enabling-disabling a software (registration-activation) Pin
Nagy Vilmos27-Apr-09 22:01
professionalNagy Vilmos27-Apr-09 22:01 
GeneralRe: I need some information on enabling-disabling a software (registration-activation) Pin
Roshanakak28-Apr-09 0:03
Roshanakak28-Apr-09 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.