private void btnImageBrowse_Click(object sender, EventArgs e) { string path = FileDialog.ShowOpen(FileDialog.Context.Image); if (!string.IsNullOrEmpty(path)) { ChangeImage(path); } }
private void btnOpen_Click(object sender, EventArgs e) { string filename = FileDialog.ShowOpen(FileDialog.Context.Document); if (string.IsNullOrEmpty(filename)) { return; } Globals.Root.OpenFile(filename); if (Globals.Root.CurrentDocument != null) // triggers may be Null if it was a SAW6 document and the user rejected it after warnings { Globals.Root.ShowEditScreen(Globals.Root.CurrentDocument); } }
private void btnSoundBrowse_Click(object sender, EventArgs e) { string path = FileDialog.ShowOpen(FileDialog.Context.Sound); if (string.IsNullOrEmpty(path)) { return; } SharedResource sound = (SharedResource)Globals.Root.CurrentDocument.AddSharedResourceFromFile(path, m_Transaction, false); m_Scriptables.First().Sound = new SharedReference <SharedResource>(sound); pnlGraphic.Invalidate(); ReflectSoundButtons(); Updated(); }
public void btnChangeActivityIcon_Click(object sender, EventArgs e) { string filename = FileDialog.ShowOpen(FileDialog.Context.Image); if (string.IsNullOrEmpty(filename)) { return; } m_Image = new MemoryImage(filename); m_Image.ChangeToBitmap(new Size(144, 144)); pnlPreviewActivityIcon.Image = m_Image.GetNetImage(); EnableOK(); Globals.OnAvailableActivitiesChanged(); // We should also raise this if the text changes; but that's more complicated if we don't want to raise numerous events, and I'm not sure it's worth the effort }
public void btnOK_Click(object sender, EventArgs e) { if (rdoOther.Checked) { string file = FileDialog.ShowOpen(FileDialog.Context.BackgroundDocument); if (string.IsNullOrEmpty(file)) { return; } m_OtherFile = file; DialogResult = DialogResult.OK; } else { DialogResult = DialogResult.OK; } }
public void btnLoad_Click(object sender, EventArgs e) { string filename = FileDialog.ShowOpen(FileDialog.Context.Image, "[Filter_Image1]"); if (string.IsNullOrEmpty(filename)) { return; } Transaction transaction = new Transaction(); SharedImage texture = (SharedImage)m_Document.AddSharedResourceFromFile(filename, transaction); Globals.Root.StoreNewTransaction(transaction); if (texture != null) { m_Chosen = texture; this.DialogResult = DialogResult.OK; } }
public void btnImageDisc_Click(object sender, EventArgs e) { string filename = FileDialog.ShowOpen(FileDialog.Context.Image); if (string.IsNullOrEmpty(filename)) { return; } try { m_NewImage = (SharedImage)Globals.Root.CurrentDocument.AddSharedResourceFromFile(filename, m_Transaction); ImageChanged(); chkDisplayFromAction.Checked = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void btnAddImage_Click(object sender, EventArgs e) { string filename = FileDialog.ShowOpen(FileDialog.Context.Image); if (string.IsNullOrEmpty(filename)) { return; } try { if (m_Style.CustomImage[(int)State] == null) { m_Style.CustomImage[(int)State] = new ScalableImage(); } Img.AddImageFromDisc(filename); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } m_ImageIndex = Img.Images.Count - 1; DisplayImageIndex(); }
public void lnkBackgroundImage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { // Alternate filter used; non-bitmaps may not work (especially if tiling) string filename = FileDialog.ShowOpen(FileDialog.Context.Image, "[Filter_Image1]"); if (string.IsNullOrEmpty(filename)) { return; } m_Page.BackgroundImage = (SharedImage)Globals.Root.CurrentDocument.AddSharedResourceFromFile(filename, m_Transaction); if (m_Page.BackgroundImage != null) // just in case { SizeF imageSize = m_Page.BackgroundImage.GetSize(64); // small size provided here means a resource (!?!) doesn't trigger if (imageSize.Width > 100 && imageSize.Height > 100 && Globals.Root.CurrentDocument.Count == 1) { // This is only done if the document has a single page. if (GUIUtilities.QuestionBox(Strings.Item("Paper_MatchImageSize"), MessageBoxButtons.YesNo) == DialogResult.Yes) { SetSizeToMatchImage(); } } } ReflectPaper(); }