コード例 #1
0
 private void ClearScoring()
 {
     try
     {
         this.panelScoringLeft.Controls.Clear();
         this.panelScoringTop.Controls.Clear();
         this.panelScoringRight.Controls.Clear();
         this.panelScoringMain.Controls.Clear();
         LabelsConstructsLeft  = new Label[0];
         LabelsConstructsRight = new Label[0];
         LabelsElement         = new RotatedTextLabel[0];
         cboScoring            = new ComboBox[0, 0];
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
コード例 #2
0
        void mdiInterviewLabelElement_MouseEnter(object sender, EventArgs e)
        {
            RotatedTextLabel l = (RotatedTextLabel)sender;

            this.SelectedColumnIndex = (int)l.Tag;
        }
コード例 #3
0
        private void ReDrawScoring()
        {
            int width = this.elementWidth;

            this.SuspendLayout();
            try
            {
                ClearScoring();
                BindingSources        = new List <BindingSource>();
                LabelsConstructsLeft  = new Label[this.CurrentInterview.Constructs.Count];
                LabelsConstructsRight = new Label[this.CurrentInterview.Constructs.Count];
                LabelsElement         = new RotatedTextLabel[this.CurrentInterview.Elements.Count];
                cboScoring            = new ComboBox[this.CurrentInterview.Constructs.Count, this.CurrentInterview.Elements.Count];
                this.toolStripComboBoxFromElements.Items.Clear();
                this.toolStripComboBoxFromElements.Items.AddRange(this.CurrentInterview.Elements.Select(x => x.Name).ToArray());
                this.toolStripComboBoxToElements.Items.Clear();
                this.toolStripComboBoxToElements.Items.AddRange(this.CurrentInterview.Elements.Select(x => x.Name).ToArray());

                for (int j = 0; j < this.CurrentInterview.Elements.Count; j++)
                {
                    Element element = this.CurrentInterview.Elements[j];
                    LabelsElement[j]               = new RotatedTextLabel();
                    LabelsElement[j].Size          = new Size(width, this.panelScoringTop.Height);
                    LabelsElement[j].Anchor        = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)));
                    LabelsElement[j].Debugging     = false;
                    LabelsElement[j].DemoModus     = false;
                    LabelsElement[j].FitHeight     = false;
                    LabelsElement[j].FitWidth      = false;
                    LabelsElement[j].Margin        = new System.Windows.Forms.Padding(3);
                    LabelsElement[j].Name          = "rotatedTextLabel_" + j;
                    LabelsElement[j].RotatedAlign  = System.Drawing.ContentAlignment.MiddleCenter;
                    LabelsElement[j].RotationAngle = 90D;
                    LabelsElement[j].Text          = element.Name;
                    LabelsElement[j].Tag           = j;
                    LabelsElement[j].TextAlign     = System.Drawing.ContentAlignment.MiddleLeft;
                    LabelsElement[j].Location      = new System.Drawing.Point(3 + j * (width + 3), 3);
                    this.panelScoringTop.Controls.Add(LabelsElement[j]);
                    LabelsElement[j].MouseEnter += new EventHandler(mdiInterviewLabelElement_MouseEnter);
                    LabelsElement[j].MouseLeave += new EventHandler(mdiInterviewLabelElement_MouseLeave);
                    for (int i = 0; i < this.CurrentInterview.Constructs.Count; i++)
                    {
                        Construct     construct = this.CurrentInterview.Constructs[i];
                        Score         score     = element.Scores.Single(x => x.ParentConstruct.Id.Equals(construct.Id));
                        BindingSource c         = new BindingSource();
                        c.DataSource = score;

                        BindingSource           b  = new BindingSource();
                        BindingList <ScaleItem> bl = new BindingList <ScaleItem>(this.CurrentInterview.Scales);
                        b.DataSource = bl;


                        cboScoring[i, j] = new ComboBox();
                        cboScoring[i, j].DropDownWidth      = 400;
                        cboScoring[i, j].DataSource         = b;
                        cboScoring[i, j].DisplayMember      = "DisplayName";
                        cboScoring[i, j].ValueMember        = "Id";
                        cboScoring[i, j].AutoCompleteMode   = AutoCompleteMode.Suggest;
                        cboScoring[i, j].AutoCompleteSource = AutoCompleteSource.ListItems;
                        cboScoring[i, j].Size       = new System.Drawing.Size(width, 21);
                        cboScoring[i, j].Location   = new System.Drawing.Point(3 + j * (width + 3), 3 + i * 24);
                        cboScoring[i, j].Tag        = new int[] { i, j };
                        cboScoring[i, j].LostFocus += new EventHandler(mdiInterview_LostFocus);
                        cboScoring[i, j].DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", c, "ScaleItemId", true));
                        this.panelScoringMain.Controls.Add(cboScoring[i, j]);
                        this.toolTip1.SetToolTip(cboScoring[i, j],
                                                 string.Format("Element: {0} -- Construct: {1}/{2}",
                                                               element.Name, construct.ContrastPol,
                                                               construct.ContrastPol));
                        BindingSources.Add(c);
                        BindingSources.Add(b);
                        cboScoring[i, j].MouseEnter           += new EventHandler(mdiInterview_cbo_MouseEnter);
                        cboScoring[i, j].MouseLeave           += new EventHandler(mdiInterview_cbo_MouseLeave);
                        cboScoring[i, j].SelectedValueChanged += new EventHandler(mdiInterview_SelectedValueChanged);
                        if (j == 0)
                        {
                            Label lbl = new Label();
                            lbl.Text = construct.ContrastPol;
                            this.toolTip1.SetToolTip(lbl, construct.Name);
                            lbl.Size      = new Size(this.panelScoringLeft.Width, 21);
                            lbl.Location  = new Point(0, 3 + i * (21 + 3));
                            lbl.TextAlign = ContentAlignment.MiddleRight;
                            this.panelScoringLeft.Controls.Add(lbl);
                            LabelsConstructsLeft[i] = lbl;
                            lbl.Tag         = i;
                            lbl.MouseEnter += new EventHandler(lbl_ConstructLeft_MouseEnter);
                            lbl.MouseLeave += new EventHandler(lbl_ConstructLeft_MouseLeave);

                            lbl      = new Label();
                            lbl.Text = construct.ConstructPol;
                            this.toolTip1.SetToolTip(lbl, construct.Name);
                            lbl.Size      = new Size(this.panelScoringRight.Width, 21);
                            lbl.Location  = new Point(0, 3 + i * (21 + 3));
                            lbl.TextAlign = ContentAlignment.MiddleLeft;
                            this.panelScoringRight.Controls.Add(lbl);
                            lbl.Tag = i;
                            LabelsConstructsRight[i] = lbl;
                            lbl.MouseEnter          += new EventHandler(lbl_ConstructLeft_MouseEnter);
                            lbl.MouseLeave          += new EventHandler(lbl_ConstructLeft_MouseLeave);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            this.ResumeLayout();
        }