using System;
using System.IO;
using System.Windows.Forms;
using Resources = AppLauncher.Properties.Resources;
namespace RyzStudio.Windows.ThemedForms
{
public class TOpenFileTextBox : TButtonTextBox
public TOpenFileTextBox() : base()
this.NormalImage = Resources.file16_a;
this.HighlightImage = Resources.file16_b;
this.Text = string.Empty;
}
public OpenFileDialog FileDialog { get; set; } = null;
protected override void imageBox1_Click(object sender, EventArgs e)
if (this.FileDialog == null)
this.FileDialog = new OpenFileDialog();
this.FileDialog.Title = "Choose a file";
this.FileDialog.Filter = "All files|*";
if (!string.IsNullOrWhiteSpace(this.Text))
if (File.Exists(this.Text))
this.FileDialog.InitialDirectory = Path.GetDirectoryName(this.Text);
if (this.FileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
this.Text = this.FileDialog.FileName;