예제 #1
0
 void ctr_Click(object sender, EventArgs e)
 {
     if (sender is screenCtr)
     {
         SelectedScreen            = sender as screenCtr;
         SelectedScreen.IsSelected = true;
     }
 }
예제 #2
0
 void ctr_ScreenSelectChanged(object sender, EventArgs e)
 {
     if (sender is screenCtr)
     {
         SelectedScreen = sender as screenCtr;
         if (SelectedScreen.IsSelected)
         {
             label1.Text   = "当前选中屏幕--" + SelectedScreen.screenNo.ToString();
             SelectedIndex = SelectedScreen.screenNo - 1;
         }
     }
 }
예제 #3
0
        private void ChooseScreenFrm_Load(object sender, EventArgs e)
        {
            int screenCnt = System.Windows.Forms.Screen.AllScreens.Length;
            int left      = 0;

            for (int i = 0; i < screenCnt; i++)
            {
                screenCtr ctr = new screenCtr();
                ctr.screenNo             = i + 1;
                ctr.ScreenSelectChanged += ctr_ScreenSelectChanged;
                ctr.Click += ctr_Click;
                ctr.Left   = left + 50;

                ctr.Top = 50;
                left   += ctr.Width;
                int w = ctr.Width;
                this.Controls.Add(ctr);
            }
        }