Exemple #1
0
        private static string[] LabelsFromBox(CheckedListBoxControl box)
        {
            List <string> result = new List <string>();

            foreach (string x in box.CheckedItems)
            {
                LabelModification sl = LabelModification.GetLabelByName(x);
                if (sl == null)
                {
                    throw new Exception("Label " + x + " does not exist.");
                }
                result.Add(sl.Name);
            }
            return(result.ToArray());
        }
Exemple #2
0
        private void LabelsListBoxItemCheck(object sender, ItemCheckEventArgs e)
        {
            CheckedListBoxControl box = (CheckedListBoxControl)sender;

            if (e.NewValue != CheckState.Checked)
            {
                return;
            }
            if (deselectionMap.ContainsKey(e.Index))
            {
                foreach (int i in deselectionMap[e.Index])
                {
                    box.SetItemChecked(i, false);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Initializes an Ms1LabelPanel instance. Called only by constructor.
        /// Sets textLabels and labelsListBoxes.
        /// </summary>
        private void InitializeComponent1()
        {
            labelsListBoxes = new CheckedListBoxControl[n];
            textLabels      = new Label[n];
            for (int i = 0; i < n; i++)
            {
                labelsListBoxes[i] = new CheckedListBoxControl();
                foreach (string label in labels)
                {
                    labelsListBoxes[i].Add(label);
                }
                textLabels[i] = new Label {
                    Text = GetLabelText(i, n)
                };
            }
            // grid1 has one row to show "Light labels", "Medium levels", etc., and one row for the boxes to select
            // the relevant labels. It has one column for each label state.
            TableLayoutPanel grid1 = new TableLayoutPanel();

            grid1.RowStyles.Add(new RowStyle(SizeType.Absolute, 24));
            grid1.RowStyles.Add(new RowStyle(SizeType.AutoSize, 100));
            for (int i = 0; i < n; i++)
            {
                grid1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 150));
            }
            for (int i = 0; i < n; i++)
            {
                grid1.Controls.Add(textLabels[i], i, 0);
                grid1.Controls.Add(labelsListBoxes[i], i, 1);
            }
            grid1.AutoScroll             = true;
            grid1.VerticalScroll.Enabled = false;
            grid1.Dock = DockStyle.Fill;
            //ScrollViewer sv = new ScrollViewer{
            //	HorizontalAlignment = HorizontalAlignment.Left,
            //	VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
            //	HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
            //	Content = grid1
            //};
            Controls.Add(grid1);
            Name   = "Ms1LabelPanel";
            Width  = 540;
            Height = 147;
            //VisualStyleElement.TrayNotify.Background = Brushes.White;
        }
 /// <summary>
 /// Initializes an Ms1LabelPanel instance. Called only by constructor.
 /// Sets textLabels and labelsListBoxes.
 /// </summary>
 private void InitializeComponent1()
 {
     labelsListBoxes = new CheckedListBoxControl[n];
     textLabels = new Label[n];
     for (int i = 0; i < n; i++){
         labelsListBoxes[i] = new CheckedListBoxControl();
         foreach (string label in labels){
             labelsListBoxes[i].Add(label);
         }
         textLabels[i] = new Label{Text = GetLabelText(i, n)};
     }
     // grid1 has one row to show "Light labels", "Medium levels", etc., and one row for the boxes to select
     // the relevant labels. It has one column for each label state.
     TableLayoutPanel grid1 = new TableLayoutPanel();
     grid1.RowStyles.Add(new RowStyle(SizeType.Absolute, 24));
     grid1.RowStyles.Add(new RowStyle(SizeType.AutoSize, 100));
     for (int i = 0; i < n; i++){
         grid1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 150));
     }
     for (int i = 0; i < n; i++){
         grid1.Controls.Add(textLabels[i], i, 0);
         grid1.Controls.Add(labelsListBoxes[i], i, 1);
     }
     grid1.AutoScroll = true;
     grid1.VerticalScroll.Enabled = false;
     grid1.Dock = DockStyle.Fill;
     //ScrollViewer sv = new ScrollViewer{
     //	HorizontalAlignment = HorizontalAlignment.Left,
     //	VerticalScrollBarVisibility = ScrollBarVisibility.Disabled,
     //	HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
     //	Content = grid1
     //};
     Controls.Add(grid1);
     Name = "Ms1LabelPanel";
     Width = 540;
     Height = 147;
     //VisualStyleElement.TrayNotify.Background = Brushes.White;
 }
 private static string[] LabelsFromBox(CheckedListBoxControl box)
 {
     List<string> result = new List<string>();
     foreach (string x in box.CheckedItems){
         LabelModification sl = LabelModification.GetLabelByName(x);
         if (sl == null){
             throw new Exception("Label " + x + " does not exist.");
         }
         result.Add(sl.Name);
     }
     return result.ToArray();
 }