-
Notifications
You must be signed in to change notification settings - Fork 0
/
Custom_ToolStrip_UC_FolderSelector.cs
63 lines (57 loc) · 1.74 KB
/
Custom_ToolStrip_UC_FolderSelector.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ImageShaper
{
public partial class Custom_ToolStrip_UC_FolderSelector : UserControl
{
public float LabelWidth
{
get { return this.tableLayoutPanel1.ColumnStyles[0].Width; }
set { this.tableLayoutPanel1.ColumnStyles[0].Width = value; }
}
public override string Text
{
get { return this.label1.Text; }
set { this.label1.Text = value; }
}
public string Value
{
get { return this.textBox1.Text; }
set { this.textBox1.Text = value; }
}
private bool _FileSelector=false;
public bool FileSelector
{
get { return _FileSelector; }
set { _FileSelector = value; }
}
public Custom_ToolStrip_UC_FolderSelector()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (!_FileSelector)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.SelectedPath = this.textBox1.Text;
if (fbd.ShowDialog() == DialogResult.OK)
this.textBox1.Text = fbd.SelectedPath;
}
else
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = this.textBox1.Text;
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
this.textBox1.Text = ofd.FileName;
}
}
}
}