Exemplo n.º 1
0
        private void PatientDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewRow row = PatientDataGridView.Rows[e.RowIndex];

                PatientID             = Convert.ToInt32(row.Cells["Patient_ID"].Value);
                labelID.Text          = PatientID.ToString();
                NameTextBox.Text      = row.Cells["Name"].Value.ToString();
                AgeTextBox.Text       = row.Cells["Age"].Value.ToString();
                GenderComboBox.Text   = row.Cells["Gender"].Value.ToString();
                AddressTextBox.Text   = row.Cells["Address"].Value.ToString();
                ContactNoTextBox.Text = row.Cells["ContactNo"].Value.ToString();
                if ((row.Cells["DOB"].Value) == DBNull.Value)
                {
                    DOBDateTimePicker.Value = System.DateTime.Now;
                }
                else
                {
                    DOBDateTimePicker.Value = Convert.ToDateTime(row.Cells["DOB"].Value);
                }
                BloodGroupComboBox.Text = row.Cells["BloodGroup"].Value.ToString();
                HealthProbTextBox.Text  = row.Cells["HealthProblem"].Value.ToString();
                if ((row.Cells["image"].Value) == DBNull.Value)
                {
                    ImagePictureBox.Image = null;
                    ImagePictureBox.Invalidate();
                }
                else
                {
                    MemoryStream ms = new MemoryStream((byte[])PatientDataGridView.CurrentRow.Cells["Image"].Value);
                    ImagePictureBox.Image = Image.FromStream(ms);
                }
            }
        }
Exemplo n.º 2
0
 private void BlackWhiteButton_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < ImagePictureBox.Image.Width; i++)
     {
         for (int j = 0; j < ImagePictureBox.Image.Height; j++)
         {
             int c = ((ImagePictureBox.Image as Bitmap).GetPixel(i, j).R + (ImagePictureBox.Image as Bitmap).GetPixel(i, j).G + (ImagePictureBox.Image as Bitmap).GetPixel(i, j).B) / 3;
             (ImagePictureBox.Image as Bitmap).SetPixel(i, j, Color.FromArgb(c, c, c));
         }
     }
     ImagePictureBox.Invalidate();
     Cmyk.ResetImages();
     Cmyk.SetImage(ImagePictureBox.Image as Bitmap);
     RefreshCMYKPicture();
 }
Exemplo n.º 3
0
        }   //

        /// <summary>
        /// Refreshes the live image if Timer1 is active. Otherwise this function is ignored.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                // If Live and captured image has changed then update the window
                if (pxd.IsStreaming && LastCapturedField != PXD.pxd_capturedFieldCount(1))  // Double checks the live conditions
                {
                    LastCapturedField = PXD.pxd_capturedFieldCount(1);
                    ImagePictureBox.Invalidate();
                }
            }
            catch
            {
                // ...
            }
        }
Exemplo n.º 4
0
        }   //

        /// <summary>
        /// Captures a single image into frame buffer 1. Displays captured image if not live before button is hit.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Snap_Button_Click(object sender, System.EventArgs e)
        {
            try
            {
                vmb.StartAcquisition();

                if (pxd.IsStreaming)                // Pause live if needed
                {
                    pxd.StopStreaming();
                }
                else
                {
                    shutter.Open();
                }

                pxd.Snap();                         // Image capture
                ImagePictureBox.Invalidate();       // Display captured image.
                pxd.SaveStill(pxd.imageName);

                if (!pxd.IsStreaming)               // Resume live if needed
                {
                    shutter.Close();
                }
                else
                {
                    pxd.StartStreaming();
                }
            }
            catch (VimbaException ve)
            {
                promptBox.Text += $"{ve.Message}\n";
            }
            catch (Exception ex)
            {
                promptBox.Text += $"{ex.Message}\n";
            }
        }