Ikon Kejadian Pada Perintah “MessageBox” dengan C#.NET 2010
Contoh sederhana menampilkan jenis-jenis ikon pada kotak pesan dengan menggunakan perintah MessageBox dengan Visual C#.NET 2010.
1. Ikon Asterisk
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Asterisk", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  22:         }  23:     }  24: }2. Ikon Error
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  22:         }  23:     }  24: }3. Ikon Exclamation
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  22:         }  23:     }  24: }4. Ikon Hand
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Hand", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  22:         }  23:     }  24: }5. Ikon Information
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
  22:         }  23:     }  24: }6. Ikon None
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon None", MessageBoxButtons.OK, MessageBoxIcon.None);
  22:         }  23:     }  24: }7. Ikon Question
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Question", MessageBoxButtons.OK, MessageBoxIcon.Question);
  22:         }  23:     }  24: }8. Ikon Stop
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
  22:         }  23:     }  24: }9. Ikon Warning
1: using System;
2: using System.Collections.Generic;
3: using System.ComponentModel;
4: using System.Data;
5: using System.Drawing;
6: using System.Linq;
7: using System.Text;
8: using System.Windows.Forms;
   9:  10: namespace WindowsFormsApplication1
  11: {12: public partial class Form1 : Form
  13:     {14: public Form1()
  15:         {  16:             InitializeComponent();  17:         }  18:  19: private void button1_Click(object sender, EventArgs e)
  20:         {21: MessageBox.Show("Halo, Dunia!", "Ikon Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  22:         }  23:     }  24: }Label: C#.NET


0 Komentar:
Posting Komentar
Berlangganan Posting Komentar [Atom]
<< Beranda