示例#1
0
        private void AddGridTableStyle2()
        {
            dataGrid2.TableStyles.Clear();
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dtdetail.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 3;
            ts.AllowSorting         = false;

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "tennguon";
            TextCol.HeaderText  = "Nguồn";
            TextCol.Width       = 70;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "tenbd";
            TextCol.HeaderText  = "Tên thuốc - hàm lượng";
            TextCol.Width       = 200;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "dang";
            TextCol.HeaderText  = "ĐVT";
            TextCol.Width       = 30;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "soluong";
            TextCol.HeaderText  = "SL";
            TextCol.Width       = 50;
            TextCol.ReadOnly    = true;
            TextCol.Alignment   = HorizontalAlignment.Right;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);
        }
示例#2
0
        private void AddGridTableStyle()
        {
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dsmabn.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 5;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "...";
            discontinuedCol.Width       = 20;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid1.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "mabn";
            TextCol.HeaderText     = "Mã BN";
            TextCol.Width          = 60;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "hoten";
            TextCol.HeaderText     = "Họ tên";
            TextCol.Width          = 145;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
示例#3
0
        private void AddGridTableStyle()
        {
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dt.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 3;
            ts.AllowSorting         = false;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "Phát";
            discontinuedCol.Width       = 30;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid1.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "ngay";
            TextCol.HeaderText     = "Ngày";
            TextCol.Width          = 70;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenkp";
            TextCol.HeaderText     = "Khoa";
            TextCol.Width          = 180;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenphieu";
            TextCol.HeaderText     = "Phiếu";
            TextCol.Width          = 150;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenloai";
            TextCol.HeaderText     = "Loại";
            TextCol.Width          = 205;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenkho";
            TextCol.HeaderText     = "Kho";
            TextCol.Width          = 115;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "loai";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "phieu";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "makp";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "makho";
            TextCol.HeaderText  = "";
            TextCol.Width       = 0;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
示例#4
0
        private void AddGridTableStyle()
        {
            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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 5;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "Chọn";
            discontinuedCol.Width       = 30;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid1.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "sophieu";
            TextCol.HeaderText     = "Số phiếu";
            TextCol.Width          = 60;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ngaysp";
            TextCol.HeaderText     = "Ngày";
            TextCol.Width          = 65;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "sohd";
            TextCol.HeaderText     = "Số hóa đơn";
            TextCol.Width          = 100;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ngayhd";
            TextCol.HeaderText     = "Ngày";
            TextCol.Width          = 65;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "madv";
            TextCol.HeaderText     = "Nhà cung cấp";
            TextCol.Width          = 180;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "no";
            TextCol.HeaderText     = "Nợ";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = false;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "co";
            TextCol.HeaderText     = "Có";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = false;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "sotien";
            TextCol.HeaderText  = "Số tiền";
            TextCol.Width       = 70;
            TextCol.ReadOnly    = true;
            TextCol.Alignment   = HorizontalAlignment.Right;
            TextCol.Format      = format_sotien;
            //TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "datra";
            TextCol.HeaderText  = "Đã trả";
            TextCol.Width       = 70;
            TextCol.ReadOnly    = true;
            //TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            TextCol.Alignment = HorizontalAlignment.Right;
            TextCol.Format    = format_sotien;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
示例#5
0
        private void AddGridTableStyle()
        {
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dsdm.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 5;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "Chọn";
            discontinuedCol.Width       = 30;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid1.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "mabd";
            TextCol.HeaderText     = "";
            TextCol.Width          = 0;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ma";
            TextCol.HeaderText     = "Mã số";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenhc";
            TextCol.HeaderText     = "Hoạt chất";
            TextCol.Width          = 120;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ten";
            TextCol.HeaderText     = "Tên";
            TextCol.Width          = 250;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "dang";
            TextCol.HeaderText     = "ĐVT";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tennhom";
            TextCol.HeaderText     = "Nhóm";
            TextCol.Width          = 150;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenloai";
            TextCol.HeaderText     = "Loại";
            TextCol.Width          = 150;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenhang";
            TextCol.HeaderText     = "Hãng";
            TextCol.Width          = 150;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tennuoc";
            TextCol.HeaderText     = "Nước SX";
            TextCol.Width          = 55;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tennhacc";
            TextCol.HeaderText     = "Nhà cung cấp";
            TextCol.Width          = 100;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
示例#6
0
        private void AddGridTableStyle2()
        {
            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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 3;
            ts.AllowSorting         = false;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "Bỏ";
            discontinuedCol.Width       = 20;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat2);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged2);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid2.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "hoten";
            TextCol.HeaderText     = "Họ tên";
            TextCol.Width          = 0;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "ma";
            TextCol.HeaderText  = "Mã";
            TextCol.Width       = 60;
            //TextCol.ReadOnly=true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ten";
            TextCol.HeaderText     = "Tên thuốc";
            TextCol.Width          = 180;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "dang";
            TextCol.HeaderText     = "ĐVT";
            TextCol.Width          = 35;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "soluong";
            TextCol.HeaderText     = "Số lượng";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "makho";
            TextCol.HeaderText     = "";
            TextCol.Width          = 0;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "giaban";
            TextCol.HeaderText     = "Đơn gía";
            TextCol.Width          = 60;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "sotienban";
            TextCol.HeaderText     = "Số tiền";
            TextCol.Width          = 60;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid2.TableStyles.Add(ts);
        }
示例#7
0
        private void AddGridTableStyle()
        {
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dt.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 3;

            DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn();

            TextCol.MappingName = "mabn";
            TextCol.HeaderText  = "Mã";
            TextCol.Width       = 60;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridTextBoxColumn();
            TextCol.MappingName = "hoten";
            TextCol.HeaderText  = "Họ tên";
            TextCol.Width       = 150;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new DataGridTextBoxColumn();
            TextCol.MappingName = "doituong";
            TextCol.HeaderText  = "Đối tượng";
            TextCol.Width       = 60;
            TextCol.ReadOnly    = true;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "tennguon";
            TextCol.HeaderText  = "Nguồn";
            TextCol.Width       = 90;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "tenkho";
            TextCol.HeaderText  = "Kho";
            TextCol.Width       = 90;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "ten";
            TextCol.HeaderText  = "Tên";
            TextCol.Width       = 170;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "dang";
            TextCol.HeaderText  = "ĐVT";
            TextCol.Width       = 40;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "slyeucau";
            TextCol.HeaderText  = "Yêu cầu";
            TextCol.Width       = 50;
            TextCol.ReadOnly    = true;
            TextCol.Format      = format_soluong;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol             = new FormattableTextBoxColumn();
            TextCol.MappingName = "slthuc";
            TextCol.HeaderText  = "Đã duyệt";
            TextCol.Width       = 55;
            TextCol.Format      = format_soluong;
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);
        }
示例#8
0
        private void AddGridTableStyle()
        {
            DataGridTableStyle ts = new DataGridTableStyle();

            ts.MappingName          = dsdm.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.FromArgb(0, 255, 255);
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 5;

            FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn();

            discontinuedCol.MappingName = "chon";
            discontinuedCol.HeaderText  = "Chọn";
            discontinuedCol.Width       = 30;
            discontinuedCol.AllowNull   = false;

            discontinuedCol.SetCellFormat    += new FormatCellEventHandler(SetCellFormat);
            discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged);
            ts.GridColumnStyles.Add(discontinuedCol);
            dataGrid1.TableStyles.Add(ts);

            FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn();

            TextCol.MappingName    = "ma";
            TextCol.HeaderText     = "Mã";
            TextCol.Width          = 100;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "ten";
            TextCol.HeaderText     = "Tên";
            TextCol.Width          = 365;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "dang";
            TextCol.HeaderText     = "ĐVT";
            TextCol.Width          = 50;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            TextCol                = new FormattableTextBoxColumn();
            TextCol.MappingName    = "tenhc";
            TextCol.HeaderText     = "Hoạt chất";
            TextCol.Width          = 200;
            TextCol.ReadOnly       = true;
            TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat);
            ts.GridColumnStyles.Add(TextCol);
            dataGrid1.TableStyles.Add(ts);

            DataGridComboBoxColumn ComCol = new DataGridComboBoxColumn(dtdoituong, 1, 1);

            ComCol.MappingName    = "doituong";
            ComCol.HeaderText     = "Đối tượng";
            ComCol.Width          = 100;
            ComCol.ReadOnly       = false;
            ComCol.Alignment      = HorizontalAlignment.Left;
            ComCol.NullText       = string.Empty;
            dataGrid1.CaptionText = string.Empty;
            ts.GridColumnStyles.Add(ComCol);
            dataGrid1.TableStyles.Add(ts);

            //ts.GridColumnStyles.Add(new DataGridComboBoxColumn(dtdoituong, "doituong", "madoituong"));
            //ts.GridColumnStyles[6].MappingName = "tenkp";
            //ts.GridColumnStyles[6].HeaderText = "Chuyển phòng";
            //ts.GridColumnStyles[6].Width = 160;
            //ts.GridColumnStyles[6].Alignment = HorizontalAlignment.Left;
            //ts.GridColumnStyles[6].NullText = string.Empty;
            //dataGrid1.CaptionText = string.Empty;
        }