コード例 #1
0
ファイル: TestProtocols.cs プロジェクト: geab/forlabv2-beta
        private void InitOtherListView()
        {
            _othListView                  = new SiteListView();
            _othListView.MySortBrush      = SystemBrushes.ControlLight;
            _othListView.MyHighlightBrush = Brushes.Goldenrod;
            _othListView.GridLines        = true;
            _othListView.MultiSelect      = false;
            _othListView.Dock             = DockStyle.Fill;
            _othListView.ControlPadding   = 4;
            _othListView.HeaderStyle      = ColumnHeaderStyle.Nonclickable;

            //add columns and items

            EXColumnHeader exEditCol = new EXColumnHeader("", 120);

            _othListView.Columns.Add(exEditCol);

            //string[] testname = Enum.GetNames(typeof(OtherTestNameEnum));
            var results = DataRepository.GetTestByPlatform(ClassOfMorbidityTestEnum.OtherTest.ToString());

            //for (int i = 0; i < testname.Length; i++)
            foreach (Test t in results)
            {
                EXEditableColumnHeader exCol = new EXEditableColumnHeader(t.TestName, 60);
                _othListView.Columns.Add(exCol);
            }

            _othListView.EditableListViewSubitemValueChanged += new EventHandler <EXEditableListViewSubitemEventArgs>(_othListView_EditableListViewSubitemValueChanged);

            tabOther.Controls.Add(_othListView);
        }
コード例 #2
0
 public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch)
 {
     EXBoolColumnHeader boolcol = (EXBoolColumnHeader)ch;
     
     Image boolimg;
     if (this.BoolValue == true)
     {
         boolimg = boolcol.TrueImage;
     }
     else
     {
         boolimg = boolcol.FalseImage;
     }
     int imgy = e.Bounds.Y + ((int)(e.Bounds.Height / 2)) - ((int)(boolimg.Height / 2));
     e.Graphics.DrawImage(boolimg, x, imgy, boolimg.Width, boolimg.Height);
     x += boolimg.Width + 2;
     return x;
 }
コード例 #3
0
 public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch)
 {
     return x;
 }
コード例 #4
0
        private void this_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            EXListViewItem lstvItem = this.GetItemAt(e.X, e.Y) as EXListViewItem;
            if (lstvItem == null) 
                return;
            _clickeditem = lstvItem;
            int x = lstvItem.Bounds.Left;
            int i;
            for (i = 0; i < this.Columns.Count; i++)
            {
                x = x + this.Columns[i].Width;
                if (x > e.X)
                {
                    x = x - this.Columns[i].Width;
                    _clickedsubitem = lstvItem.SubItems[i];
                    _col = i;
                    break;
                }
            }
            
            if (!(this.Columns[i] is EXColumnHeader)) 
                return;
            
            EXColumnHeader col = (EXColumnHeader)this.Columns[i];
            if (col.GetType() == typeof(EXEditableColumnHeader))
            {
                EXEditableColumnHeader editcol = (EXEditableColumnHeader) col;
                if (editcol.MyControl != null)
                {
                    Control c = editcol.MyControl;
                    if (c.Tag != null)
                    {
                        this.Controls.Add(c);
                        c.Tag = null;
                        if (c is ComboBox)
                        {
                            ((ComboBox)c).SelectedValueChanged += new EventHandler(cmbx_SelectedValueChanged);
                        }
                        c.Leave += new EventHandler(c_Leave);
                    }

                    if (c is ComboBox)
                    {
                        if(ComboBoxBeforeVisible != null)
                            ComboBoxBeforeVisible(this, new EXEditableListViewComboBoxEventArgs(_clickeditem, (EXListViewSubItem)_clickedsubitem) );
                    }

                    c.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y);
                    c.Width = this.Columns[i].Width;
                    if (c.Width > this.Width) c.Width = this.ClientRectangle.Width;
                    c.Text = _clickedsubitem.Text;
                    c.Visible = true;
                    c.BringToFront();
                    c.Focus();
                }
                else
                {
                    txtbx.Location = new Point(x, this.GetItemRect(this.Items.IndexOf(lstvItem)).Y);
                    txtbx.Width = this.Columns[i].Width;
                    if (txtbx.Width > this.Width) txtbx.Width = this.ClientRectangle.Width;
                    txtbx.Text = _clickedsubitem.Text;
                    txtbx.Visible = true;
                    txtbx.BringToFront();
                    txtbx.Focus();
                }
            }
            else if (col.GetType() == typeof(EXBoolColumnHeader))
            {
                EXBoolColumnHeader boolcol = (EXBoolColumnHeader)col;
                if (boolcol.Editable)
                {
                    EXBoolListViewSubItem boolsubitem = (EXBoolListViewSubItem)_clickedsubitem;
                    if (boolsubitem.BoolValue == true)
                    {
                        boolsubitem.BoolValue = false;
                    }
                    else
                    {
                        boolsubitem.BoolValue = true;
                    }

                    if (BoolListViewSubItemValueChanged != null)
                    {
                        BoolListViewSubItemValueChanged(this, new EXBoolListViewSubItemEventArgs(_clickeditem, boolsubitem));
                    }
                    this.Invalidate(boolsubitem.Bounds);
                }
            }
        }
コード例 #5
0
ファイル: SiteListView.cs プロジェクト: opianHealth/ForLAB
 public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch)
 {
     return x;
 }
コード例 #6
0
ファイル: SiteListView.cs プロジェクト: opianHealth/ForLAB
        public override int DoDraw(DrawListViewSubItemEventArgs e, int x, EXColumnHeader ch)
        {
            EXBoolColumnHeader boolcol = (EXBoolColumnHeader)ch;

            Image boolimg;
            if (this.BoolValue == true)
            {
                boolimg = boolcol.TrueImage;
            }
            else
            {
                boolimg = boolcol.FalseImage;
            }
            int imgy = e.Bounds.Y + ((int)(e.Bounds.Height / 2)) - ((int)(boolimg.Height / 2));
            e.Graphics.DrawImage(boolimg, x, imgy, boolimg.Width, boolimg.Height);
            x += boolimg.Width + 2;
            return x;
        }
コード例 #7
0
ファイル: FrmProtocol.cs プロジェクト: opianHealth/ForLAB
        private void InitOtherListView()
        {
            _othListView = new SiteListView();
            _othListView.MySortBrush = SystemBrushes.ControlLight;
            _othListView.MyHighlightBrush = Brushes.Goldenrod;
            _othListView.GridLines = true;
            _othListView.MultiSelect = false;
            _othListView.Dock = DockStyle.Fill;
            _othListView.ControlPadding = 4;
            _othListView.HeaderStyle = ColumnHeaderStyle.Nonclickable;

            //add columns and items

            EXColumnHeader exEditCol = new EXColumnHeader("", 120);
            _othListView.Columns.Add(exEditCol);

            string[] testname = Enum.GetNames(typeof(OtherTestNameEnum));
            for (int i = 0; i < testname.Length; i++)
            {
                EXEditableColumnHeader exCol = new EXEditableColumnHeader(testname[i].Replace('_', ' '), 60);
                _othListView.Columns.Add(exCol);
            }

            _othListView.EditableListViewSubitemValueChanged += new EventHandler<EXEditableListViewSubitemEventArgs>(_othListView_EditableListViewSubitemValueChanged);

            tabOther.Controls.Add(_othListView);
        }