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

C#

 
AnswerRe: Help with PictureBox.image updating from Webcam capture Pin
shutupsquare16-Jan-10 10:08
shutupsquare16-Jan-10 10:08 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
Luc Pattyn16-Jan-10 11:05
sitebuilderLuc Pattyn16-Jan-10 11:05 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
shutupsquare16-Jan-10 12:56
shutupsquare16-Jan-10 12:56 
GeneralRe: Help with PictureBox.image updating from Webcam capture Pin
Luc Pattyn16-Jan-10 13:03
sitebuilderLuc Pattyn16-Jan-10 13:03 
Questionencapsulation understanding problems Pin
binn01916-Jan-10 6:41
binn01916-Jan-10 6:41 
AnswerRe: encapsulation understanding problems Pin
Jimmanuel16-Jan-10 7:11
Jimmanuel16-Jan-10 7:11 
GeneralRe: encapsulation understanding problems Pin
binn01924-Jan-10 0:02
binn01924-Jan-10 0:02 
QuestionNeed help with drawing circles on mouse click event in pictureBox Pin
Midex16-Jan-10 5:49
Midex16-Jan-10 5:49 
Hello,

i am creating a software, which loads image(fingerprint) in picture box after i want to draw circles on the picturebox on the place i have clicked mouse. I created events on pictureBox1 MouseDown(for clicking) and Paint(for drawing). When i load my form and click on pictureBox1 nothing happens, no circles are drawn, BUT after i load image in pictureBox1 all the circles that should have been drawn before appear on picturebox with loaded image. If i click on picturebox after loading image nothing gets drawn and only if re-load image new circles appear. What am i doing wrong?

Thanks for answer

here is my code and screenshot:


Screenshot[^]

namespace fingerprint_test_v04
{
public partial class Form1 : Form
{
private ArrayList myPts = new ArrayList();
private Bitmap img = null;

public Form1()
{
InitializeComponent();
//CenterToScreen();
this.Text = "FingerprintzzzZZzzZZzzz";

}

public void MyPaintHandler(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
}


private void openFPR2ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox2.Image = img;
img = new Bitmap(open.FileName);
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}

private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = img;
img = new Bitmap(open.FileName);
angle.Enabled = true;
angle_ValueChanged(null, EventArgs.Empty);
}
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}

private void angle_ValueChanged(object sender, System.EventArgs e)
{
if (angle.Value > 359.9m)
{
angle.Value = 0;
return;
}

if (angle.Value < 0.0m)
{
angle.Value = 359;
return;
}

Image oldImage = pictureBox1.Image;
pictureBox1.Image = Program.RotateImage(img, (float)angle.Value);

if (oldImage != null)
{
oldImage.Dispose();
}
}

private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Paint += new PaintEventHandler(this.pictureBox1_Paint);
this.Controls.Add(pictureBox1);

}


private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
Graphics g = Graphics.FromHwnd(this.Handle);
myPts.Add(new Point(e.X, e.Y));
Invalidate(); 
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
foreach (Point p in myPts)
g.DrawEllipse(new Pen(Color.Red, 3), p.X, p.Y, 10, 10);
}

}

}
AnswerRe: Need help with drawing circles on mouse click event in pictureBox Pin
Luc Pattyn16-Jan-10 6:13
sitebuilderLuc Pattyn16-Jan-10 6:13 
AnswerRe: Need help with drawing circles on mouse click event in pictureBox Pin
Dan Mos16-Jan-10 7:53
Dan Mos16-Jan-10 7:53 
QuestionBackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 4:06
Mohammad Dayyan16-Jan-10 4:06 
AnswerRe: BackgroundWorker with anonymous methods ? Pin
Nicholas Butler16-Jan-10 4:59
sitebuilderNicholas Butler16-Jan-10 4:59 
GeneralRe: BackgroundWorker with anonymous methods ? Pin
Mohammad Dayyan16-Jan-10 6:58
Mohammad Dayyan16-Jan-10 6:58 
QuestionHolding data in memory Pin
Bardy8516-Jan-10 0:22
Bardy8516-Jan-10 0:22 
AnswerRe: Holding data in memory Pin
OriginalGriff16-Jan-10 1:01
mveOriginalGriff16-Jan-10 1:01 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 1:16
Bardy8516-Jan-10 1:16 
GeneralRe: Holding data in memory Pin
N a v a n e e t h16-Jan-10 6:05
N a v a n e e t h16-Jan-10 6:05 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 7:21
Dan Mos16-Jan-10 7:21 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:21
Bardy8516-Jan-10 9:21 
GeneralRe: Holding data in memory Pin
Luc Pattyn16-Jan-10 10:05
sitebuilderLuc Pattyn16-Jan-10 10:05 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 10:56
Bardy8516-Jan-10 10:56 
GeneralRe: Holding data in memory [modified] Pin
Dan Mos16-Jan-10 11:01
Dan Mos16-Jan-10 11:01 
GeneralRe: Holding data in memory Pin
Bardy8516-Jan-10 9:28
Bardy8516-Jan-10 9:28 
GeneralRe: Holding data in memory Pin
Dan Mos16-Jan-10 10:48
Dan Mos16-Jan-10 10:48 
QuestionSystem.Drawing.Graphics Problem Pin
logicon15-Jan-10 23:17
logicon15-Jan-10 23:17 

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.