WinForm相关注意点

1.

//this.dgvEmployees.ColumnHeadersDefaultCellStyle.ForeColor = Color.Blue;
//dgvEmployees.RowHeadersVisible = false;//列头影藏
//dgvEmployees.Columns["image_path"].Visible = false;//图片路径列隐藏
//dgvEmployees.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);

2.    pibFinger.ImageLocation = this.dgvEmployees.CurrentRow.Cells["image_path"].Value.ToString();

3,dgvEmployees.DataSource = oWork.GetDataByEmployeeID(0).Tables[0];

4.

/// <summary>
/// 设置DataGridView控件风格,默认是单选整行
/// </summary>
/// <param name="dgvControl">DataGridView</param>
/// <param name="dgvsmMode">DataGridViewSelectionMode</param>
/// <param name="bMultiSelect">MultiSelect</param>
public static void SetDataGridViewStyle(DataGridView dgvControl, DataGridViewSelectionMode dgvsmMode, Boolean bMultiSelect)
{
dgvControl.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(170, 226, 254);
dgvControl.RowHeadersDefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(170, 226, 254);
dgvControl.BackgroundColor = System.Drawing.Color.FromArgb(170, 226, 254);
dgvControl.GridColor = System.Drawing.Color.FromArgb(170, 226, 254);
dgvControl.ReadOnly = true;
dgvControl.AllowUserToAddRows = false;
dgvControl.SelectionMode = dgvsmMode;
dgvControl.MultiSelect = bMultiSelect;
}

 

5.Transparent

和自定义DataGridView   enablevaluestyle=false;

 

 
posted @ 2013-11-06 16:48  Mark1997  阅读(212)  评论(0编辑  收藏  举报