📄 winface.cs
字号:
using System;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
namespace GEROSYS
{
/// <summary>
/// WinFace 的摘要说明。
/// </summary>
public class WinFace
{
private long _DefineTop;
private long _DefineLeft;
private long _DefineHeight;
private long _DefineWidth;
public WinFace()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public long DefineTop
{
get
{
return this._DefineTop ;
}
set
{
_DefineTop = value ;
}
}
public long DefineLeft
{
get
{
return this._DefineLeft ;
}
set
{
_DefineLeft = value ;
}
}
public long DefineHeight
{
get
{
return this._DefineHeight ;
}
set
{
_DefineHeight = value ;
}
}
public long DefineWidth
{
get
{
return this._DefineWidth ;
}
set
{
_DefineWidth = value ;
}
}
public void InitGrid(DataGrid dataGrid) //初始化网格
{
dataGrid.BackColor = Color.GhostWhite;
dataGrid.BackgroundColor = Color.Lavender;
dataGrid.BorderStyle = BorderStyle.None;
dataGrid.CaptionBackColor = Color.RoyalBlue;
dataGrid.CaptionFont = new Font("Tahoma", 10.0F, FontStyle.Bold);
dataGrid.CaptionForeColor = Color.Bisque;
dataGrid.Font = new Font("Tahoma", 8.0F);
dataGrid.ParentRowsBackColor = Color.Lavender;
dataGrid.ParentRowsForeColor = Color.MidnightBlue;
}
public void GridListView(string lsSQL,DataGrid dataGrid,string[] DataField,string[] TitleName)
{
AccessData AppClient=new AccessData ();
DataTable dtTable =new DataTable();
try
{
dtTable=AppClient.SelectSQL(lsSQL);
dataGrid.DataSource = dtTable;
DataGridTableStyle grdTableStyle1 = new DataGridTableStyle();
grdTableStyle1.AlternatingBackColor = Color.GhostWhite;
grdTableStyle1.BackColor = Color.GhostWhite;
grdTableStyle1.ForeColor = Color.MidnightBlue;
grdTableStyle1.GridLineColor = Color.RoyalBlue;
grdTableStyle1.HeaderBackColor = Color.MidnightBlue;
grdTableStyle1.HeaderFont = new Font("Tahoma", 8.0F, FontStyle.Bold);
grdTableStyle1.HeaderForeColor = Color.Lavender;
grdTableStyle1.SelectionBackColor = Color.Teal;
grdTableStyle1.SelectionForeColor = Color.PaleGreen;
grdTableStyle1.MappingName = dtTable.TableName;
grdTableStyle1.RowHeaderWidth =8;
DataGridTextBoxColumn[] grdColStyle1 = new DataGridTextBoxColumn[TitleName.Length];
for (int liCount=0;liCount<DataField.Length;liCount++)
{
grdColStyle1[liCount] = new DataGridTextBoxColumn();
grdColStyle1[liCount].HeaderText = TitleName[liCount];
grdColStyle1[liCount].MappingName = DataField[liCount];
grdColStyle1[liCount].Width =120;
}
grdTableStyle1.GridColumnStyles.AddRange( grdColStyle1);
dataGrid.TableStyles.Clear();
dataGrid.TableStyles.Add(grdTableStyle1);
}
catch(Exception ms)
{
MessageBox.Show(ms.Message, "General Error");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -