Click here to Skip to main content
15,888,007 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating Screen Saver in C# Pin
Identity Undisclosed22-Jul-07 2:19
Identity Undisclosed22-Jul-07 2:19 
GeneralRe: Creating Screen Saver in C# Pin
Luc Pattyn22-Jul-07 2:31
sitebuilderLuc Pattyn22-Jul-07 2:31 
QuestionGridview with 2 lines Pin
dabuskol22-Jul-07 1:04
dabuskol22-Jul-07 1:04 
AnswerRe: Gridview with 2 lines Pin
Arun.Immanuel22-Jul-07 1:28
Arun.Immanuel22-Jul-07 1:28 
GeneralRe: Gridview with 2 lines Pin
dabuskol22-Jul-07 1:33
dabuskol22-Jul-07 1:33 
GeneralRe: Gridview with 2 lines Pin
Arun.Immanuel22-Jul-07 2:21
Arun.Immanuel22-Jul-07 2:21 
Questionassembly: AssemblyKeyFile not supported in VS2005? Pin
George_George22-Jul-07 0:50
George_George22-Jul-07 0:50 
QuestionRedraw in a pictureBox Pin
eskape1922-Jul-07 0:42
eskape1922-Jul-07 0:42 
I'm working on a Windows Forms project. It's an aplication on environment recognition. At some point I load an image in a

picuteBox and I have to determine, to "draw" the areas in that picture and then save them - I do this by extracting the x and

y mouse click coordinates and then by saving those pairs in a text file.

However, I do have a little problem...

When I minimize the window or when I put something on top of one of those regions, the part of the region that is covered

dissappears and then reappears with a delay (about 5-10 seconds) and only if I do somethig like a click or at least a mouse

movement, some kind of a refresh anyway.

Why is this happening? What am I doing wrong?
How can I repair this bug, or at least how can I shorten the delay?

I mention that the only suited event that I found for the invalidate action is the resize event! (I didn't find an event like

"object cover - object discover"...! that would have been better fit)

Here is the code for all this:

private void pictureBox1_Resize(object sender, EventArgs e)
{
Invalidate();
Update();
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if(zones != null)
drawZones(zones);
}

where the drawZones function is:

public void drawZones(Dictionary<string, list<string="">> zones)
{
foreach (KeyValuePair<string, list<string="">> vect in zones)
{
List<string> list = vect.Value as List<string>;
if (list == null)
throw new Exception("Mistake");
int i = 0;
foreach (string s in list)
{
Point pctP = convertStringToPoint(list[0]);
Point pctU = convertStringToPoint(list[list.Count - 1]);
Graphics gr = this.pictureBox1.CreateGraphics();
Pen pencil = new Pen(mLineColor, 1);
gr.DrawLine(pencil, pctP, pctU);
Point pctCurr = convertStringToPoint(s);
if (i != 0 && list.Count > 1)
{
Point pctBack = convertStringToPoint(list[list.IndexOf(s) - 1]);
gr.DrawLine(pencil, pctBack, pctCurr);
}
i++;
}
}
}

Good gives us the power of creating the future. Use this power with reason.

AnswerRe: Redraw in a pictureBox Pin
Luc Pattyn22-Jul-07 1:33
sitebuilderLuc Pattyn22-Jul-07 1:33 
QuestionDynamic textcolor change in RichTextBox in visual C# Pin
Blekk21-Jul-07 23:57
Blekk21-Jul-07 23:57 
AnswerRe: Dynamic textcolor change in RichTextBox in visual C# Pin
Luc Pattyn22-Jul-07 0:47
sitebuilderLuc Pattyn22-Jul-07 0:47 
GeneralRe: Dynamic textcolor change in RichTextBox in visual C# Pin
Blekk22-Jul-07 11:52
Blekk22-Jul-07 11:52 
GeneralRe: Dynamic textcolor change in RichTextBox in visual C# Pin
Luc Pattyn22-Jul-07 12:38
sitebuilderLuc Pattyn22-Jul-07 12:38 
GeneralRe: Dynamic textcolor change in RichTextBox in visual C# Pin
Blekk23-Jul-07 3:34
Blekk23-Jul-07 3:34 
GeneralRe: Dynamic textcolor change in RichTextBox in visual C# Pin
Luc Pattyn23-Jul-07 3:57
sitebuilderLuc Pattyn23-Jul-07 3:57 
QuestionCannot Load ResXFileCodeGenerator and SettingsSingleFileGenerator Pin
zoroyster21-Jul-07 23:49
zoroyster21-Jul-07 23:49 
QuestionMove the form without caption [modified] Pin
Maddie from Dartford21-Jul-07 23:15
Maddie from Dartford21-Jul-07 23:15 
AnswerRe: Move the form without caption Pin
mav.northwind22-Jul-07 5:09
mav.northwind22-Jul-07 5:09 
GeneralRe: Move the form without caption Pin
Maddie from Dartford22-Jul-07 17:54
Maddie from Dartford22-Jul-07 17:54 
GeneralRe: Move the form without caption Pin
mav.northwind22-Jul-07 19:11
mav.northwind22-Jul-07 19:11 
QuestionHow to use Dictionary? Pin
Nothend21-Jul-07 23:04
Nothend21-Jul-07 23:04 
AnswerRe: How to use Dictionary? Pin
mav.northwind21-Jul-07 23:13
mav.northwind21-Jul-07 23:13 
GeneralRe: How to use Dictionary? Pin
Nothend21-Jul-07 23:21
Nothend21-Jul-07 23:21 
GeneralRe: How to use Dictionary? Pin
Larantz22-Jul-07 0:11
Larantz22-Jul-07 0:11 
GeneralRe: How to use Dictionary? Pin
Nothend22-Jul-07 0:21
Nothend22-Jul-07 0:21 

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.