Hi friends!
I have some problems with GUI in C#.Net ,Can anybody solve these?
First ,How can I save the image from the PictureBox to the Harddrive…. Is it wrong method or not for save the any image ? like as
//Save file
private void savebt_Click(object sender, System.EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
filename =saveFileDialog1.FileName;
Stream filestream =File.OpenWrite(filename);
using(StreamWriter fwriter= new StreamWriter(filestream))
{ fwriter.Write(PictureBox.Image);}
}
Second , I use the following codes for drawing into the pictureBox2 by Pen
private void pictureBox2_MouseDown(object sender, MouseEventArgs e)
Pen p = new Pen(Color.Red, 5);
g = pictureBox2.CreateGraphics();
if (e.Button == MouseButtons.Left)
{ g.DrawEllipse(p, e.X, e.Y, 5, 7); }
private void pictureBox2_MouseMove(object sender, MouseEventArgs e)
But there is a problem when I RUN the program and start the drawing if when I move the mouse fastly then such drawing break into small ellipse,I think you have understand
Third , I use follwing codes to draw the line into the pictureBox2 :
{ Pen p = new Pen(Color.Red, 5);
g.DrawEllipse(p, e.X, e.Y, 2, 2);
mx = e.X;
my = e.Y;
private void pictureBox2_MouseUp(object sender, MouseEventArgs e)
g.DrawLine(p, mx, my, e.X, e.Y);
But I confuse for that
???????????????????????????????
I want when I move the mouse arrow onto the pictureBox2 ,then the line move with respect to the mouse and not draw untill UP the mouse button.
I am waiting for your kindly response
Thanks