public void SetBindSource(object obj)
        {
            if (obj is HistoryCheckDataDataModel)
            {
                m_object = (HistoryCheckDataDataModel)obj;
            }

            if (m_object.pscope.Length > 0)
            {
                Label lab = new Label();
                lab.Font     = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                lab.AutoSize = true;
                lab.Text     = m_object.pscope;

                Graphics g          = lab.CreateGraphics();
                SizeF    StrSize    = g.MeasureString(lab.Text, lab.Font);
                int      widthValue = (int)StrSize.Width;

                lab.Font     = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                lab.Location = new Point(this.panel1.Width / 2 - widthValue / 2, 10);

                if (widthValue > 150)
                {
                    lab.Location = new Point(0, 0);
                    lab.AutoSize = false;
                    lab.Dock     = DockStyle.Fill;
                }
                this.panel1.Controls.Add(lab);
            }
        }
Exemple #2
0
        public void BindingData(object sender, EventArgs e)
        {
            List <DataGridViewColumnEntity> lstCulumns           = new List <DataGridViewColumnEntity>();
            MyEventArgsTableData            myEventArgsTableData = e as MyEventArgsTableData;
            HistoryCheckData historyCheckData = myEventArgsTableData.historyCheckData;
            int columnsWidth = this.ucDataGridView1.Width - 600;

            lstCulumns.Add(new DataGridViewColumnEntity()
            {
                DataField = "Id", HeadText = "NO", Width = 50, WidthType = SizeType.Absolute
            });
            lstCulumns.Add(new DataGridViewColumnEntity()
            {
                DataField = "propName", HeadText = "检测项", Width = 150, WidthType = SizeType.Absolute
            });
            lstCulumns.Add(new DataGridViewColumnEntity()
            {
                DataField = "propvalue", HeadText = "检测结果", Width = columnsWidth, WidthType = SizeType.Absolute, CustomCellType = typeof(UCTestGridTable_CustomCellB), TextAlign = ContentAlignment.BottomCenter
            });
            //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "pscope", HeadText = "参考范围", Width = 150, WidthType = SizeType.Absolute });
            lstCulumns.Add(new DataGridViewColumnEntity()
            {
                DataField = "pscope", HeadText = "参考范围", Width = 150, WidthType = SizeType.Absolute, CustomCellType = typeof(UCTestGridTable_CustomCellBB), TextAlign = ContentAlignment.BottomCenter
            });

            lstCulumns.Add(new DataGridViewColumnEntity()
            {
                DataField = "propTime", HeadText = "检测时间", Width = 200, WidthType = SizeType.Absolute
            });
            this.ucDataGridView1.Columns        = lstCulumns;
            this.ucDataGridView1.IsShowCheckBox = false;

            List <object> lstSource = new List <object>();

            for (int i = 0; i < historyCheckData.data.Count; i++)
            {
                string pscopevalue = string.Empty, punitvalue = string.Empty;
                if (historyCheckData.data[i].punit != null)
                {
                    punitvalue = historyCheckData.data[i].punit == null ? "" : historyCheckData.data[i].punit.ToString();
                }
                else
                {
                    punitvalue = "";
                }
                if (historyCheckData.data[i].pscope != null)
                {
                    pscopevalue = historyCheckData.data[i].pscope == null ? "" : historyCheckData.data[i].pscope.ToString();
                }
                else
                {
                    pscopevalue = "";
                }

                HistoryCheckDataDataModel model = new HistoryCheckDataDataModel()
                {
                    Id          = i + 1,
                    orderNo     = historyCheckData.data[i].orderNo,
                    propName    = historyCheckData.data[i].propName,
                    propTime    = historyCheckData.data[i].propTime,
                    propValue   = historyCheckData.data[i].propValue.ToString() + punitvalue,
                    pscope      = pscopevalue,
                    cellWidth   = columnsWidth,
                    highLowMark = historyCheckData.data[i].highLowMark,
                    punit       = historyCheckData.data[i].punit,
                };
                lstSource.Add(model);
            }
            this.ucDataGridView1.DataSource = lstSource;
        }
        public void SetBindSource(object obj)
        {
            if (obj is HistoryCheckDataDataModel)
            {
                m_object = (HistoryCheckDataDataModel)obj;
            }

            if (m_object.propName == "中医体质辨识")
            {
                if (m_object.propValue.Trim().Length > 0)
                {
                    string[] strList = m_object.propValue.Split(';');
                    if (strList.Length > 0)
                    {
                        int width = m_object.cellWidth / strList.Length;
                        for (int i = 0; i < strList.Length; i++)
                        {
                            Label lab = new Label();
                            lab.Text     = strList[i];
                            lab.Size     = lab.Size = new System.Drawing.Size(width, 25);
                            lab.Location = new System.Drawing.Point(width * i, 10);
                            lab.Font     = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                            this.Controls.Add(lab);
                            lab.Click      += new EventHandler(CustomBtn_Click);
                            lab.MouseEnter += lbl_MouseEnter;
                            lab.MouseLeave += lbl_MouseLeave;
                        }
                    }
                }
            }
            else
            {
                Label lab = new Label();
                lab.Font     = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                lab.AutoSize = true;
                lab.Text     = m_object.propValue;

                Graphics g          = lab.CreateGraphics();
                SizeF    StrSize    = g.MeasureString(lab.Text, lab.Font);
                int      widthValue = (int)StrSize.Width;


                lab.Location = new System.Drawing.Point(m_object.cellWidth / 2 - widthValue / 2, 10);
                this.Controls.Add(lab);

                if (m_object.highLowMark != 0)
                {
                    PictureBox pictureBox = new PictureBox();
                    if (m_object.highLowMark == 1)
                    {
                        pictureBox.Image = global::IDCardClieck.Properties.Resources.arrow_red_up_24px_5308_easyicon_net;
                    }
                    if (m_object.highLowMark == -1)
                    {
                        pictureBox.Image = global::IDCardClieck.Properties.Resources.arrow_down_download_24px_4297_easyicon_net;
                    }
                    pictureBox.Name     = "pictureBox1";
                    pictureBox.Size     = new System.Drawing.Size(10, 30);
                    pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
                    pictureBox.TabStop  = false;
                    pictureBox.Location = new System.Drawing.Point(lab.Location.X + lab.Width + 10, 5);
                    this.Controls.Add(pictureBox);
                }
            }
        }