private void UpdateView() { _dontSave = true; DisplayNameTextBox.Text = _skill.DisplayName; ToolTipTextBox.Text = _skill.ToolTip; UseMessageTextBox.Text = _skill.UseMessage; LevelReqNnumericUpDown.Value = _skill.LevelRequired; CooldownNumericUpDown.Value = _skill.Cooldown; ManaCostNumericUpDown.Value = _skill.ManaCost; RangeNumericUpDown.Value = _skill.Range; DurationNumericUpDown.Value = _skill.Duration; IsUnlockedCheckBox.Checked = _skill.IsUnlocked; if (_skill.ImageName == null || _skill.ImageName == "") { ImagePictureBox.Hide(); } else { ImagePictureBox.Image = Utils.ImageHandler.Base64ToImage(_skill.ImageName); ImagePictureBox.Show(); } _dontSave = false; }
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); } } }
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(); }
} // /// <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 { // ... } }
public CurvesWF() { InitializeComponent(); imageBuilder = ImagePictureBox.CreateGraphics(); imageWidth = ImagePictureBox.Width / 2; imageHeight = ImagePictureBox.Height / 2; imageBuilder.TranslateTransform(imageWidth, imageHeight); Curve[] curveList = new Curve[] { new Parabola(1F, imageWidth), new Hyperbola(1F, 1F, imageWidth), new Ellipse(1F, 1F, imageWidth) }; CurvesList.Items.AddRange(curveList); }
} // /// <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"; } }