Click here to Skip to main content
15,890,123 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: web site interaction Pin
Bernhard Hiller15-Oct-13 21:13
Bernhard Hiller15-Oct-13 21:13 
QuestionIn Console Application design table with background column dynamically Pin
karthikchinnu15-Oct-13 7:20
karthikchinnu15-Oct-13 7:20 
SuggestionRe: In Console Application design table with background column dynamically Pin
Richard MacCutchan15-Oct-13 21:35
mveRichard MacCutchan15-Oct-13 21:35 
QuestionAnyone work with AutoCad files? Pin
SledgeHammer0115-Oct-13 4:47
SledgeHammer0115-Oct-13 4:47 
AnswerRe: Anyone work with AutoCad files? Pin
Eddy Vluggen15-Oct-13 5:02
professionalEddy Vluggen15-Oct-13 5:02 
GeneralRe: Anyone work with AutoCad files? Pin
SledgeHammer0115-Oct-13 5:19
SledgeHammer0115-Oct-13 5:19 
QuestionRe: Anyone work with AutoCad files? Pin
Eddy Vluggen15-Oct-13 7:00
professionalEddy Vluggen15-Oct-13 7:00 
AnswerRe: Anyone work with AutoCad files? Pin
TnTinMn15-Oct-13 18:24
TnTinMn15-Oct-13 18:24 
AnswerRe: Anyone work with AutoCad files? Pin
Kenneth Haugland16-Oct-13 2:36
mvaKenneth Haugland16-Oct-13 2:36 
QuestionRead static values in a .dbml page Pin
vkEE15-Oct-13 4:31
vkEE15-Oct-13 4:31 
AnswerRe: Read static values in a .dbml page Pin
Eddy Vluggen15-Oct-13 4:58
professionalEddy Vluggen15-Oct-13 4:58 
GeneralRe: Read static values in a .dbml page Pin
vkEE15-Oct-13 5:17
vkEE15-Oct-13 5:17 
QuestionRe: Read static values in a .dbml page Pin
Eddy Vluggen15-Oct-13 7:16
professionalEddy Vluggen15-Oct-13 7:16 

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.