Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
AnswerRe: Implementing WPF in a Visual C# project........ is it possible? Pin
Sibugathulla25-Apr-09 17:10
professionalSibugathulla25-Apr-09 17:10 
GeneralRe: Implementing WPF in a Visual C# project........ is it possible? Pin
Rajdeep.NET is BACK25-Apr-09 19:58
Rajdeep.NET is BACK25-Apr-09 19:58 
QuestionError in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 15:33
sebogawa25-Apr-09 15:33 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Sibugathulla25-Apr-09 17:19
professionalSibugathulla25-Apr-09 17:19 
QuestionRe: Error in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 21:00
sebogawa25-Apr-09 21:00 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Christian Graus25-Apr-09 22:57
protectorChristian Graus25-Apr-09 22:57 
GeneralRe: Error in declaring a bitmap as the .image of a picture box Pin
sebogawa25-Apr-09 23:03
sebogawa25-Apr-09 23:03 
AnswerRe: Error in declaring a bitmap as the .image of a picture box Pin
Luc Pattyn26-Apr-09 0:48
sitebuilderLuc Pattyn26-Apr-09 0:48 
Hi,

several comments:

1.

sebogawa wrote:
txtMouseX.Text = e.X.ToString();
int mouseX = int.Parse(txtMouseX.Text);


What a waste. You already have e.X as a number, why do you need to parse a string then. Just write
int mouseX = e.X;
txtMouseX.Text = mouseX.ToString();


2.
Bitmap refImage = new Bitmap(freezeFrame.Image);
You claim the problem is here, I doubt that. There are two ways this could fail:
a) freezeFrame.Image being null would result in a NullReferenceException
b) freezeFrame.Image being of some special ImageFormat (such as EMF) might cause problems, I'm not sure though.

3.
Color currentPixel = (refImage.GetPixel(mouseX, mouseY)); would throw an ArgumentOutOfRangeException when mouseX and/or mouseY fall outside the image.

4.
redMinUpDown.Value = currentPixel.R - rangeLimit; may cause problems since the lowest achievable value is negative (-rangeLimit). If Value is set outside [Minimum,Maximum] an ArgumentOutOfRangeException will be thrown.


Overall, your code is low-quality as it lacks a lot of checks.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


Question[Message Deleted] Pin
Mohamed Ibrahim Omar25-Apr-09 11:22
Mohamed Ibrahim Omar25-Apr-09 11:22 
AnswerRe: 4 bits Array Pin
Christian Graus25-Apr-09 11:26
protectorChristian Graus25-Apr-09 11:26 
GeneralRe: 4 bits Array Pin
Mohamed Ibrahim Omar25-Apr-09 12:05
Mohamed Ibrahim Omar25-Apr-09 12:05 
GeneralRe: 4 bits Array Pin
fly90425-Apr-09 12:37
fly90425-Apr-09 12:37 
GeneralRe: 4 bits Array Pin
Christian Graus25-Apr-09 13:23
protectorChristian Graus25-Apr-09 13:23 
GeneralRe: 4 bits Array [modified] Pin
Mohamed Ibrahim Omar25-Apr-09 12:10
Mohamed Ibrahim Omar25-Apr-09 12:10 
GeneralRe: 4 bits Array Pin
Christian Graus25-Apr-09 13:22
protectorChristian Graus25-Apr-09 13:22 
AnswerRe: 4 bits Array Pin
fly90425-Apr-09 12:33
fly90425-Apr-09 12:33 
AnswerRe: [Message Deleted] Pin
Christian Graus25-Apr-09 22:59
protectorChristian Graus25-Apr-09 22:59 
QuestionHow to handle null values when reading array Pin
onetreeup25-Apr-09 10:23
onetreeup25-Apr-09 10:23 
AnswerRe: How to handle null values when reading array Pin
Christian Graus25-Apr-09 11:27
protectorChristian Graus25-Apr-09 11:27 
GeneralRe: How to handle null values when reading array Pin
onetreeup25-Apr-09 12:47
onetreeup25-Apr-09 12:47 
GeneralRe: How to handle null values when reading array Pin
Christian Graus25-Apr-09 13:24
protectorChristian Graus25-Apr-09 13:24 
AnswerRe: How to handle null values when reading array Pin
Luc Pattyn25-Apr-09 13:08
sitebuilderLuc Pattyn25-Apr-09 13:08 
AnswerRe: How to handle null values when reading array Pin
Sibugathulla25-Apr-09 17:52
professionalSibugathulla25-Apr-09 17:52 
QuestionCannot read .xls file - microsoft jet database engine could not find the object error Pin
dariusUK25-Apr-09 10:15
dariusUK25-Apr-09 10:15 
AnswerRe: Cannot read .xls file - microsoft jet database engine could not find the object error Pin
Luc Pattyn25-Apr-09 10:29
sitebuilderLuc Pattyn25-Apr-09 10:29 

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.