public CodeMass(CodeMassEntry parent) { InitializeComponent(); cme = parent; //this.richTextBox1.Text = cmm.ShowData("select * from CodeMass order by id"); //this.richTextBox1.ReadOnly = true; this.dataGridView1.DataSource = cmm.GetDataByQuery(); this.dataGridView1.DataMember = "T_CLASS"; //this.dataGridView1.bi dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; string [] HoldCenter = new string[] { "Language", "AddTime", "UpdateTime" }; foreach (DataGridViewColumn item in this.dataGridView1.Columns) { if (HoldCenter.Contains(item.Name)) { item.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } } for (int i = 0; i < dataGridView1.Columns.Count; i++) { dataGridView1.Columns[i].CellTemplate.Style.WrapMode = DataGridViewTriState.True; } Font font = new Font("UTF-8", 15); //Font font = new Font("Consolas", 15); dataGridView1.Font = font; dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dataGridView1.ReadOnly = true; dataGridView1.Columns[0].Width = 55; // AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[1].Width = 300; //.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[2].Width = 95; // = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[3].Width = 310; //.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[4].Width = 180; //.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[5].Width = 180; //.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[6].Width = 60; //.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[6].Visible = false; dataGridView1.Width = 1180; dataGridView1.Height = this.Height - 30 - this.richTextBox1.Height; this.Width = 1180; this.richTextBox1.Width = 1025; this.richTextBox1.SelectAll(); this.richTextBox1.SelectionCharOffset = -4; Delay.Interval = 500; Delay.Tick += new System.EventHandler(this.UpdateSheet); this.richTextBox2.SelectionAlignment = HorizontalAlignment.Right; this.richTextBox2.SelectAll(); this.richTextBox2.SelectionCharOffset = -6; }
public Insert(CodeMassEntry parent) { InitializeComponent(); cme = parent; Font font = new Font("UTF-8", 11); name.Font = font; comments.Font = font; code.Font = font; name.SelectionAlignment = HorizontalAlignment.Left; comments.SelectionAlignment = HorizontalAlignment.Left; comments.SelectAll(); comments.SelectionColor = Color.Gray; comments.SelectionCharOffset = -14; }
public CodeMass(CodeMassEntry parent) { InitializeComponent(); cme = parent; //this.richTextBox1.Text = cmm.ShowData("select * from CodeMass order by id"); //this.richTextBox1.ReadOnly = true; this.dataGridView1.DataSource = cmm.GetDataByQuery(); this.dataGridView1.DataMember = "T_CLASS"; //this.dataGridView1.bi dataGridView1.ColumnHeadersDefaultCellStyle.Alignment=DataGridViewContentAlignment.MiddleCenter; string [] HoldCenter=new string[]{"Language","AddTime","UpdateTime"}; foreach (DataGridViewColumn item in this.dataGridView1.Columns) { if(HoldCenter.Contains(item.Name)) item.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } for (int i = 0; i < dataGridView1.Columns.Count;i++ ) dataGridView1.Columns[i].CellTemplate.Style.WrapMode = DataGridViewTriState.True; Font font = new Font("UTF-8", 15); //Font font = new Font("Consolas", 15); dataGridView1.Font = font; dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dataGridView1.ReadOnly = true; dataGridView1.Columns[0].Width = 55;// AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[1].Width = 300;//.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[2].Width = 95;// = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[3].Width = 310;//.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[4].Width = 180;//.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[5].Width = 180;//.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[6].Width = 60;//.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridView1.Columns[6].Visible = false; dataGridView1.Width = 1180; dataGridView1.Height = this.Height-30-this.richTextBox1.Height; this.Width = 1180; this.richTextBox1.Width = 1025; this.richTextBox1.SelectAll(); this.richTextBox1.SelectionCharOffset = -4; Delay.Interval = 500; Delay.Tick += new System.EventHandler(this.UpdateSheet); this.richTextBox2.SelectionAlignment = HorizontalAlignment.Right; this.richTextBox2.SelectAll(); this.richTextBox2.SelectionCharOffset = -6; }