예제 #1
0
        public void AddCheckBoxLeft(string body)
        {
            string[] s   = body.Split('-');                                     //用-进行分割
            int      Num = Convert.ToInt32(s[0]) * 100 + Convert.ToInt32(s[1]); //转换

            instance.Dispatcher.Invoke((Action) delegate()
            {
                NewCheckBox n1     = new NewCheckBox();
                n1.Height          = 84;
                n1.Width           = 154;
                n1.checkBox.Name   = "a" + i2.ToString();
                n1.textBlock.Text  = body;
                n1.grid.Background = PaleGreen;

                n1.HorizontalAlignment = HorizontalAlignment.Left;
                n1.VerticalAlignment   = VerticalAlignment.Top;
                //if (104 + i1 / inWidth * 104 > instance.gridLeft.Height)
                //{
                //    instance.gridLeft.Height += 104;
                //}
                //n1.Margin = new Thickness(20 + i1 % intel * 174, 20 + i1 / intel * 104, instance.gridLeft.ActualWidth - 174 - i1 % intel * 174, instance.gridLeft.ActualHeight - 104 - i1 / intel * 104);
                //n1.Margin = new Thickness(20 + i1 % inWidth * 174, 20 + i1 / inWidth * 104, 0, 0);
                //n1.MouseEnter += new System.Windows.Input.MouseEventHandler(Mouse_Enter);
                n1.checkBox.Click += new RoutedEventHandler(CheckBox_Click);

                sNumL.Add(Num, n1);
                sNumL = sNumL.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
                gdsk.Add(body, n1);
                gdsk = gdsk.OrderBy(p => p.Key, new CustomComparer()).ToDictionary(p => p.Key, o => o.Value);
                NcbL.Clear();
                gridLeft.Children.Clear();
                NcbL.AddRange(sNumL.Values);
                if (NcbL.Count > leftAll)
                {
                    int count       = NcbL.Count - leftAll;
                    int bel         = (count + 4) / inWidth;
                    gridLeft.Height = ShowHeigh + bel * 104;
                }
                for (int i = 0; i < NcbL.Count; i++)
                {
                    NcbL[i].Margin = Tkn[i];
                    gridLeft.Children.Add(NcbL[i]);
                }
                stNumL.Add("a" + i2.ToString(), Num);
                i2++;
            });
        }
예제 #2
0
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox E   = sender as CheckBox;
            var      n   = E.Name;
            var      str = e.Source.ToString();

            if (str.Contains("True"))
            {
                int         ss = stNumL[n.ToString()];
                NewCheckBox nc = sNumL[ss];
                var         ne = nc.textBlock.Text;
                RemoveCheckBoxLeft(ss);
                AddCheckBoxRight(ss, nc);
            }
            else if (str.Contains("False"))
            {
                int         ns = stNumR[n.ToString()];
                NewCheckBox nc = sNumR[ns];
                RemoveCheckBoxRight(ns);
                AddCheckBoxLeftRes(ns, nc);
            }
        }
예제 #3
0
 public void AddCheckBoxLeftRes(int Num, NewCheckBox nc)
 {
     nc.checkBox.Name      = "a" + i2.ToString();
     nc.checkBox.IsChecked = false;
     sNumL.Add(Num, nc);
     sNumL = sNumL.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
     NcbL.Clear();
     gridLeft.Children.Clear();
     NcbL.AddRange(sNumL.Values);
     if (NcbL.Count > leftAll)
     {
         int count = NcbL.Count - leftAll;
         int bel   = (count + 4) / inWidth;
         gridLeft.Height = ShowHeigh + bel * 104;
     }
     for (int i = 0; i < NcbL.Count; i++)
     {
         NcbL[i].Margin = Tkn[i];
         gridLeft.Children.Add(NcbL[i]);
     }
     stNumL.Add("a" + i2.ToString(), Num);
     i2++;
 }
예제 #4
0
 public void AddCheckBoxRight(int Num, NewCheckBox n)
 {
     n.checkBox.Name      = "a" + i2.ToString();
     n.checkBox.IsChecked = true;
     sNumR.Add(Num, n);
     sNumR = sNumR.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
     instance.Dispatcher.Invoke((Action) delegate()
     {
         NcbR.Clear();
         gridRight.Children.Clear();
         NcbR.AddRange(sNumR.Values);
         for (int i = 0; i < NcbR.Count; i++)
         {
             NcbR[i].Margin = Tkn[i];
             gridRight.Children.Add(NcbR[i]);
         }
         if (NcbR.Count > rightAll && (NcbR.Count - 1) % inWidth == 0)
         {
             instance.gridRight.Height += 104;
         }
         stNumR.Add("a" + i2.ToString(), Num);
         i2++;
     });
 }