Click here to Skip to main content
15,905,316 members
Home / Discussions / C#
   

C#

 
QuestionThe number of page of a Word file Pin
abbd10-Feb-09 23:13
abbd10-Feb-09 23:13 
GeneralFramework analysis of SNC [modified] Pin
yolanda040910-Feb-09 23:00
yolanda040910-Feb-09 23:00 
RantRe: Framework analysis of SNC Pin
Ashfield11-Feb-09 1:28
Ashfield11-Feb-09 1:28 
Questionfinding pdfs in a computer Pin
DrawWindow10-Feb-09 22:51
DrawWindow10-Feb-09 22:51 
AnswerRe: finding pdfs in a computer Pin
Giorgi Dalakishvili10-Feb-09 22:57
mentorGiorgi Dalakishvili10-Feb-09 22:57 
GeneralRe: finding pdfs in a computer Pin
DrawWindow10-Feb-09 23:04
DrawWindow10-Feb-09 23:04 
QuestionFind color in specific area of screen Pin
Kristian Sixhøj10-Feb-09 22:35
Kristian Sixhøj10-Feb-09 22:35 
AnswerRe: Find color in specific area of screen Pin
SeMartens10-Feb-09 22:44
SeMartens10-Feb-09 22:44 
Hi,

as I can see it, the simplest solution is to use a flag, whether the value was found or not:

bool bFound = false;

while ((!bFound) && (x <= x2 && y <= y2))
{
    while ((!bFound) && (x <= x2))
    {
        Color c = Win32.GetPixelColor(x, y);
        if (c.R == 128 && c.G == 128 && c.B == 128)
        {
            //Console.WriteLine("Color found at {0},{1}", x, y);
            // I want to break out of the loop here, but didn't
            // work with the break keyword.
            bFound = true;
        }

        if(!bFound)
          x++;
     }
     
     if(!bFound) {
        x = 0;
        y++;
     }
}


Better way would be to put this while thing into method and call return when you found the Color.

Regards
Sebastian

It's not a bug, it's a feature!

Check out my CodeProject article Permission-by-aspect.

Me in Softwareland.

GeneralRe: Find color in specific area of screen Pin
Kristian Sixhøj10-Feb-09 23:13
Kristian Sixhøj10-Feb-09 23:13 
AnswerRe: Find color in specific area of screen Pin
musefan10-Feb-09 23:09
musefan10-Feb-09 23:09 
GeneralRe: Find color in specific area of screen Pin
Kristian Sixhøj10-Feb-09 23:13
Kristian Sixhøj10-Feb-09 23:13 
QuestionHow to retrive datatables From Database [modified] Pin
lavankumar10-Feb-09 22:10
lavankumar10-Feb-09 22:10 
AnswerRe: How to retrive datatables From Database Pin
Rob Philpott10-Feb-09 22:28
Rob Philpott10-Feb-09 22:28 
Questioncomparing two datetimepickers Pin
Deresen10-Feb-09 21:59
Deresen10-Feb-09 21:59 
QuestionGetting an Image via web cam using C# Pin
thite_nilesh10-Feb-09 21:49
thite_nilesh10-Feb-09 21:49 
Questionprogressbar further Issue Pin
MumbleB10-Feb-09 21:28
MumbleB10-Feb-09 21:28 
AnswerRe: progressbar further Issue Pin
ABitSmart10-Feb-09 21:57
ABitSmart10-Feb-09 21:57 
GeneralRe: progressbar further Issue Pin
MumbleB11-Feb-09 0:36
MumbleB11-Feb-09 0:36 
GeneralRe: progressbar further Issue Pin
MumbleB11-Feb-09 0:49
MumbleB11-Feb-09 0:49 
GeneralRe: progressbar further Issue Pin
ABitSmart11-Feb-09 1:18
ABitSmart11-Feb-09 1:18 
AnswerRe: progressbar further Issue Pin
Luc Pattyn11-Feb-09 0:36
sitebuilderLuc Pattyn11-Feb-09 0:36 
GeneralRe: progressbar further Issue Pin
MumbleB11-Feb-09 0:52
MumbleB11-Feb-09 0:52 
AnswerRe: progressbar further Issue Pin
Luc Pattyn11-Feb-09 1:02
sitebuilderLuc Pattyn11-Feb-09 1:02 
GeneralRe: progressbar further Issue Pin
MumbleB11-Feb-09 1:06
MumbleB11-Feb-09 1:06 
AnswerRe: progressbar further Issue Pin
Luc Pattyn11-Feb-09 1:42
sitebuilderLuc Pattyn11-Feb-09 1:42 

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.