Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- namespace WindowsFormsApplication2
- {
- public partial class Form1 : Form
- {
- private UC1 uc1 = new UC1();
- private UC2 uc2 = new UC2();
- public Form1()
- {
- InitializeComponent();
- }
- private void buttonUC1_Click(Object sender, EventArgs e)
- {
- displayPanel.Controls.Clear();
- displayPanel.Controls.Add(uc1);
- }
- private void buttonUC2_Click(Object sender, EventArgs e)
- {
- displayPanel.Controls.Clear();
- displayPanel.Controls.Add(uc2);
- }
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- uc1.Dispose();
- uc2.Dispose();
- }
- base.Dispose(disposing);
- }
- }
- }
- using System;
- using System.Windows.Forms;
- namespace WindowsFormsApplication2
- {
- public partial class UC1 : UserControl
- {
- private Int32 count;
- public UC1()
- {
- InitializeComponent();
- }
- private void button_Click(Object sender, EventArgs e)
- {
- count++;
- textBoxCount.Text = count.ToString();
- }
- }
- }
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication2
- {
- public partial class UC2 : UserControl
- {
- public UC2()
- {
- InitializeComponent();
- }
- private async void button1_Click(Object sender, EventArgs e)
- {
- Application.UseWaitCursor = true;
- await Task.Run(() => Thread.Sleep(5000));
- Application.UseWaitCursor = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement