Exemple #1
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = ds.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 5;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "stt";
            TextCol.HeaderText  = "Stt";
            TextCol.Width       = 20;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "ten";
            TextCol.HeaderText  = "Nội dung";
            TextCol.Width       = 140;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "dongia";
            TextCol.HeaderText  = "Đơn giá";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,##0";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol.MappingName = "lamthem";
            TextCol.HeaderText  = "Làm thêm";
            TextCol.Width       = 140;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol.MappingName = "ketqua";
            TextCol.HeaderText  = "Kết quả";
            TextCol.Width       = 200;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol.MappingName = "ghichu";
            TextCol.HeaderText  = "Ghi chú";
            TextCol.Width       = 300;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol.MappingName = "mavp";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol.MappingName = "ngoaihd";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #2
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = ds.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.AllowSorting         = false;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 10;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "makp";
            TextCol.HeaderText  = "Khoa";
            TextCol.Width       = 150;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "so";
            TextCol.HeaderText  = "Tổng số";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "nam";
            TextCol.HeaderText  = "Nam";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol.MappingName = "nu";
            TextCol.HeaderText  = "Nữ";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol.MappingName = "bhyt";
            TextCol.HeaderText  = "BHYT";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol.MappingName = "khac";
            TextCol.HeaderText  = "Khác";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol.MappingName = "t04";
            TextCol.HeaderText  = "0-4 Tuổi";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol.MappingName = "t06";
            TextCol.HeaderText  = "0-6 Tuổi";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol.MappingName = "t14";
            TextCol.HeaderText  = "0-14 Tuổi";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol.MappingName = "t1560";
            TextCol.HeaderText  = "15-60 Tuổi";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol.MappingName = "t90";
            TextCol.HeaderText  = "90 Tuổi";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol.MappingName = "tinh";
            TextCol.HeaderText  = "Tỉnh";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol.MappingName = "tp";
            TextCol.HeaderText  = s_tinh;
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 13);
            TextCol.MappingName = "cv";
            TextCol.HeaderText  = "Chuyển viện";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 14);
            TextCol.MappingName = "tv";
            TextCol.HeaderText  = "Tử vong";
            TextCol.Width       = 60;
            TextCol.Format      = "###,###,###";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #3
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = dtct.TableName;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "tenhc";
            TextCol1.HeaderText  = "Hoạt chất";
            TextCol1.Width       = 120;
            TextCol1.NullText    = string.Empty;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "mabd";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ma";
            TextCol1.HeaderText  = "Mã";
            TextCol1.Width       = 60;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol1.Width       = 200;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "donvi";
            TextCol1.HeaderText  = "Đóng gói";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "dang";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "tenhang";
            TextCol1.HeaderText  = "Hãng SX";
            TextCol1.Width       = 100;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "nhacc";
            TextCol1.HeaderText  = "Nhà cung cấp";
            TextCol1.Width       = 200;
            TextCol1.ReadOnly    = true;
            TextCol1.NullText    = "";
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "xuat10";
            TextCol1.HeaderText  = "Sử dụng(-10)";
            TextCol1.Width       = 75;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.NullText    = "0";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "xuat30";
            TextCol1.HeaderText  = "Sử dụng(-30)";
            TextCol1.Width       = 75;
            TextCol1.ReadOnly    = true;
            TextCol1.NullText    = "0";
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol1.MappingName = "slton";
            TextCol1.HeaderText  = "Tồn";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.NullText    = "0";
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol1.MappingName = "slgoiy";
            TextCol1.HeaderText  = "SL gợi ý";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.NullText    = "0";
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol1.MappingName = "soluong";
            TextCol1.HeaderText  = "Dự trù ";
            TextCol1.Width       = 60;
            TextCol1.NullText    = "0.0";
            TextCol1.Format      = format_soluong;
            //TextCol1.ReadOnly = bDutru_Readonly;
            TextCol1.Alignment = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 13);
            TextCol1.MappingName = "lydo";
            TextCol1.HeaderText  = "Lý do";
            TextCol1.Width       = 60;
            TextCol1.NullText    = "";
            //TextCol1.ReadOnly = !bDutru_Readonly;
            TextCol1.Alignment = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 14);
            TextCol1.MappingName = "id";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Clear();
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #4
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = dtct.TableName;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "tenhc";
            TextCol1.HeaderText  = "Hoạt chất";
            TextCol1.Width       = 120;
            TextCol1.NullText    = string.Empty;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "mabd";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol1.Width       = 200;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "dang";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "soluong";
            TextCol1.HeaderText  = "Dự trù ";
            TextCol1.Width       = 60;
            TextCol1.NullText    = "0";
            TextCol1.Format      = format_soluong;
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "slduyet";
            TextCol1.HeaderText  = "Duyệt";
            TextCol1.Width       = 60;
            TextCol1.NullText    = "0";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "id";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #5
0
        //��ʼ����ͷ����ʾ��Ϣ
        public bool iniDataGrid(DataGrid dataGrid1,int iPos)
        {
            try
            {
                this.iniDGDataSource(dataGrid1);

                // Create a table style that will hold the new column style
                // that we set and also tie it to our customer's table from our DB
                DataGridTableStyle tableStyle = new DataGridTableStyle();

                DataTable dt=(DataTable)dataGrid1.DataSource;

                tableStyle.MappingName =dt.TableName;

                DataTable dtGprsData=null;
                ArrayList alColsCap=null;

                //�����ʽ��ʼ��
                if(getGprsData(ref dtGprsData,ref alColsCap,iPos)==false)
                {
                    return false;
                }

                // since the dataset has things like field name and number of columns,
                // we will use those to create new columnstyles for the columns in our DB table
                int numCols = dtGprsData.Columns.Count;
                DataGridColoredTextBoxColumn aColumnTextColumn ;
                delegateGetColorRowCol d = new delegateGetColorRowCol(MyGetColorRowCol);

                int[] iColWidths=null;
                getColWidths(ref iColWidths);

                for(int i = 0; i < numCols; i++)
                {
                    aColumnTextColumn = new DataGridColoredTextBoxColumn(d, i,dtGprsData.Columns[i].ColumnName);
                    aColumnTextColumn.HeaderText = alColsCap[i].ToString();
                    aColumnTextColumn.Width=iColWidths[i]-2;
                    aColumnTextColumn.MappingName = dtGprsData.Columns[i].ColumnName;
                    tableStyle.GridColumnStyles.Add(aColumnTextColumn);
                }

                // make the dataGrid use our new tablestyle and bind it to our table
                dataGrid1.TableStyles.Clear();

                tableStyle.AllowSorting=false;
                //tableStyle.
                dataGrid1.AllowSorting=false;
                dataGrid1.TableStyles.Add(tableStyle);

                DataRow dr=dt.NewRow();
                for(int i=0;i<dt.Columns.Count;i++)
                {
                    dr[i]="";
                }
                dt.Rows.Add(dr);

                //tableStyle.RowHeadersVisible=false;
                dataGrid1.DataSource = dt;

                return true;
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }
        }
Exemple #6
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = ds.Tables[0].TableName;
            ts.AllowSorting         = false;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "maql";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "mabn";
            TextCol1.HeaderText  = "Mã BN";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "hoten";
            TextCol1.HeaderText  = "Họ tên";
            TextCol1.Width       = 180;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "namsinh";
            TextCol1.HeaderText  = "NS";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "doituong";
            TextCol1.HeaderText  = "Đối tượng";
            TextCol1.Width       = 100;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "sothe";
            TextCol1.HeaderText  = "Số thẻ";
            TextCol1.Width       = 100;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "tenkp";
            TextCol1.HeaderText  = "Khám";
            TextCol1.Width       = 130;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "done";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "sovaovien";
            TextCol1.HeaderText  = "Số khám";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "mavaovien";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
        private bool DesignTableStyle(ref string strErrMsg)
        {
            try
            {
                string m_strMaskCols = "", m_strShowCols = "";

                dgTabSt=new DataGridTableStyle();
                dgTabSt.MappingName=dtSource.TableName;

                dgTabSt.PreferredRowHeight=15;

                ////**** If the Default design is false then setting Colors for that Grid

                dgTabSt.HeaderBackColor=System.Drawing.Color.Lavender;
                dgTabSt.HeaderForeColor=System.Drawing.Color.Navy;
                dgTabSt.GridLineColor=System.Drawing.Color.Silver;

                for(int i=0; i < dtSource.Columns.Count; i++)
                {
                    int local0 = 0;

                    if(CheckComboBoxColumn(i))
                    {
                        DataGridComboBoxColumn dgCBCol = new DataGridComboBoxColumn(i);

                        dgCBCol.MappingName = strColNames[i];
                        dgCBCol.HeaderText = strHeadings[i];
                        dgCBCol.Alignment = HorizontalAlignment.Center; //Added by Nilanjan 14/05/07
                        dgCBCol.ColumnComboBox.DataSource = GetComboValue(i);
                        arlEnableColumns = new ArrayList();
                        arlEnableRows = new ArrayList();

                        if(CheckReadOnlyColumn(i))
                        {
                            dgCBCol.ReadOnly = true;
                            dgCBCol.TextBox.TabStop = false;
                        }

                        dgCBCol.CheckCellEnabled += new EnableCellEventHandler(SetEnableValues);
                        //changing color

                        dgCBCol.CheckCellColor +=new EnableCellColorEventHandler(dgTBCol_CheckCellColor);
                        dgCBCol.TextChangedCombo  += new EventHandler(TextBox_TextChanged);
                        //dgCBCol.TextBox.TextChanged+=new EventHandler(TextBox_TextChanged);  //added By Nilanjan 14/05/07

                        dgTabSt.GridColumnStyles.Add(dgCBCol);

                        dgCBCol.Dispose();
                    }
                    else if(CheckDateTimeColumn(i))
                    {
                        DataGridDateTimePicker dgDTPCol = new DataGridDateTimePicker(i);

                        dgDTPCol.MappingName = strColNames[i];
                        dgDTPCol.HeaderText = strHeadings[i];

                        if(CheckReadOnlyColumn(i))
                        {
                            dgDTPCol.ReadOnly = true;
                            dgDTPCol.TextBox .TabStop = false;
                        }

                        dgDTPCol.CheckCellEnabled += new EnableCellEventHandler(SetEnableValues);
                        //changing color

                        dgDTPCol.CheckCellColor +=new EnableCellColorEventHandler(dgTBCol_CheckCellColor);
                        dgDTPCol.TextChangedDTP +=new EventHandler(TextBox_TextChanged);

                        dgTabSt.GridColumnStyles.Add(dgDTPCol);
                        dgDTPCol.Dispose();
                    }
                    else if(CheckButtonColumn(i))
                    {
                        DataGridButtonColumn dgBtnCol = new DataGridButtonColumn(i);

                        dgBtnCol.MappingName = strColNames[i];
                        dgBtnCol.HeaderText = strHeadings[i];

                        dgTabSt.GridColumnStyles.Add(dgBtnCol);
                        dgBtnCol.Dispose();
                    }
                    else
                    {
                        MyGridTextBoxColumn dgTBCol=new MyGridTextBoxColumn(i);

                        dgTBCol.MappingName=strColNames[i];
                        dgTBCol.HeaderText=strHeadings[i];

                        if(_boolPrivScreen)
                        {
                            delegateGetColorRowCol d = new delegateGetColorRowCol(MyGetColorRowCol);
                            dgTBCol.GetColorRowCol = d;
                        }

                        if(CheckReadOnlyColumn(i))
                        {
                            dgTBCol.ReadOnly = true;
                            dgTBCol.TextBox.TabStop = false;
                        }

                        if(CheckRightAlignColumn(i))
                            dgTBCol.Alignment = HorizontalAlignment.Right;
                        if(CheckNumericColumn(i,ref local0))
                        {
                            dgTBCol.TextType = TxtType(arlNumericColumnType[local0].ToString());
                            dgTBCol.IntPrecision = Convert.ToInt32(arlNumericColIntSize[local0].ToString());
                            dgTBCol.DecPrecision = Convert.ToInt32(arlNumericColFloatSize[local0].ToString());
                            dgTBCol.IsCurrency  = Convert.ToBoolean (arlNumericColCurrency[local0].ToString());

                        }
                        else
                        {
                            dgTBCol.TextType = clsTxtBox.TypeEnum.String;
                            dgTBCol.TextBox.MaxLength = getMaxStrLength(i);
                        }
                        dgTBCol.CheckCellEnabled += new EnableCellEventHandler(SetEnableValues);
                        //changing color

                        dgTBCol.CheckCellColor +=new EnableCellColorEventHandler(dgTBCol_CheckCellColor);
                        dgTBCol .KeyTextBox.TextChanged +=new EventHandler(TextBox_TextChanged);

                        dgTabSt.GridColumnStyles.Add(dgTBCol);
                        dgTBCol.Dispose();
                    }
                }

                for(int i=0; i < dtSource.Columns.Count; i++)
                {
                    if(strColNames[i].Length >= 4)
                    {
                        if(strColNames[i].Substring(0,4).ToUpper()=="MASK")
                        {
                            m_strMaskCols += i.ToString() + ",";
                            dgTabSt.GridColumnStyles[i].Width=0;
                        }
                        else
                        {
                            m_strShowCols += i.ToString() + ",";
                        }
                    }
                    dgTabSt.GridColumnStyles[i].NullText = "";
                }

                #region changing for ColSizing

                for(int i=0;i<listOfColumnsForResizing .Count ;i++)
                {
                    colWidth obj = (colWidth)listOfColumnsForResizing[i];
                    dgTabSt.GridColumnStyles[obj.ColumnIndex].Width=obj.ColumnWidth;

                }

                #endregion

                if(m_strMaskCols.Trim() != "")
                {
                    m_strMaskCols = m_strMaskCols.Substring(0,m_strMaskCols.Length-1);
                    string[] local0 = m_strMaskCols.Split(',');

                    intHiddenCols = new int[local0.Length];

                    for(int i=0;i<local0.Length;i++)
                        intHiddenCols[i] = Convert.ToInt32(local0[i]);

                    Array.Sort(intHiddenCols);
                }

                if(m_strShowCols.Trim() != "")
                {
                    m_strShowCols = m_strShowCols.Substring(0,m_strShowCols.Length-1);
                    string[] local0 = m_strShowCols.Split(',');

                    intShowCols = new int[local0.Length];

                    for(int i=0;i<local0.Length;i++)
                        intShowCols[i] = Convert.ToInt32(local0[i]);

                    Array.Sort(intShowCols);
                }

                this.TableStyles.Clear();
                this.TableStyles.Add(dgTabSt);

                this.SetDataBinding( dtSource, "" );					//INDRANIL
                this.Refresh();

                intLoadRowCount = dtSource.Rows.Count;
                intTotalRowCount = intLoadRowCount;

                dgTxt=new MyGridTextBoxColumn[dtSource.Columns.Count];
                DataGridTxtBox=new KeyTrapTextBox[dtSource.Columns.Count];
                dgComboBox = new DataGridComboBoxColumn[intNumComboCols];
                dgDateTimePicker = new DataGridDateTimePicker[intNumDateTimeCols];
                dgButton = new DataGridButtonColumn[intNumButtonCols];

                int m_intComboCount = 0, m_intDTPCount = 0, m_intBtnCount = 0;

                for(int i=0;i<dtSource.Columns.Count;i++)
                {
                    if(CheckComboBoxColumn(i))
                    {
                        dgComboBox[m_intComboCount] =(DataGridComboBoxColumn)this.TableStyles[0].GridColumnStyles[i];
                        ++m_intComboCount;
                    }
                    else if(CheckDateTimeColumn(i))
                    {
                        dgDateTimePicker[m_intDTPCount] = (DataGridDateTimePicker)this.TableStyles[0].GridColumnStyles[i];
                        ++m_intDTPCount;
                    }
                    else if(CheckButtonColumn(i))
                    {
                        dgButton[m_intBtnCount] = (DataGridButtonColumn) this.TableStyles[0].GridColumnStyles[i];
                        ++m_intBtnCount;
                    }
                    else
                    {
                        dgTxt[i]=(MyGridTextBoxColumn)this.TableStyles[0].GridColumnStyles[i];
                        DataGridTxtBox[i]= dgTxt[i].KeyTextBox;
                    }
                }

                dvSource = ((DataTable)this.DataSource).DefaultView;
                dvSource.ListChanged += new ListChangedEventHandler(dvSource_ListChanged);

                this.DoubleBuffered = true;

                this.Paint += new PaintEventHandler(RowHeaderPaint);

                if(this.RowCount > 0)
                    pointInCell00 = new Point(this.GetCellBounds(0,0).X + 4, this.GetCellBounds(0,0).Y + 4);

                this.Scroll += new EventHandler(HorizontalScroll);

                //this.AllowSorting = true;

                return true;
            }
            catch(Exception ex)
            {
                strErrMsg = ex.Source + " - " + ex.Message;
                return false;
            }
        }
Exemple #8
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = ds.Tables[0].TableName;
            ts.AllowSorting         = false;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "id";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "tenkp";
            TextCol1.HeaderText  = "Khoa/phòng";
            TextCol1.Width       = 95;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ngay";
            TextCol1.HeaderText  = "Ngày";
            TextCol1.Width       = 70;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "doituong";
            TextCol1.HeaderText  = "Đối tượng";
            TextCol1.Width       = 58;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Dịch vụ";
            TextCol1.Width       = 230;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "dvt";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 30;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "soluong";
            TextCol1.HeaderText  = "Số lượng";
            TextCol1.Width       = 50;
            TextCol1.Format      = "### ###.00";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "makp";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "madoituong";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "mavp";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol1.MappingName = "dongia";
            TextCol1.HeaderText  = "Đơn gía";
            TextCol1.Width       = 65;
            TextCol1.Format      = "### ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol1.MappingName = "paid";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol1.MappingName = "done";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 13);
            TextCol1.MappingName = "maql";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 14);
            TextCol1.MappingName = "idkhoa";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 15);
            TextCol1.MappingName = "vattu";
            TextCol1.HeaderText  = "Vật tư";
            TextCol1.Width       = 65;
            TextCol1.Format      = "### ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #9
0
        //初始化表头与显示信息
        public bool iniDataGrid(DataGrid dataGrid1, int iPos)
        {
            try
            {
                this.iniDGDataSource(dataGrid1);

                // Create a table style that will hold the new column style
                // that we set and also tie it to our customer's table from our DB
                DataGridTableStyle tableStyle = new DataGridTableStyle();

                DataTable dt = (DataTable)dataGrid1.DataSource;

                tableStyle.MappingName = dt.TableName;

                DataTable dtGprsData = null;
                ArrayList alColsCap  = null;

                //报表格式初始化
                if (getGprsData(ref dtGprsData, ref alColsCap, iPos) == false)
                {
                    return(false);
                }

                // since the dataset has things like field name and number of columns,
                // we will use those to create new columnstyles for the columns in our DB table
                int numCols = dtGprsData.Columns.Count;
                DataGridColoredTextBoxColumn aColumnTextColumn;
                delegateGetColorRowCol       d = new delegateGetColorRowCol(MyGetColorRowCol);

                int[] iColWidths = null;
                getColWidths(ref iColWidths);

                for (int i = 0; i < numCols; i++)
                {
                    aColumnTextColumn             = new DataGridColoredTextBoxColumn(d, i, dtGprsData.Columns[i].ColumnName);
                    aColumnTextColumn.HeaderText  = alColsCap[i].ToString();
                    aColumnTextColumn.Width       = iColWidths[i] - 2;
                    aColumnTextColumn.MappingName = dtGprsData.Columns[i].ColumnName;
                    tableStyle.GridColumnStyles.Add(aColumnTextColumn);
                }

                // make the dataGrid use our new tablestyle and bind it to our table
                dataGrid1.TableStyles.Clear();

                tableStyle.AllowSorting = false;
                //tableStyle.
                dataGrid1.AllowSorting = false;
                dataGrid1.TableStyles.Add(tableStyle);

                DataRow dr = dt.NewRow();
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    dr[i] = "";
                }
                dt.Rows.Add(dr);

                //tableStyle.RowHeadersVisible=false;
                dataGrid1.DataSource = dt;

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
Exemple #10
0
 public DataGridColoredTextBoxColumn(delegateGetColorRowCol getcolorRowCol, int column, string strColName)
 {
     _getColorRowCol = getcolorRowCol;
     _column         = column;
     _colName        = strColName;
 }
Exemple #11
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = dtct.TableName;
            ts.AllowSorting         = false;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "ma";
            TextCol1.HeaderText  = "Mã số";
            TextCol1.Width       = 50;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol1.Width       = (d.bQuanlynguon(i_nhom))?128:208;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "tenhc";
            TextCol1.HeaderText  = "Hoạt chất";
            TextCol1.Width       = 0;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "dang";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 50;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "tennguon";
            TextCol1.HeaderText  = "Nguồn";
            TextCol1.Width       = (d.bQuanlynguon(i_nhom))?80:0;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "slyeucau";
            TextCol1.HeaderText  = "Yêu cầu";
            TextCol1.Width       = 60;
            TextCol1.Format      = "# ### ###.##";
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);


            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "soluong";
            TextCol1.HeaderText  = "Duyệt cấp";
            TextCol1.Width       = 60;
            TextCol1.Format      = "# ### ###.##";
            TextCol1.ReadOnly    = (bSuasoluong_khiduyetkhocap) ? false : true;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "ton";
            TextCol1.HeaderText  = "Tồn kho";
            TextCol1.Width       = 60;
            TextCol1.Format      = "# ### ###.##";
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "sltoithieu";
            TextCol1.HeaderText  = "Tồn tối thiểu";
            TextCol1.Width       = 72;
            TextCol1.Format      = "# ### ##0.00";
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #12
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = ds.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 5;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "tenkp";
            TextCol.HeaderText  = "Khoa";
            TextCol.Width       = 100;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "ngay";
            TextCol.HeaderText  = "Ngày";
            TextCol.Width       = 70;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "tenbd";
            TextCol.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol.Width       = 200;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol.MappingName = "dang";
            TextCol.HeaderText  = "ĐVT";
            TextCol.Width       = 30;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol.MappingName = "soluong";
            TextCol.HeaderText  = "Số lượng";
            TextCol.Width       = 50;
            TextCol.Format      = "#,###,##0.00";
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol.MappingName = "loai";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #13
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = ds.Tables[0].TableName;
            ts.AllowSorting         = false;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "ma";
            TextCol1.HeaderText  = "ma";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "stt";
            TextCol1.HeaderText  = "STT";
            TextCol1.Width       = 24;
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Center;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Các xét nghiệm";
            TextCol1.Width       = 420;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "donvi";
            TextCol1.HeaderText  = "Đơn vị";
            TextCol1.Width       = 100;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "C01";
            TextCol1.HeaderText  = "Tổng số";
            TextCol1.Width       = 100;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "C02";
            TextCol1.HeaderText  = "Trong đó nội trú";
            TextCol1.Width       = 100;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #14
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = dsxml.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.AllowSorting         = false;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 5;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "id";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "ten";
            TextCol.HeaderText  = (i_dang != 0)?"Tên thuốc - hàm lượng":"Nội dung";
            TextCol.Width       = 175 - i_dang + ((theo.SelectedIndex == 4 || rb1.Checked || rb2.Checked)?185:0);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "dang";
            TextCol.HeaderText  = "ĐVT";
            TextCol.Width       = i_dang;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            if (theo.SelectedIndex == 7 || theo.SelectedIndex == 5)
            {
                TextCol             = new DataGridColoredTextBoxColumn(de, 3);
                TextCol.MappingName = "kho";
                TextCol.HeaderText  = "Kho";
                TextCol.Width       = 105;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, 4);
                TextCol.MappingName = "losx";
                TextCol.HeaderText  = (theo.SelectedIndex == 7)?"Lô":"Số ĐK";
                TextCol.Width       = 50;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, 5);
                TextCol.MappingName = "handung";
                TextCol.HeaderText  = "Date";
                TextCol.Width       = 35;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, 6);
                TextCol.MappingName = "soluong";
                TextCol.HeaderText  = "Số lượng";
                TextCol.Width       = 40;
                TextCol.Format      = "###,###,###.##";
                TextCol.Alignment   = HorizontalAlignment.Right;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, 6);
                TextCol.MappingName = "giamua";
                TextCol.HeaderText  = "Đơn giá";
                TextCol.Width       = 60;
                TextCol.Format      = "###,###,###.##";
                TextCol.Alignment   = HorizontalAlignment.Right;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, 7);
                TextCol.MappingName = "sotien";
                TextCol.HeaderText  = "Số tiền";
                TextCol.Width       = 80;
                TextCol.Format      = "###,###,###,###.##";
                TextCol.Alignment   = HorizontalAlignment.Right;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);
            }
            else if (theo.SelectedIndex == 6)
            {
                string ngay;
                int    i = 3;
                for (; i < dsxml.Tables[0].Columns.Count - 2; i++)
                {
                    ngay                = dsxml.Tables[0].Columns[i].ColumnName.ToString().Substring(1);
                    TextCol             = new DataGridColoredTextBoxColumn(de, i);
                    TextCol.MappingName = dsxml.Tables[0].Columns[i].ColumnName.ToString();
                    TextCol.HeaderText  = ngay.Substring(4, 2) + "/" + ngay.Substring(2, 2) + "/" + ngay.Substring(0, 2);
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    TextCol.Width       = 50;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);
                }
                TextCol             = new DataGridColoredTextBoxColumn(de, i + 1);
                TextCol.MappingName = "tyle";
                TextCol.HeaderText  = "Tỷ lệ";
                TextCol.Width       = 35;
                TextCol.Format      = "###.##";
                TextCol.Alignment   = HorizontalAlignment.Right;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);

                TextCol             = new DataGridColoredTextBoxColumn(de, i + 2);
                TextCol.MappingName = "ghichu";
                TextCol.HeaderText  = "Ghi chú";
                TextCol.Width       = 50;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);
            }
            else
            {
                if (rb1.Checked || rb3.Checked)
                {
                    TextCol             = new DataGridColoredTextBoxColumn(de, 3);
                    TextCol.MappingName = "n_so";
                    TextCol.HeaderText  = (i_dang != 0)?"SL":"Số";
                    TextCol.Width       = 30;
                    TextCol.Format      = "#,###,###";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 4);
                    TextCol.MappingName = "n_so_tl";
                    TextCol.HeaderText  = "%";
                    TextCol.Width       = 35;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 5);
                    TextCol.MappingName = "n_tien";
                    TextCol.HeaderText  = "Số tiền nhập";
                    TextCol.Width       = 85;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 6);
                    TextCol.MappingName = "n_tien_tl";
                    TextCol.HeaderText  = "%";
                    TextCol.Width       = 35;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);
                }
                if (rb2.Checked || rb3.Checked)
                {
                    TextCol             = new DataGridColoredTextBoxColumn(de, 7);
                    TextCol.MappingName = "x_so";
                    TextCol.HeaderText  = (i_dang != 0)?"SL":"Số";
                    TextCol.Width       = 30;
                    TextCol.Format      = "#,###,###";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 8);
                    TextCol.MappingName = "x_so_tl";
                    TextCol.HeaderText  = "%";
                    TextCol.Width       = 35;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 9);
                    TextCol.MappingName = "x_tien";
                    TextCol.HeaderText  = "Số tiền xuất";
                    TextCol.Width       = 85;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);

                    TextCol             = new DataGridColoredTextBoxColumn(de, 10);
                    TextCol.MappingName = "x_tien_tl";
                    TextCol.HeaderText  = "%";
                    TextCol.Width       = 35;
                    TextCol.Format      = "#,###,###.##";
                    TextCol.Alignment   = HorizontalAlignment.Right;
                    ts.GridColumnStyles.Add(TextCol);
                    dataGrid1.TableStyles.Add(ts);
                }
            }
        }
Exemple #15
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = ds.Tables[0].TableName;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "tennguon";
            TextCol1.HeaderText  = "Nguồn";
            TextCol1.ReadOnly    = true;
            TextCol1.Width       = 80;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "tennx";
            TextCol1.HeaderText  = "Nhà cung cấp";
            TextCol1.Width       = 200;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol1.Width       = 200;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "dang";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "tenhang";
            TextCol1.HeaderText  = "Hãng SX";
            TextCol1.Width       = 150;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "giamua";
            TextCol1.HeaderText  = "Đơn giá";
            TextCol1.Width       = 70;
            TextCol1.Format      = format_dongia;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "handung";
            TextCol1.HeaderText  = "Date";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "losx";
            TextCol1.HeaderText  = "Lô";
            TextCol1.Width       = 80;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "slton";
            TextCol1.HeaderText  = "Tồn cuối";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "slkk";
            TextCol1.HeaderText  = "Kiểm kê";
            TextCol1.Width       = 60;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol1.MappingName = "thua";
            TextCol1.HeaderText  = "Thừa";
            TextCol1.Width       = 50;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol1.MappingName = "thieu";
            TextCol1.HeaderText  = "Thiếu";
            TextCol1.Width       = 50;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol1.MappingName = "stt";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #16
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = ds.Tables[0].TableName;
            ts.AllowSorting         = false;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "ma";
            TextCol1.HeaderText  = "ma";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "stt";
            TextCol1.HeaderText  = "STT";
            TextCol1.Width       = 24;
            TextCol1.ReadOnly    = true;
            TextCol1.Alignment   = HorizontalAlignment.Center;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Cơ sở, trạm y tế thuộc TTYT huyện";
            TextCol1.Width       = 190;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "C01";
            TextCol1.HeaderText  = "C01";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "C02";
            TextCol1.HeaderText  = "C02";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "C03";
            TextCol1.HeaderText  = "C03";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "C04";
            TextCol1.HeaderText  = "C04";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "C05";
            TextCol1.HeaderText  = "C05";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "C06";
            TextCol1.HeaderText  = "C06";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "C07";
            TextCol1.HeaderText  = "C07";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol1.MappingName = "C08";
            TextCol1.HeaderText  = "C08";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol1.MappingName = "C09";
            TextCol1.HeaderText  = "C09";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol1.MappingName = "C10";
            TextCol1.HeaderText  = "C10";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 13);
            TextCol1.MappingName = "C11";
            TextCol1.HeaderText  = "C11";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 14);
            TextCol1.MappingName = "C12";
            TextCol1.HeaderText  = "C12";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 15);
            TextCol1.MappingName = "C13";
            TextCol1.HeaderText  = "C13";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 16);
            TextCol1.MappingName = "C14";
            TextCol1.HeaderText  = "C14";
            TextCol1.Width       = 39;
            TextCol1.Format      = "# ### ###";
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #17
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = ds.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 5;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "ma";
            TextCol.HeaderText  = "Mã số";
            TextCol.Width       = 50;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "tenbd";
            TextCol.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol.Width       = 200;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "dang";
            TextCol.HeaderText  = "ĐVT";
            TextCol.Width       = 50;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol.MappingName = "tc";
            TextCol.HeaderText  = "Tổng Tồn";
            TextCol.Width       = 72;
            TextCol.Format      = format_soluong;
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
            int i = 4; i_makho = 0;

            foreach (DataRow r in dtkho.Rows)
            {
                if (r["id"].ToString().Trim() + "," == s_kho)
                {
                    i_makho = i;
                }
                TextCol             = new DataGridColoredTextBoxColumn(de, i++);
                TextCol.MappingName = "c_" + r["id"].ToString().PadLeft(3, '0');
                TextCol.HeaderText  = r["ten"].ToString();
                TextCol.Width       = 72;
                TextCol.Format      = format_soluong;
                TextCol.Alignment   = HorizontalAlignment.Right;
                ts.GridColumnStyles.Add(TextCol);
                dataGrid1.TableStyles.Add(ts);
            }
        }
Exemple #18
0
 public DataGridColoredTextBoxColumn(delegateGetColorRowCol getcolorRowCol, int column)
 {
     _getColorRowCol = getcolorRowCol;
     _column         = column;
 }
Exemple #19
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol1;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.MappingName          = dsxml.Tables[0].TableName;

            TextCol1             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol1.MappingName = "ten";
            TextCol1.HeaderText  = "Tên vật tư";
            TextCol1.Width       = 200;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol1.MappingName = "donvi";
            TextCol1.HeaderText  = "Đóng gói";
            TextCol1.Width       = 60;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol1.MappingName = "dang";
            TextCol1.HeaderText  = "ĐVT";
            TextCol1.Width       = 40;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol1.MappingName = "tenhang";
            TextCol1.HeaderText  = "Hãng SX";
            TextCol1.Width       = 150;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol1.MappingName = "dau";
            TextCol1.HeaderText  = "Tồn đầu";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol1.MappingName = "nhap";
            TextCol1.HeaderText  = "Nhập";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol1.MappingName = "xuat";
            TextCol1.HeaderText  = "Xuất";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 7);
            TextCol1.MappingName = "ton";
            TextCol1.HeaderText  = "Tồn kho";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 8);
            TextCol1.MappingName = "tutruc";
            TextCol1.HeaderText  = "Tủ trực";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 9);
            TextCol1.MappingName = "tc";
            TextCol1.HeaderText  = "Tổng tồn";
            TextCol1.Width       = 60;
            TextCol1.ReadOnly    = true;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 10);
            TextCol1.MappingName = "dongia";
            TextCol1.HeaderText  = "Đơn giá";
            TextCol1.Width       = 80;
            TextCol1.Format      = format_dongia;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 11);
            TextCol1.MappingName = "ghichu";
            TextCol1.HeaderText  = "Xuất nhiều nhất";
            TextCol1.Width       = 100;
            TextCol1.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 12);
            TextCol1.MappingName = "l1";
            TextCol1.HeaderText  = "Dự trù " + i_lanthu.ToString();
            TextCol1.Width       = 60;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 13);
            TextCol1.MappingName = "d1";
            TextCol1.HeaderText  = "Duyệt " + i_lanthu.ToString();
            TextCol1.Width       = 60;
            TextCol1.Format      = format_soluong;
            TextCol1.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 14);
            TextCol1.MappingName = "nhacc";
            TextCol1.HeaderText  = "Nhà cung cấp";
            TextCol1.Width       = 200;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);

            TextCol1             = new DataGridColoredTextBoxColumn(de, 15);
            TextCol1.MappingName = "mabd";
            TextCol1.HeaderText  = "";
            TextCol1.Width       = 0;
            ts.GridColumnStyles.Add(TextCol1);
            dataGrid1.TableStyles.Add(ts);
        }
Exemple #20
0
 public DataGridColoredTextBoxColumn(delegateGetColorRowCol getcolorRowCol, int column,string strColName)
 {
     _getColorRowCol = getcolorRowCol;
     _column = column;
     _colName=strColName;
 }
Exemple #21
0
        private void AddGridTableStyle()
        {
            DataGridColoredTextBoxColumn TextCol;
            delegateGetColorRowCol       de = new delegateGetColorRowCol(MyGetColorRowCol);
            DataGridTableStyle           ts = new DataGridTableStyle();

            ts.MappingName          = ds.Tables[0].TableName;
            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.ReadOnly             = false;
            ts.RowHeaderWidth       = 5;

            TextCol             = new DataGridColoredTextBoxColumn(de, 0);
            TextCol.MappingName = "ngay";
            TextCol.HeaderText  = "Ngày";
            TextCol.Width       = 70;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 1);
            TextCol.MappingName = "tenkp";
            TextCol.HeaderText  = "Khoa";
            TextCol.Width       = 100;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 2);
            TextCol.MappingName = "tenloai";
            TextCol.HeaderText  = "Loại";
            TextCol.Width       = 90;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 3);
            TextCol.MappingName = "tenphieu";
            TextCol.HeaderText  = "Phiếu";
            TextCol.Width       = 185;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol.MappingName = "nguoithuhoi";
            TextCol.HeaderText  = "Người thu hồi";
            TextCol.Width       = 120;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 5);
            TextCol.MappingName = "thuhoiluc";
            TextCol.HeaderText  = "Thu hồi lúc";
            TextCol.Width       = 120;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 6);
            TextCol.MappingName = "mmyy";
            TextCol.HeaderText  = "MMYY";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridColoredTextBoxColumn(de, 4);
            TextCol.MappingName = "loai";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }