mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Use form for ShowDialog
This commit is contained in:
parent
4f307fce28
commit
08579e83bd
5 changed files with 12 additions and 12 deletions
|
@ -1462,9 +1462,9 @@ public static Image TornEdges(Image img, int tornDepth, int tornRange, AnchorSty
|
|||
}
|
||||
}
|
||||
|
||||
public static string OpenImageFileDialog()
|
||||
public static string OpenImageFileDialog(Form form = null)
|
||||
{
|
||||
string[] images = OpenImageFileDialog(false);
|
||||
string[] images = OpenImageFileDialog(false, form);
|
||||
|
||||
if (images != null && images.Length > 0)
|
||||
{
|
||||
|
@ -1474,7 +1474,7 @@ public static string OpenImageFileDialog()
|
|||
return null;
|
||||
}
|
||||
|
||||
public static string[] OpenImageFileDialog(bool multiselect)
|
||||
public static string[] OpenImageFileDialog(bool multiselect, Form form = null)
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
|
@ -1483,7 +1483,7 @@ public static string[] OpenImageFileDialog(bool multiselect)
|
|||
|
||||
ofd.Multiselect = multiselect;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
if (ofd.ShowDialog(form) == DialogResult.OK)
|
||||
{
|
||||
return ofd.FileNames;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public EditorStartupForm(RegionCaptureOptions options)
|
|||
|
||||
private void btnOpenImageFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
string ImageFilePath = ImageHelpers.OpenImageFileDialog();
|
||||
string ImageFilePath = ImageHelpers.OpenImageFileDialog(this);
|
||||
|
||||
if (!string.IsNullOrEmpty(ImageFilePath) && File.Exists(ImageFilePath))
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ private void btnLoadImageFromClipboard_Click(object sender, EventArgs e)
|
|||
|
||||
private void btnCreateNewImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
Image = NewImageForm.CreateNewImage(Options);
|
||||
Image = NewImageForm.CreateNewImage(Options, this);
|
||||
|
||||
if (Image != null)
|
||||
{
|
||||
|
|
|
@ -55,11 +55,11 @@ public NewImageForm(RegionCaptureOptions options)
|
|||
btnChangeColor.Color = options.EditorNewImageBackgroundColor;
|
||||
}
|
||||
|
||||
public static Image CreateNewImage(RegionCaptureOptions options)
|
||||
public static Image CreateNewImage(RegionCaptureOptions options, Form form = null)
|
||||
{
|
||||
using (NewImageForm newImageForm = new NewImageForm(options))
|
||||
{
|
||||
if (newImageForm.ShowDialog() == DialogResult.OK)
|
||||
if (newImageForm.ShowDialog(form) == DialogResult.OK)
|
||||
{
|
||||
Color backgroundColor;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public bool OpenImageDialog(bool centerImage)
|
|||
{
|
||||
Manager.IsMoving = false;
|
||||
|
||||
string filepath = ImageHelpers.OpenImageFileDialog();
|
||||
string filepath = ImageHelpers.OpenImageFileDialog(Manager.Form);
|
||||
|
||||
if (!string.IsNullOrEmpty(filepath))
|
||||
{
|
||||
|
|
|
@ -1486,7 +1486,7 @@ public Image CropImage(Rectangle rect, bool onlyIfSizeDifferent = false)
|
|||
|
||||
public void NewImage()
|
||||
{
|
||||
Image img = NewImageForm.CreateNewImage(Options);
|
||||
Image img = NewImageForm.CreateNewImage(Options, Form);
|
||||
|
||||
if (img != null)
|
||||
{
|
||||
|
@ -1499,7 +1499,7 @@ public void NewImage()
|
|||
|
||||
private void OpenImageFile()
|
||||
{
|
||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
||||
string filePath = ImageHelpers.OpenImageFileDialog(Form);
|
||||
LoadImageFile(filePath);
|
||||
}
|
||||
|
||||
|
@ -1521,7 +1521,7 @@ private void LoadImageFile(string filePath)
|
|||
|
||||
private void InsertImage()
|
||||
{
|
||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
||||
string filePath = ImageHelpers.OpenImageFileDialog(Form);
|
||||
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue