C#/Windows Form
[C# Windows Form] 파일명 필터 걸기 (OpenFileDialog Filter)
스타크래프트 좋아하는 사람
2024. 1. 30. 20:46
파일 저장, 불러오기 등에 사용되는 옵션이 있습니다.
양식은
(2개 이상 받기)
설명문|파일확장자;파일확장자2
(1개씩 받기)
파일명1 | 파일1확장자 | 파일2 | 파일2확장자
형태로 입력하면 됩니다.
using System.Windows.Forms;
namespace WindowsFormsApp_searching
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Tif(Tiff),JPG|*.tif;*.jpg|ALL|*.*";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//선택 된 경우!
}
}
}
}