Wednesday, June 16, 2010

csharp Drawing

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;

namespace paint1
{
public partial class Form1 : Form
{

Pen Pn;
Point Pt;
Graphics g;

Pen Pn2;
Point Pt2;
Graphics g2;

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Bitmap fImage = new Bitmap(pictureBox1.Image);
MemoryStream ms = new MemoryStream();
fImage.Save(ms, ImageFormat.Jpeg);
fImage.Save("C:\\CaptureVideo\\aa.Jpeg");
// fImage.Save("\\\\192.168.3.96\\CaptureVideo\\aa.Jpeg");
// byte[] bitmapData = ms.ToArray();



if (System.IO.File.Exists("C:\\cc.Jpeg"))
{
System.IO.File.Delete("C:\\cc.Jpeg");

File.Copy("C:\\CaptureVideo\\aa.Jpeg", "C:\\cc.Jpeg");


Image im = Image.FromFile("C:\\cc.Jpeg");
pictureBox2.Image = im;
button1.Enabled = false;

}





}

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
g.DrawLine(Pn, Pt.X, Pt.Y, e.X, e.Y);
pictureBox1.Refresh();
Pt = e.Location;
}
}

private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
Pt = e.Location;
}

private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Parent = this;
Pn = new Pen(Color.Black, 4);
Pn.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
g = Graphics.FromImage(pictureBox1.Image);
g.Clear(Color.White);



pictureBox2.Parent = this;
Pn2 = new Pen(Color.Black, 4);
Pn2.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
pictureBox2.Image = new Bitmap(pictureBox2.Width, pictureBox2.Height);
g2 = Graphics.FromImage(pictureBox2.Image);
g2.Clear(Color.White);
}

private void button2_Click(object sender, EventArgs e)
{
pictureBox1.Parent = this;
Pn = new Pen(Color.Black, 4);
Pn.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
g = Graphics.FromImage(pictureBox1.Image);
g.Clear(Color.White);



if (System.IO.File.Exists("C:\\cc.Jpeg"))
{
pictureBox2.Image.Dispose();
pictureBox2.Image = null;

pictureBox2.Parent = this;
Pn2 = new Pen(Color.Black, 4);
Pn2.SetLineCap(LineCap.Round, LineCap.Round, DashCap.Round);
pictureBox2.Image = new Bitmap(pictureBox2.Width, pictureBox2.Height);
g2 = Graphics.FromImage(pictureBox2.Image);
g2.Clear(Color.White);

button1.Enabled = true;
}

}


}
}

C#.net play VLC player

Write Button Click:


axVLCPlugin1.addTarget("C:\\hindi.mp4", null, AXVLC.VLCPlaylistMode.VLCPlayListReplace,0);

axVLCPlugin1.play();

Web Cam Capture:



axVLCPlugin1.addTarget("dshow://",new string[] { ":dshow-vdev=Logitech QuickCam Pro 9000", ":dshow-adev=\"\"", ":dshow-size=\"320x240\"" },AXVLC.VLCPlaylistMode.VLCPlayListAppendAndGo, -666);