C# Diyalog Pencereleri
Örnek
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp41
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
ColorDialog RP = new ColorDialog();
if (RP.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("" + RP.Color.Name);
}
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog OFD = new OpenFileDialog();
if (OFD.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(OFD.FileName);
}
}
private void button3_Click(object sender, EventArgs e)
{
SaveFileDialog SFD = new SaveFileDialog();
if (SFD.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(SFD.FileName);
}
}
private void button4_Click(object sender, EventArgs e)
{
FontDialog FD = new FontDialog();
if (FD.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(FD.Font.Name);
}
}
private void button5_Click(object sender, EventArgs e)
{
DialogResult DR = MessageBox.Show(
"Mesaj içeriği", // text
"Başlık", // caption
MessageBoxButtons.YesNoCancel, // butonlar
MessageBoxIcon.Warning // ikon
);
if (DR == DialogResult.Cancel)
{
MessageBox.Show("Cancele bastın");
}
}
}
}