Click here to Skip to main content
15,922,419 members
Home / Discussions / C#
   

C#

 
GeneralRe: Control from scratch ? Pin
_Q12_17-Oct-13 7:01
_Q12_17-Oct-13 7:01 
GeneralRe: Control from scratch ? Pin
Eddy Vluggen17-Oct-13 9:27
professionalEddy Vluggen17-Oct-13 9:27 
AnswerRe: Control from scratch ? Pin
Dave Kreskowiak17-Oct-13 1:15
mveDave Kreskowiak17-Oct-13 1:15 
AnswerRe: Control from scratch ? Pin
_Q12_17-Oct-13 9:25
_Q12_17-Oct-13 9:25 
QuestionHow To Read And Write OMRON PLC? Pin
Member 820069316-Oct-13 15:41
Member 820069316-Oct-13 15:41 
AnswerRe: How To Read And Write OMRON PLC? Pin
Richard Andrew x6416-Oct-13 16:37
professionalRichard Andrew x6416-Oct-13 16:37 
AnswerRe: How To Read And Write OMRON PLC? Pin
tiliga16-Oct-13 17:00
tiliga16-Oct-13 17:00 
GeneralRe: How To Read And Write OMRON PLC? Pin
Member 820069316-Oct-13 22:16
Member 820069316-Oct-13 22:16 
AnswerRe: How To Read And Write OMRON PLC? Pin
tiliga16-Oct-13 17:00
tiliga16-Oct-13 17:00 
GeneralRe: How To Read And Write OMRON PLC? Pin
Dave Kreskowiak17-Oct-13 1:17
mveDave Kreskowiak17-Oct-13 1:17 
AnswerRe: How To Read And Write OMRON PLC? Pin
w1dge2-Nov-13 11:46
w1dge2-Nov-13 11:46 
QuestionSorted Collection in C# Pin
Member 1033982916-Oct-13 4:34
Member 1033982916-Oct-13 4:34 
AnswerRe: Sorted Collection in C# Pin
Richard MacCutchan16-Oct-13 5:26
mveRichard MacCutchan16-Oct-13 5:26 
GeneralRe: Sorted Collection in C# Pin
Matt T Heffron16-Oct-13 8:45
professionalMatt T Heffron16-Oct-13 8:45 
AnswerRe: Sorted Collection in C# Pin
Eddy Vluggen16-Oct-13 11:15
professionalEddy Vluggen16-Oct-13 11:15 
AnswerRe: Sorted Collection in C# Pin
BillWoodruff16-Oct-13 15:45
professionalBillWoodruff16-Oct-13 15:45 
AnswerRe: Sorted Collection in C# Pin
NWPU_Tbeck16-Oct-13 17:04
NWPU_Tbeck16-Oct-13 17:04 
AnswerRe: Sorted Collection in C# Pin
Abhinav S16-Oct-13 18:22
Abhinav S16-Oct-13 18:22 
AnswerRe: Sorted Collection in C# Pin
Dinkar Tiwari16-Oct-13 21:25
Dinkar Tiwari16-Oct-13 21:25 
AnswerRe: Sorted Collection in C# Pin
Gabriel Szabo17-Oct-13 1:22
Gabriel Szabo17-Oct-13 1:22 
QuestionCapture image from USB 2.0 PC Camera using physical button in the camera Pin
Member 794843016-Oct-13 2:10
Member 794843016-Oct-13 2:10 
Hi all,

i am trying to develop a simple application to capture image from USB 2.0 PC camera by pressing the phyiscal button on the camera.
i tried the below code. please help me. in the below code need to press button on the windows application to capture image from usb camera where as i need to capture image from physical button present on the camera.

C#
 public Form1()
       {
           InitializeComponent();
           webcam = new FilterInfoCollection(FilterCategory.VideoInputDevice);
           foreach (FilterInfo VideoCaptureDevice in webcam)
           {
               comboBox1.Items.Add(VideoCaptureDevice.Name);

           }
           comboBox1.SelectedIndex = 1;


           cam = new VideoCaptureDevice(webcam[comboBox1.SelectedIndex].MonikerString);
           cam.NewFrame += new NewFrameEventHandler(cam_NewFrame);
           cam.Start();
       }

private FilterInfoCollection webcam;
       private VideoCaptureDevice cam;
       Bitmap bitmap;


 void cam_NewFrame(object sender, NewFrameEventArgs eventArgs)
       {
           bitmap = (Bitmap)eventArgs.Frame.Clone();

           pictureBox1.Image = bitmap;
       }

       private void pictureBox1_Click(object sender, EventArgs e)
       {
           pictureBox1.Image = bitmap;
       }

       private void button3_Click(object sender, EventArgs e)
       {
           if (cam.IsRunning)
           {
               cam.Stop();
           }
       }

       private void button2_Click(object sender, EventArgs e)
       {
           Bitmap current = (Bitmap)bitmap.Clone();
           string filepath = Environment.CurrentDirectory;
           string fileName = System.IO.Path.Combine(filepath, @"name.bmp");
           current.Save(fileName);
           current.Dispose();
       }

AnswerRe: Capture image from USB 2.0 PC Camera using physical button in the camera Pin
Eddy Vluggen16-Oct-13 11:19
professionalEddy Vluggen16-Oct-13 11:19 
GeneralRe: Capture image from USB 2.0 PC Camera using physical button in the camera Pin
Member 794843016-Oct-13 15:05
Member 794843016-Oct-13 15:05 
GeneralRe: Capture image from USB 2.0 PC Camera using physical button in the camera Pin
Dave Kreskowiak17-Oct-13 1:19
mveDave Kreskowiak17-Oct-13 1:19 
Questionweb site interaction Pin
Member 1032069915-Oct-13 10:35
Member 1032069915-Oct-13 10:35 

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.