using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Windows.Forms;
|
using Pub_Class;
|
using System.Drawing;
|
using System.Data;
|
|
namespace DBUtility
|
{
|
public class Xt_BaseBillFun
|
{
|
|
public static bool Changelock;
|
public static bool EditStatus;
|
public static Int32 NoCol;
|
|
//ÉèÖÃÁбíSQL¹ýÂËÌõ¼þ
|
public static void Sub_SQLWhere(ref string sWhere)
|
{
|
//
|
}
|
|
//ÅÐ¶Ï»á¼ÆÆÚ¼ä
|
public static bool Fun_AllowYearPeriod(DateTime dtpHDate, ref int sYear, ref int sPeriod, ref string s)
|
{
|
//»ñÈ¡±¾ÆÚ»á¼ÆÆÚ¼ä
|
int CurYear = 0;
|
int CurPeriod = 0;
|
if (DBUtility.ClsPub.Sub_GetCurPeriod(ref CurYear, ref CurPeriod) == false)
|
{
|
s = "»ñÈ¡»á¼ÆÆÚ¼äʧ°Ü!";
|
return false;
|
}
|
if (ClsPub.Sub_GetPeriodByDate(ClsPub.isDate(dtpHDate, 0), ref sYear, ref sPeriod))
|
{
|
if (!(sYear * 100 + sPeriod >= CurYear * 100 + CurPeriod))
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚµÄ»á¼ÆÆÚ¼äÒѽáÕË£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
}
|
else
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚ²»ÊôÓÚºÏÀíµÄ»á¼ÆÆÚ¼ä£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
return true;
|
}
|
|
//ÅжϹ¤×Ê-»á¼ÆÆÚ¼ä
|
public static bool Fun_AllowYearPeriod_Pay(DateTime dtpHDate, ref int sYear, ref int sPeriod, ref string s)
|
{
|
//»ñÈ¡±¾ÆÚ»á¼ÆÆÚ¼ä
|
int CurYear = 0;
|
int CurPeriod = 0;
|
if (DBUtility.ClsPub.Sub_GetCurPeriod_Pay(ref CurYear, ref CurPeriod) == false)
|
{
|
s = "»ñÈ¡»á¼ÆÆÚ¼äʧ°Ü!";
|
return false;
|
}
|
if (ClsPub.Sub_GetPeriodByDate_Pay(ClsPub.isDate(dtpHDate, 0), ref sYear, ref sPeriod))
|
{
|
if (!(sYear * 100 + sPeriod >= CurYear * 100 + CurPeriod))
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚµÄ»á¼ÆÆÚ¼äÒѽáÕË£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
}
|
else
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚ²»ÊôÓÚºÏÀíµÄ»á¼ÆÆÚ¼ä£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
return true;
|
}
|
|
////ÅÐ¶Ï»á¼ÆÆÚ¼ä
|
//public static bool Fun_AllowYearPeriod(DateTime dtpHDate, ref int sYear,ref int sPeriod,ref string s)
|
//{
|
// if (ClsPub.Sub_GetPeriodByDate(ClsPub.isDate(dtpHDate, 0), ref sYear, ref sPeriod))
|
// {
|
// if (!(sYear * 100 + sPeriod >= ClsPub.CurYear * 100 + ClsPub.CurPeriod))
|
// {
|
// s= "ÄúÑ¡ÔñµÄÈÕÆÚµÄ»á¼ÆÆÚ¼äÒѽáÕË£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
// return false;
|
// }
|
// }
|
// else
|
// {
|
// s= "ÄúÑ¡ÔñµÄÈÕÆÚ²»ÊôÓÚºÏÀíµÄ»á¼ÆÆÚ¼ä£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
// return false;
|
// }
|
// return true;
|
//}
|
|
//ÅжÏK3»á¼ÆÆÚ¼ä
|
public static bool Fun_AllowYearPeriodK3(DateTime dtpHDate, ref int sYear, ref int sPeriod, ref string s)
|
{
|
if (ClsPub.Sub_GetPeriodByDateK3(ClsPub.isDate(dtpHDate, 0), ref sYear, ref sPeriod))
|
{
|
if (!(sYear * 100 + sPeriod >= ClsPub.CurYear * 100 + ClsPub.CurPeriod))
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚµÄ»á¼ÆÆÚ¼äÒѽáÕË£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
}
|
else
|
{
|
s = "ÄúÑ¡ÔñµÄÈÕÆÚ²»ÊôÓÚºÏÀíµÄ»á¼ÆÆÚ¼ä£¡ÇëÓë¹ÜÀíÔ±ÁªÏµ";
|
return false;
|
}
|
return true;
|
}
|
|
//¹Ø±ÕǰÅжÏ
|
public static bool Fun_AllowCloseBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
//·´¹Ø±ÕǰÅжÏ
|
public static bool Fun_AllowCancelBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
//×÷·ÏǰÅжÏ
|
public static bool Fun_AllowCancelltionBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
//»Ö¸´×÷·ÏǰÅжÏ
|
public static bool Fun_AllowAbandonCancelltionBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
|
//·´ÉóºËǰÅжÏ
|
public static bool Fun_AllowAbandonCheckBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
//ÉóºËǰÅжÏ
|
public static bool Fun_AllowCheckBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
|
//ɾ³ýǰÅжÏ
|
public static bool Fun_AllowDeleteBill(object oBill, ref string s)
|
{
|
return true;
|
}
|
|
//±à¼Ç°ÅжÏ
|
public static bool Fun_AllowEditBill(object oBill,ref string s)
|
{
|
return true;
|
}
|
|
|
|
//·´ÉóºËǰÅжÏ
|
public static bool Fun_AllowAbandonCheckBill(string HChecker, ref string s)
|
{
|
if (HChecker != ClsPub.CurUserName)
|
{
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
|
|
|
|
//ɾ³ýǰÅжÏ
|
public static bool Fun_AllowDeleteBill(string HMaker, ref string s)
|
{
|
if (HMaker != ClsPub.CurUserName)
|
{
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
|
|
|
|
//±à¼Ç°ÅжÏ
|
public static bool Fun_AllowEditBill(string HMaker, ref string s)
|
{
|
//if (HMaker != ClsPub.CurUserName)
|
//{
|
// return false;
|
//}
|
//else
|
//{
|
return true;
|
//}
|
}
|
|
//Çå¿Õ½çÃæ
|
public static void Sub_ClearBill2(SplitterPanel gbUp)
|
{
|
//Çå¿Õ½çÃæ¿Ø¼þ for ¿Ø¼þ
|
foreach (Control ct in gbUp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "ListBox":
|
((ListBox)ct).Items.Clear();
|
break;
|
case "CheckBox":
|
//((CheckBox)ct).Checked = false;
|
break;
|
case "RadioButton":
|
|
break;
|
case "ComboBox":
|
((ComboBox)ct).SelectedIndex = 0;
|
break;
|
case "TextBox":
|
((TextBox)ct).Text = "";
|
break;
|
case "DateTimePicker":
|
((DateTimePicker)ct).Value = DateTime.Today;
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
//Çå¿Õ½çÃæ
|
public static void Sub_ClearBill1(TabPage gbUp)
|
{
|
//Çå¿Õ½çÃæ¿Ø¼þ for ¿Ø¼þ
|
foreach (Control ct in gbUp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "ListBox":
|
((ListBox)ct).Items.Clear();
|
break;
|
case "CheckBox":
|
//((CheckBox)ct).Checked = false;
|
break;
|
case "RadioButton":
|
|
break;
|
case "ComboBox":
|
((ComboBox)ct).SelectedIndex = 0;
|
break;
|
case "TextBox":
|
((TextBox)ct).Text = "";
|
break;
|
case "DateTimePicker":
|
((DateTimePicker)ct).Value = ClsPub.isDate(ClsPub.GetServerDate(0));
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
|
//Çå¿Õ½çÃæ
|
public static void Sub_ClearBill(GroupBox gbUp)
|
{
|
//Çå¿Õ½çÃæ¿Ø¼þ for ¿Ø¼þ
|
foreach (Control ct in gbUp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "ListBox":
|
((ListBox)ct).Items.Clear();
|
break;
|
case "CheckBox":
|
((CheckBox)ct).Checked = false;
|
break;
|
case "RadioButton":
|
|
break;
|
case "ComboBox":
|
((ComboBox)ct).SelectedIndex = 0;
|
break;
|
case "TextBox":
|
((TextBox)ct).Text = "";
|
break;
|
case "DateTimePicker":
|
((DateTimePicker)ct).Value =ClsPub.isDate(ClsPub.GetServerDate(0)) ;
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
|
|
//³õʼ»¯Íø¸ñ
|
public static void initGridFst(DataGridView grdMain, string Name)
|
{
|
grdMain.RowTemplate.Height = 18; //ÐиßÉèÖÃ
|
grdMain.RowTemplate.MinimumHeight = 18; //×îСÐиß
|
grdMain.ColumnHeadersHeight = 40; //±êÌâÐиß
|
grdMain.RowHeadersVisible = false; //¹Ì¶¨ÁÐÊÇ·ñÏÔʾ
|
grdMain.ColumnHeadersVisible = true; //¹Ì¶¨ÐÐÊÇ·ñÏÔʾ
|
grdMain.RowCount = 1; //×ÜÐÐÊý
|
for (int i = 0; i < grdMain.ColumnCount; i++)
|
{
|
grdMain.Columns[i].Width = 100; //ÉèÖà Áпí
|
grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; //ÁÐ ÅÅÐòģʽ
|
|
}
|
//
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.Black; //ÐÐÑ¡ÖÐ×ÖÌåÑÕÉ«
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; //ÄÚÈݲ¼¾Ö£¨¾ÓÖУ¬¿¿ÓÒ£©
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//±êÌâÐв¼¾Ö£¨¾ÓÖУ¬¿¿ÓÒ
|
grdMain.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;//±êÌâÐÐ×Ô¶¯»»ÐÐ
|
grdMain.SelectionMode = DataGridViewSelectionMode.CellSelect; //Ñ¡ÐÐģʽ
|
grdMain.ReadOnly = false; //ÊÇ·ñÖ»¶Á
|
grdMain.EditMode = DataGridViewEditMode.EditOnEnter; //±à¼Ä£Ê½
|
grdMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //±êÌâÐÐ¸ß µ÷Õûģʽ
|
grdMain.EnableHeadersVisualStyles = false; //±êÌâ ÏÔʾÑùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = false; //ÊÇ·ñÔÊÐíÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White; //Íø¸ñ±³¾°É«
|
grdMain.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.AntiqueWhite; //Ñ¡ÖÐʱ±³¾°ÑÕÉ«
|
grdMain.ShowCellToolTips = false; //Êó±êÍ£Áô ÏÔʾÌáʾ
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSteelBlue; //±êÌâÁÐ ±³¾°É«
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
ClsPub.HideGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
grdMain.RowCount = 20; //×ÜÐÐÊý(¸ü¸ÄÐÐÊýʱ£¬»á´¥·¢ ±à¼Ç°Ê¼þ)
|
}
|
|
//³õʼ»¯Íø¸ñ2
|
public static void initGridLast(string sAllowCol, string sTotalCol,ClsGridViewSum oSumGrid)
|
{
|
string[] sA;
|
string[] sT;
|
sA = sAllowCol.Split(Convert.ToChar(","));
|
sT = sTotalCol.Split(Convert.ToChar(","));
|
//
|
oSumGrid.BuildAllowEditCols(sA);
|
oSumGrid.BuildTotalCols(sT);
|
oSumGrid.SetGridsum();
|
oSumGrid.SetGridMain();
|
}
|
|
//³õʼ»¯Íø¸ñ3
|
/// <summary>
|
/// ³õʼ»¯Íø¸ñ3 Î޺ϼÆÍø¸ñ
|
/// </summary>
|
/// <param name="sAllowCol"></param>
|
/// <param name="oMainGrid"></param>
|
public static void initGridLast(string sAllowCol, ClsGridViewFun oMainGrid)
|
{
|
string[] sA;
|
sA = sAllowCol.Split(Convert.ToChar(","));
|
//
|
oMainGrid.BuildAllowEditCols(sA);
|
}
|
|
//ÊÇ·ñ¿ÕÐÐ
|
public static bool IsNullRow(int Row,int Col,DataGridView grdMain)
|
{
|
if (ClsPub.isLong(grdMain.Rows[Row].Cells[Col].Value) == 0)
|
{
|
return true;
|
}
|
return false;
|
}
|
//ÅжÏÊÇ·ñÔÊÐí±à¼
|
public static bool AllowEdit(bool grdStatus, ClsGridViewSum oSumGrid,int Col)
|
{
|
if (!grdStatus) //ä¯ÀÀģʽϲ»Äܱà¼
|
{
|
return true;
|
}
|
if (oSumGrid.FindAllowEditCol(Col) == false) //·Ç¿É±à¼ÁÐ ²»Äܱà¼
|
{
|
return true;
|
}
|
return false;
|
}
|
|
//ÅжÏÊÇ·ñÔÊÐí±à¼
|
public static bool AllowEdit( ClsGridViewFun oMainGrid, int Col)
|
{
|
|
if (oMainGrid.FindAllowEditCol(Col) == false) //·Ç¿É±à¼ÁÐ ²»Äܱà¼
|
{
|
return true;
|
}
|
return false;
|
}
|
|
|
//ÉèÖúϼÆÍø¸ñ
|
public static void SetSumGrid(ClsGridViewSum oSumGrid)
|
{
|
oSumGrid.SetGridsum(); //ÉèÖúϼÆ
|
oSumGrid.Total(); //ºÏ¼Æ
|
}
|
|
public static void AddRow(ClsGridViewSum oSumGrid)
|
{
|
oSumGrid.Sub_AddRow();
|
}
|
|
public static void AddRow(ClsGridViewFun oMainGrid)
|
{
|
oMainGrid.Sub_AddRow();
|
}
|
|
public static void DelRow(ClsGridViewSum oSumGrid)
|
{
|
oSumGrid.Sub_DelRow();
|
}
|
|
public static void DelRow(ClsGridViewFun oMainGrid)
|
{
|
oMainGrid.Sub_DelRow();
|
}
|
|
public static void SaveGrid(DataGridView grdMain,string Name)
|
{
|
ClsPub.SaveGridView(grdMain,Name,ClsPub.AppPath);
|
}
|
|
|
|
public static void GetGrid(DataGridView grdMain,string Name)
|
{
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);
|
}
|
|
|
|
|
public static void DefaultGridView(DataGridView grdMain,string Name)
|
{
|
ClsPub.DefaultGridView(grdMain);
|
//²ÎÊý½âÊÍ ¿ªÊ¼ÁÐ £¬½áÊøÁУ¬ÊÇ·ñÒÔ×î´óÁпíΪ׼£¬×îСÁпí
|
ClsPub.SaveGridView(grdMain, Name,ClsPub.AppPath);
|
}
|
|
|
|
public static Int32 Fun_GetCol(string sCol,DataGridView grdMain)
|
{
|
for (int c = 0; c < grdMain.ColumnCount; c++)
|
{
|
if (ClsPub.isStrNull(grdMain.Columns[c].HeaderText).ToUpper().Trim() == sCol.Trim().ToUpper())
|
{
|
return c;
|
}
|
}
|
return -1;
|
}
|
|
|
|
|
public static void GraphLine(DataGridView grdMain,int MainIDCol,int SubIDCol,string s,ref long n)
|
{
|
long HMainID = 0;
|
bool b = false;
|
//Ñ»·ËùÓÐÐÐ
|
for (int i = 0; i < grdMain.RowCount; i++)
|
{
|
if (HMainID == 0)
|
{
|
HMainID = ClsPub.isLong(grdMain.Rows[i].Cells[MainIDCol].Value);
|
n++;
|
}
|
else
|
{
|
if (HMainID == ClsPub.isLong(grdMain.Rows[i].Cells[MainIDCol].Value))
|
{
|
if (s == "·ñ")
|
{
|
//ÇøÓòÐÔÇå¿Õ
|
SetDataGrid(grdMain,i, MainIDCol + 1, i, SubIDCol - 1, "");
|
|
}
|
}
|
else
|
{
|
HMainID = ClsPub.isLong(grdMain.Rows[i].Cells[MainIDCol].Value);
|
b = !b;
|
n++;
|
}
|
}
|
if (b)
|
{
|
grdMain.Rows[i].DefaultCellStyle.BackColor = Color.White;
|
}
|
else
|
{
|
grdMain.Rows[i].DefaultCellStyle.BackColor = Color.Lavender;
|
}
|
}
|
}
|
|
|
//ÉèÖÃÍø¸ñ
|
public static void SetDataGrid(DataGridView grdMain, int BRow, int BCol, int ERow, int ECol, string sText)
|
{
|
for (int i = BRow; i <= ERow; i++)
|
{
|
for (int j = BCol; j <= ECol; j++)
|
{
|
grdMain.Rows[i].Cells[j].Value = DBNull.Value;
|
}
|
}
|
|
}
|
|
//»Íø¸ñÏÂÏß
|
/// <summary>
|
/// »Íø¸ñÏÂÏß
|
/// </summary>
|
/// <param name="grdMain"></param>
|
public static void GraphicsGrid(DataGridView grdMain)
|
{
|
Graphics g = grdMain.CreateGraphics();
|
Pen p = new Pen(Color.Black);
|
p.Width = 1;
|
int lWidth;
|
if (grdMain.Rows.Count >= 100)//ÐÐÊý³¬¹ý100£¬¾ÍûÓбØÒª»ÏßÁË
|
{
|
return;
|
}
|
if (grdMain.RowHeadersVisible)
|
lWidth = grdMain.RowHeadersWidth;
|
else
|
lWidth = 0;
|
//foreach (DataGridViewColumn col in grdMain.Columns)
|
//{
|
// lWidth += col.Width;
|
//}
|
lWidth = 3000;
|
int sWidth;
|
if (grdMain.ColumnHeadersVisible)
|
sWidth = grdMain.ColumnHeadersHeight;
|
else
|
sWidth = 0;
|
foreach (DataGridViewRow col in grdMain.Rows)
|
{
|
sWidth += col.Height;
|
if (col.Index == grdMain.RowCount - 1)
|
{
|
g.DrawLine(p, new Point(0, sWidth), new Point(lWidth, sWidth));
|
}
|
}
|
}
|
|
|
//»Íø¸ñºáÏß
|
/// <summary>
|
/// »Íø¸ñºáÏß
|
/// </summary>
|
/// <param name="grdMain"></param>
|
public static void GraphicsRowGrid(DataGridView grdMain, Int32 iBeginRow, Int32 iEndRow, Int32 MainIDCol)
|
{
|
Graphics g = grdMain.CreateGraphics();
|
Pen p = new Pen(Color.Gainsboro);
|
p.Width = 1;
|
Int64 HMainID = 0;
|
int lWidth;//³¤¶È
|
lWidth = 3000;
|
int sWidth; //¸ß¶È
|
if (grdMain.ColumnHeadersVisible)//Èç¹ûÓбêÌâÁÐ ÔòÌí¼Ó±êÌâÁÐ Ðиß
|
sWidth = grdMain.ColumnHeadersHeight;
|
else
|
sWidth = 0;
|
//
|
for (int i = iBeginRow; i < iEndRow; i++)
|
{
|
if (i + 1 <= grdMain.Rows.Count - 1)
|
{
|
sWidth += grdMain.Rows[i].Height;
|
}
|
else
|
{
|
return;
|
}
|
//¸Ä±ä±³¾°É«
|
//grdMain.Rows[i].DefaultCellStyle.BackColor = Color.White;
|
//
|
if (HMainID == 0)
|
{
|
HMainID = ClsPub.isLong(grdMain.Rows[i].Cells[MainIDCol].Value);
|
}
|
if (HMainID == ClsPub.isLong(grdMain.Rows[i+1].Cells[MainIDCol].Value))
|
{
|
//ÓëÏÂÒ»ÐÐÏàͬÔò²»»Ïß
|
}
|
else
|
{
|
//ÓëÏÂÒ»Ðв»Í¬Ôò»Ïß
|
g.DrawLine(p, new Point(0, sWidth), new Point(lWidth, sWidth));
|
HMainID = ClsPub.isLong(grdMain.Rows[i+1].Cells[MainIDCol].Value);
|
}
|
|
|
}
|
}
|
|
public static void initGridList(DataGridView grdMain,string Name)
|
{
|
grdMain.RowTemplate.Height = 18;
|
grdMain.RowTemplate.MinimumHeight = 18;
|
grdMain.ColumnHeadersHeight = 40;
|
grdMain.RowHeadersVisible = false;
|
grdMain.ColumnHeadersVisible = true;
|
//grdMain.RowCount = 1;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionForeColor = Color.White;
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;//Íø¸ñÄÚÈÝ ¶ÔÆë·½Ê½
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //±êÌâÁÐ ÄÚÈÝ¶ÔÆë·½Ê½
|
grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdMain.ReadOnly = true;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdMain.EnableHeadersVisualStyles = false; //Íø¸ñ±êÌâ Ñùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White; //Íø¸ñ±³¾°É«
|
grdMain.GridColor = Color.Gainsboro; //Íø¸ñÏßÑÕÉ«
|
grdMain.ShowCellToolTips = true;
|
grdMain.CellBorderStyle = DataGridViewCellBorderStyle.SingleVertical; //Íø¸ñÏßÑùʽ£ºÖ»ÓÐÊúÏß
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray; //±êÌâÁÐ ±³¾°É«
|
grdMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //¼ôÌù°åģʽ£º
|
//grdMain.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
|
//
|
ClsPub.GetGridView(grdMain, Name,ClsPub.AppPath);//ÉèÖÃÁпí
|
}
|
|
|
public static void initGridMESList(DataGridView grdMain, string Name)
|
{
|
grdMain.RowTemplate.Height = 18;
|
grdMain.RowTemplate.MinimumHeight = 18;
|
grdMain.ColumnHeadersHeight = 30;
|
grdMain.RowHeadersVisible = false;
|
grdMain.ColumnHeadersVisible = true;
|
//grdMain.RowCount = 1;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.DefaultCellStyle.ForeColor = Color.Blue;
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;//Íø¸ñÄÚÈÝ ¶ÔÆë·½Ê½
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //±êÌâÁÐ ÄÚÈÝ¶ÔÆë·½Ê½
|
grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdMain.ReadOnly = true;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdMain.EnableHeadersVisualStyles = true; //Íø¸ñ±êÌâ Ñùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White; //Íø¸ñ±³¾°É«
|
grdMain.GridColor = Color.Gainsboro; //Íø¸ñÏßÑÕÉ«
|
grdMain.ShowCellToolTips = true;
|
grdMain.CellBorderStyle = DataGridViewCellBorderStyle.SingleVertical; //Íø¸ñÏßÑùʽ£ºÖ»ÓÐÊúÏß
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray; //±êÌâÁÐ ±³¾°É«
|
grdMain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; //¼ôÌù°åģʽ£º
|
//grdMain.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
|
//
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
}
|
|
|
public static void initGridList(DataGridView grdMain, string Name, bool VisualStyles)
|
{
|
grdMain.RowTemplate.Height = 18;
|
grdMain.RowTemplate.MinimumHeight = 18;
|
grdMain.ColumnHeadersHeight = 25;
|
grdMain.RowHeadersVisible = false;
|
grdMain.ColumnHeadersVisible = true;
|
//grdMain.RowCount = 1;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionForeColor = Color.White;
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdMain.ReadOnly = true;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdMain.EnableHeadersVisualStyles = VisualStyles; //Íø¸ñ±êÌâ Ñùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White;
|
grdMain.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdMain.ShowCellToolTips = true;
|
grdMain.CellBorderStyle = DataGridViewCellBorderStyle.RaisedVertical;
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
|
//
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
}
|
|
public static void initGridRpt(DataGridView grdMain, string Name)
|
{
|
grdMain.RowTemplate.Height = 18;
|
grdMain.RowTemplate.MinimumHeight = 18;
|
grdMain.ColumnHeadersHeight = 40;
|
grdMain.RowHeadersVisible = false;
|
grdMain.ColumnHeadersVisible = true;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionForeColor = Color.White;
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdMain.ReadOnly = true;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdMain.EnableHeadersVisualStyles = false; //Íø¸ñ±êÌâ Ñùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White;
|
grdMain.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdMain.ShowCellToolTips = true;
|
//grdMain.CellBorderStyle = DataGridViewCellBorderStyle.RaisedVertical;
|
grdMain.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
|
//
|
if (grdMain.ColumnCount > 0 && grdMain.RowCount > 0)
|
{
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
}
|
|
}
|
|
public static void initGridRpt(DataGridView grdMain, string Name, bool VisualStyles)
|
{
|
grdMain.RowTemplate.Height = 18;
|
grdMain.RowTemplate.MinimumHeight = 18;
|
grdMain.ColumnHeadersHeight = 40;
|
grdMain.RowHeadersVisible = false;
|
grdMain.ColumnHeadersVisible = true;
|
//¸ñʽ»¯
|
//±í¸ñÉèÖÃ
|
grdMain.RowsDefaultCellStyle.SelectionForeColor = Color.White;
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionBackColor = Color.DarkCyan;
|
grdMain.DefaultCellStyle.SelectionForeColor = Color.White;
|
//grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
grdMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
grdMain.ReadOnly = true;
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //ÔÊÐíÓû§µ÷ÕûÁпí
|
grdMain.EnableHeadersVisualStyles = false; //Íø¸ñ±êÌâ Ñùʽ
|
grdMain.AllowUserToAddRows = false; //ÊÇ·ñÔÊÐí×ÔÔö--·ñ
|
grdMain.AllowUserToDeleteRows = false; //ÊÇ·ñÔÊÐíɾ³ý--·ñ
|
grdMain.AllowUserToResizeColumns = true; //ÔÊÐíµ÷ÕûÁпí--ÊÇ
|
grdMain.AllowUserToResizeRows = false; //ÔÊÐíµ÷ÕûÐиß--·ñ
|
grdMain.AllowUserToOrderColumns = true; //ÔÊÐí ÍÏ×§ÁÐ
|
grdMain.BackgroundColor = Color.White;
|
grdMain.GridColor = Color.LightGray; //Íø¸ñÏßÑÕÉ«
|
grdMain.ShowCellToolTips = true;
|
//grdMain.CellBorderStyle = DataGridViewCellBorderStyle.RaisedVertical;
|
//grdMain.AlternatingRowsDefaultCellStyle.BackColor = Color.Lavender;
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGray;
|
//
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
}
|
|
//ÊͷŶ³½áÁÐ
|
public static void CancelFrozenCol(DataGridView grdMain)
|
{
|
for (int i = 0; i < grdMain.ColumnCount; i++)
|
{
|
grdMain.Columns[i].Frozen = false;
|
}
|
}
|
|
//ÉèÖà ±êÌâÁÐ ÐòºÅ
|
/// <summary>
|
/// ÉèÖà ±êÌâÁÐ ÐòºÅ
|
/// </summary>
|
/// <param name="grdMain"></param>
|
/// <param name="b">ÊÇ·ñÓÐÐòºÅ</param>
|
public static void SetColNo(DataGridView grdMain,bool b)
|
{
|
if (b)
|
{
|
grdMain.RowHeadersVisible = true;
|
grdMain.RowHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
grdMain.RowHeadersWidth = 50;
|
grdMain.EnableHeadersVisualStyles = true; //Íø¸ñ±êÌâ Ñùʽ
|
for (int i = 0; i < grdMain.RowCount; i++)
|
{
|
grdMain.Rows[i].HeaderCell.Value =Convert.ToString(i + 1);
|
|
}
|
}
|
else
|
{
|
grdMain.RowHeadersVisible = false;
|
}
|
}
|
|
//ÏÔʾÁбí
|
/// <summary>
|
/// ÉèÖÃÁÐ¿í£¬Òþ²ØÁÐ(h¿ªÍ·¡¢Óû§ÉèÖÃ)£¬¶³½áÁУ¬¶ÔÆë·½Ê½
|
/// </summary>
|
/// <param name="grdMain"></param>
|
/// <param name="Name"></param>
|
/// <param name="s"></param>
|
/// <param name="FrCol"></param>
|
public static void DisplayGrid(DataGridView grdMain, string Name, string s, int FrCol) // »ÃÐÄ
|
{
|
//¼ÓÔØÁпí,Òþ²ØÁУ¨H¿ªÍ·£©
|
for (int i = 0; i < grdMain.ColumnCount; i++)
|
{
|
grdMain.Columns[i].Width = 100;//ĬÈÏÁпí
|
if (s == "·ñ")
|
{
|
grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;//ÊÇ·ñÔÊÐí ÅÅÐòÁÐ
|
}
|
else
|
{
|
grdMain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic;
|
}
|
|
if (grdMain.Columns[i].HeaderText.Substring(0, 1).ToLower() == "h")//Òþ²ØH¿ªÍ·µÄÁÐ
|
{
|
grdMain.Columns[i].Visible = false;
|
}
|
else
|
{
|
grdMain.Columns[i].Visible = true;
|
}
|
}
|
for (int i = 0; i < grdMain.ColumnCount; i++)//ÉèÖö³½áÁÐ
|
{
|
grdMain.Columns[i].Frozen = false;
|
}
|
if (FrCol < grdMain.ColumnCount)
|
{
|
grdMain.Columns[FrCol].Frozen = true;//ÉèÖö³½áÁÐ
|
}
|
//ÉèÖÃ×ÖÌå´óС ¼°±êÌâÐиߣ¬ÄÚÈÝÐиß
|
|
//
|
ClsPub.GetGridView(grdMain, Name, ClsPub.AppPath);//ÉèÖÃÁпí
|
ClsPub.HideGridView(grdMain, Name, ClsPub.AppPath);//¶ÁÈ¡Òþ²ØÁÐdatagridview ²¢ÉèÖà ¶ÔÆë·½Ê½
|
}
|
|
//ÏÔʾÁбí
|
/// <summary>
|
/// ÉèÖÃ¶ÔÆë·½Ê½
|
/// </summary>
|
/// <param name="grdMain"></param>
|
/// <param name="Name"></param>
|
public static void DisplayGridDuiQi(DataGridView grdMain, string Name)
|
{
|
try
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet DSet;
|
for (int i = 0; i < grdMain.ColumnCount; i++)
|
{
|
DSet = oCn.RunProcReturn("select * from Xt_grdField where HUserID='" + Pub_Class.ClsPub.CurUserName + "' and HBillName='" + Name + "' and HRow=" + i, "Xt_grdField");
|
if (DSet.Tables[0].Rows.Count != 0)
|
{
|
if (DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["hfiduiqi"]) == "×ó¶ÔÆë")
|
{
|
grdMain.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
}
|
else if (DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["hfiduiqi"]) == "ÓÒ¶ÔÆë")
|
{
|
grdMain.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
}
|
else if (DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["hfiduiqi"]) == "¾ÓÖÐ")
|
{
|
grdMain.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
else
|
{
|
//
|
}
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
return;
|
}
|
}
|
|
public static void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name)
|
{
|
frmCondition.Tag = "";
|
frmCondition.ViewName = ViewName;
|
frmCondition.ModName = Name;
|
}
|
|
//»ñÈ¡½ðµûµ¥¾ÝºÅ
|
public static string get_MaxBillNo_K3(string HTranType, SQLHelper.ClsCNK3 oCnK3)
|
{
|
try
|
{
|
DataSet DS;
|
DS = oCnK3.RunProcReturn("exec HX_GetICBillNo 1," + HTranType, "xt_xtgnb");
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
{
|
return "";
|
}
|
else
|
{
|
return DS.Tables[0].Rows[0][0].ToString();
|
}
|
}
|
catch (Exception e)
|
{
|
return e.Message;
|
}
|
}
|
|
//»ñÈ¡½ðµûµ¥¾ÝºÅ
|
public static string get_MaxBillNo_K3(string HTranType, ref string sReturn)
|
{
|
SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
try
|
{
|
DataSet DS;
|
DS = oCnK3.RunProcReturn("exec HX_GetICBillNo 1," + HTranType, "xt_xtgnb");
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
{
|
return "";
|
}
|
else
|
{
|
return DS.Tables[0].Rows[0][0].ToString();
|
}
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return e.Message;
|
}
|
}
|
|
//µÃµ½×î´óHINTERID K3
|
public static Int64 CreateBillID_K3(string BillCode, ref string sReturn)
|
{
|
SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
DataSet Ds1;
|
long HInterID = 0;
|
try
|
{
|
Ds1 = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNumOld 'ICStockBill',@InterID output select ltrim(@InterID)", "xt_xtgnb");
|
if (Ds1.Tables[0].Rows.Count != 0)
|
{
|
HInterID = DBUtility.ClsPub.isLong(Ds1.Tables[0].Rows[0][0]);
|
return HInterID;
|
}
|
else
|
{
|
return 0;
|
}
|
}
|
catch (Exception e)
|
{
|
sReturn = e.Message;
|
return 0;
|
}
|
}
|
|
//ɾ³ýÐÐ
|
public static void Sub_DelRowDH(DataGridView ogrdMain)
|
{
|
int Scqwghz; //ÔÑ¡ÖÐÐÐ
|
int Scqwglz; //ÔÑ¡ÖÐÁÐ
|
//ogrdMain.CurrentRow.DefaultCellStyle.BackColor = Color.Red;
|
if (MessageBox.Show("È·¶¨ÒªÉ¾³ýµ±Ç°¼Ç¼£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
|
{
|
|
//ogrdMain.CurrentRow.DefaultCellStyle.BackColor = Color.White;
|
Changelock = true;
|
Changelock = false;
|
return;
|
}
|
int j = ogrdMain.SelectedRows.Count;
|
//
|
for (int i = 0; i < j; i++)
|
{
|
Scqwghz = ogrdMain.SelectedRows[j - i - 1].Index;
|
Scqwglz = ogrdMain.SelectedCells[i].ColumnIndex;
|
|
//Scqwghz = ogrdMain.CurrentRow.Index;
|
//Scqwglz = ogrdMain.CurrentCell.ColumnIndex;
|
DisplayCurRow(ogrdMain);
|
Changelock = true;
|
Changelock = false;
|
ogrdMain.Rows.RemoveAt(Scqwghz);
|
ogrdMain.Rows.Add();
|
Changelock = true;
|
Changelock = false;
|
RefreshNoCol(ogrdMain);
|
EditStatus = false;
|
}
|
}
|
//¼ÆËãÓû§¿ÉÓÃÐÐ
|
public static Int64 CountNullRows(DataGridView ogrdMain)
|
{
|
Int32 r;
|
Int32 lngRows;
|
lngRows = 0;
|
for (r = 0; r < ogrdMain.RowCount; r++)
|
{
|
if (ClsPub.isStrNull(ogrdMain.Rows[r].Cells[0].Value) != "*")
|
lngRows = lngRows + 1;
|
}
|
return lngRows;
|
}
|
|
//ÏÔʾµ±Ç°ÐÐ
|
public static void DisplayCurRow(DataGridView ogrdMain)
|
{
|
Int64 Toprowte;
|
if (CountNullRows(ogrdMain) < 20)
|
ogrdMain.Rows.Add();
|
Toprowte = 0;
|
}
|
|
//Ë¢ÐÂÐкÅ
|
public static void RefreshNoCol(DataGridView ogrdMain)
|
{
|
int i, m;
|
i = 0;
|
m = 0;
|
for (i = 0; i < ogrdMain.RowCount; i++)
|
{
|
m = m + 1;
|
ogrdMain.Rows[i].Cells[NoCol].Value = m.ToString().Trim();
|
}
|
ogrdMain.Columns[NoCol].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
|
//ÐÂÔö×Ö¶Î ·µ»Ø×Ö¶ÎÃû
|
public static void Fun_AddField(string FieldName, string Type, string FieldHLength, SQLHelper.ClsCN oCn)
|
{
|
try
|
{
|
oCn.RunProc("exec h_p_Gy_DuSubsidyItemAddField " + FieldName + "," + Type + "," + FieldHLength, ref DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
public static void Sub_GetSelfInsertSQL(ref string sSQL,string sDataType,object oValue)
|
{
|
switch (sDataType)
|
{
|
case "×Ö·û":
|
sSQL = sSQL + ",'" + DBUtility.ClsPub.isStrNull(oValue) + "'";
|
break;
|
case "ʵÊý":
|
sSQL = sSQL + "," + DBUtility.ClsPub.isDoule(oValue,4) + "";
|
break;
|
case "½ð¶î":
|
sSQL = sSQL + "," + DBUtility.ClsPub.isDoule(oValue, 4) + "";
|
break;
|
case "Âß¼":
|
sSQL = sSQL + "," + DBUtility.ClsPub.BoolToString(oValue) + "";
|
break;
|
case "ÈÕÆÚ":
|
sSQL = sSQL + ",'" + DBUtility.ClsPub.isDate(oValue).ToShortDateString() + "'";
|
break;
|
case "ÕûÊý":
|
sSQL = sSQL + "," + DBUtility.ClsPub.isLong(oValue).ToString() + "";
|
break;
|
default:
|
sSQL = sSQL + ",'" + DBUtility.ClsPub.isStrNull(oValue) + "'";
|
break;
|
}
|
|
}
|
|
|
|
public static void initKanBan(string HName, DataGridView grdMain, ToolStrip Ts, ToolStripLabel lbl, SplitterPanel Sp, ref int FY, Timer timer2, Timer timer3)
|
{
|
string TitleCaption = ClsIni.ReadIni(HName, "Title-Caption", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleForeColor = ClsIni.ReadIni(HName, "Title-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontFamily = ClsIni.ReadIni(HName, "Title-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontSize = ClsIni.ReadIni(HName, "Title-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontStyle = ClsIni.ReadIni(HName, "Title-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleBackColor = ClsIni.ReadIni(HName, "Title-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitlePageRows = ClsIni.ReadIni(HName, "Title-PageRows", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitlePageDownTimer = ClsIni.ReadIni(HName, "Title-PageDownTimer", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleDisplayTimer = ClsIni.ReadIni(HName, "Title-DisplayTimer", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (TitleCaption != "" && TitleCaption != "ûÓÐÕÒµ½£¡")
|
{
|
lbl.Text = TitleCaption;
|
}
|
if (TitlePageRows != "" && TitlePageRows != "ûÓÐÕÒµ½£¡")
|
{
|
FY = ClsPub.isInt(TitlePageRows);
|
}
|
if (TitlePageDownTimer != "" && TitlePageDownTimer != "ûÓÐÕÒµ½£¡")
|
{
|
timer2.Interval = ClsPub.isInt(TitlePageDownTimer) * 1000;
|
}
|
if (TitleDisplayTimer != "" && TitleDisplayTimer != "ûÓÐÕÒµ½£¡")
|
{
|
timer3.Interval = ClsPub.isInt(TitleDisplayTimer) * 1000;
|
}
|
if (TitleForeColor != "" && TitleForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
for (int i = 0; i < Ts.Items.Count; i++)
|
{
|
Ts.Items[i].ForeColor = System.Drawing.ColorTranslator.FromHtml(TitleForeColor);
|
}
|
if (Sp != null)
|
{
|
foreach (Control ct in Sp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
//case "ListBox":
|
// ((ListBox)ct).Items.Clear();
|
// break;
|
//case "CheckBox":
|
// ((CheckBox)ct).Checked = false;
|
// break;
|
//case "RadioButton":
|
|
// break;
|
//case "TextBox":
|
// ((TextBox)ct).ForeColor = System.Drawing.ColorTranslator.FromHtml(TitleForeColor);
|
// break;
|
//case "DateTimePicker":
|
// ((DateTimePicker)ct).Value = DateTime.Today;
|
// break;
|
case "Label":
|
((Label)ct).ForeColor = System.Drawing.ColorTranslator.FromHtml(TitleForeColor);
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
}
|
|
if (TitleBackColor != "" && TitleBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
Ts.BackColor = System.Drawing.ColorTranslator.FromHtml(TitleBackColor);
|
if (Sp != null)
|
{
|
Sp.BackColor = System.Drawing.ColorTranslator.FromHtml(TitleBackColor);
|
}
|
}
|
if (TitleFontStyle != "" && TitleFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (TitleFontStyle.Contains("Bold"))
|
{
|
lbl.Font = new Font(TitleFontFamily, DBUtility.ClsPub.isSingle(TitleFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
lbl.Font = new Font(TitleFontFamily, DBUtility.ClsPub.isSingle(TitleFontSize));
|
}
|
}
|
|
|
string HeaderForeColor = ClsIni.ReadIni(HName, "Header-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontFamily = ClsIni.ReadIni(HName, "Header-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontSize = ClsIni.ReadIni(HName, "Header-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontStyle = ClsIni.ReadIni(HName, "Header-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderBackColor = ClsIni.ReadIni(HName, "Header-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderAlignment = ClsIni.ReadIni(HName, "Header-Alignment", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderRowHeight = ClsIni.ReadIni(HName, "Header-RowHeight", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (HeaderRowHeight != "" && HeaderRowHeight != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersHeight = DBUtility.ClsPub.isInt(HeaderRowHeight);
|
}
|
if (HeaderForeColor != "" && HeaderForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml(HeaderForeColor);
|
grdMain.ColumnHeadersDefaultCellStyle.SelectionForeColor = System.Drawing.ColorTranslator.FromHtml(HeaderForeColor);
|
}
|
if (HeaderBackColor != "" && HeaderBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(HeaderBackColor);
|
grdMain.ColumnHeadersDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(HeaderBackColor);
|
}
|
if (HeaderFontStyle != "" && HeaderFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (HeaderFontStyle.Contains("Bold"))
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Font = new Font(HeaderFontFamily, DBUtility.ClsPub.isSingle(HeaderFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Font = new Font(HeaderFontFamily, DBUtility.ClsPub.isSingle(HeaderFontSize));
|
}
|
}
|
if (HeaderAlignment != "" && HeaderAlignment != "ûÓÐÕÒµ½£¡")
|
{
|
if (HeaderAlignment == "×ó¶ÔÆë")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
}
|
if (HeaderAlignment == "ÓÒ¶ÔÆë")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
}
|
if (HeaderAlignment == "¾ÓÖÐ")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
}
|
|
string CellForeColor = ClsIni.ReadIni(HName, "Cell-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellForeColor2 = ClsIni.ReadIni(HName, "Cell-ForeColor2", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontFamily = ClsIni.ReadIni(HName, "Cell-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontSize = ClsIni.ReadIni(HName, "Cell-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontStyle = ClsIni.ReadIni(HName, "Cell-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellBackColor = ClsIni.ReadIni(HName, "Cell-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellAlignment = ClsIni.ReadIni(HName, "Cell-Alignment", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellRowHeight = ClsIni.ReadIni(HName, "Cell-RowHeight", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellAlternatingBackColor = ClsIni.ReadIni(HName, "Cell-AlternatingBackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellDefaultBackColor = ClsIni.ReadIni(HName, "Cell-DefaultBackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (CellRowHeight != "" && CellRowHeight != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowTemplate.Height = DBUtility.ClsPub.isInt(CellRowHeight);
|
}
|
if (CellForeColor != "" && CellForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowsDefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml(CellForeColor);
|
}
|
if (CellForeColor2 != "" && CellForeColor2 != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.AlternatingRowsDefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml(CellForeColor2);
|
}
|
if (CellBackColor != "" && CellBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.BackgroundColor = System.Drawing.ColorTranslator.FromHtml(CellBackColor);
|
}
|
if (CellFontStyle != "" && CellFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (CellFontStyle.Contains("Bold"))
|
{
|
grdMain.RowsDefaultCellStyle.Font = new Font(CellFontFamily, DBUtility.ClsPub.isSingle(CellFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
grdMain.RowsDefaultCellStyle.Font = new Font(CellFontFamily, DBUtility.ClsPub.isSingle(CellFontSize));
|
}
|
}
|
if (CellAlignment != "" && CellAlignment != "ûÓÐÕÒµ½£¡")
|
{
|
if (CellAlignment == "×ó¶ÔÆë")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
}
|
if (CellAlignment == "ÓÒ¶ÔÆë")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
}
|
if (CellAlignment == "¾ÓÖÐ")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
}
|
if (CellAlternatingBackColor != "" && CellAlternatingBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(CellAlternatingBackColor);
|
grdMain.AlternatingRowsDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(CellAlternatingBackColor);
|
}
|
if (CellDefaultBackColor != "" && CellDefaultBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(CellDefaultBackColor);
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(CellDefaultBackColor);
|
}
|
//ÁбêÌâ±ß¿òÑùʽ
|
grdMain.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; ;
|
//±êÌâÑùʽÊÇ·ñʹÓÃÓû§µ±Ç°Ö÷ÌâµÄÑùʽ
|
grdMain.EnableHeadersVisualStyles = false;
|
//Òþ²ØÐбêÌâ
|
grdMain.RowHeadersVisible = false;
|
//¸ù¾ÝÄÚÈÝ×Ô¶¯µ÷Õû±êÌâ¸ß¶È
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
}
|
|
|
//¿´°å×Ô¶¨ÒåÑÕÉ«£ºHName Ä£¿éÃû£¬grdMain Íø¸ñ£¬Ts ±êÌâ°´Å¥£¬lbl ¿´°å±êÌ⣬Sp ҳü£¬Sp2 Ò³½Å£¬FY ¹ö¶¯ÐÐÊý£¬timer2 ¹ö¶¯¼ä¸ô£¬timer3 ˢмä¸ô
|
public static void initKanBan(string HName, DataGridView grdMain, ToolStrip Ts, ToolStripLabel lbl, SplitterPanel Sp, SplitterPanel Sp2, ref int FY, Timer timer2, Timer timer3)
|
{
|
string TitleCaption = ClsIni.ReadIni(HName, "Title-Caption", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleForeColor = ClsIni.ReadIni(HName, "Title-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontFamily = ClsIni.ReadIni(HName, "Title-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontSize = ClsIni.ReadIni(HName, "Title-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleFontStyle = ClsIni.ReadIni(HName, "Title-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleBackColor = ClsIni.ReadIni(HName, "Title-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitlePageRows = ClsIni.ReadIni(HName, "Title-PageRows", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitlePageDownTimer = ClsIni.ReadIni(HName, "Title-PageDownTimer", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string TitleDisplayTimer = ClsIni.ReadIni(HName, "Title-DisplayTimer", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (TitleCaption != "" && TitleCaption != "ûÓÐÕÒµ½£¡")
|
{
|
lbl.Text = TitleCaption;
|
}
|
if (TitlePageRows != "" && TitlePageRows != "ûÓÐÕÒµ½£¡")
|
{
|
FY = ClsPub.isInt(TitlePageRows);
|
}
|
if (TitlePageDownTimer != "" && TitlePageDownTimer != "ûÓÐÕÒµ½£¡")
|
{
|
timer2.Interval = ClsPub.isInt(TitlePageDownTimer) * 1000;
|
}
|
if (TitleDisplayTimer != "" && TitleDisplayTimer != "ûÓÐÕÒµ½£¡")
|
{
|
timer3.Interval = ClsPub.isInt(TitleDisplayTimer) * 1000;
|
}
|
if (TitleForeColor != "" && TitleForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
for (int i = 0; i < Ts.Items.Count; i++)
|
{
|
Ts.Items[i].ForeColor = System.Drawing.ColorTranslator.FromHtml(TitleForeColor);
|
}
|
}
|
|
if (TitleBackColor != "" && TitleBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
Ts.BackColor = System.Drawing.ColorTranslator.FromHtml(TitleBackColor);
|
}
|
if (TitleFontStyle != "" && TitleFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (TitleFontStyle.Contains("Bold"))
|
{
|
lbl.Font = new Font(TitleFontFamily, DBUtility.ClsPub.isSingle(TitleFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
lbl.Font = new Font(TitleFontFamily, DBUtility.ClsPub.isSingle(TitleFontSize));
|
}
|
}
|
|
|
string HeaderForeColor = ClsIni.ReadIni(HName, "Header-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontFamily = ClsIni.ReadIni(HName, "Header-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontSize = ClsIni.ReadIni(HName, "Header-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderFontStyle = ClsIni.ReadIni(HName, "Header-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderBackColor = ClsIni.ReadIni(HName, "Header-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderAlignment = ClsIni.ReadIni(HName, "Header-Alignment", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string HeaderRowHeight = ClsIni.ReadIni(HName, "Header-RowHeight", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (HeaderRowHeight != "" && HeaderRowHeight != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersHeight = DBUtility.ClsPub.isInt(HeaderRowHeight);
|
}
|
if (HeaderForeColor != "" && HeaderForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml(HeaderForeColor);
|
grdMain.ColumnHeadersDefaultCellStyle.SelectionForeColor = System.Drawing.ColorTranslator.FromHtml(HeaderForeColor);
|
}
|
if (HeaderBackColor != "" && HeaderBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(HeaderBackColor);
|
grdMain.ColumnHeadersDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(HeaderBackColor);
|
}
|
if (HeaderFontStyle != "" && HeaderFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (HeaderFontStyle.Contains("Bold"))
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Font = new Font(HeaderFontFamily, DBUtility.ClsPub.isSingle(HeaderFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Font = new Font(HeaderFontFamily, DBUtility.ClsPub.isSingle(HeaderFontSize));
|
}
|
}
|
if (HeaderAlignment != "" && HeaderAlignment != "ûÓÐÕÒµ½£¡")
|
{
|
if (HeaderAlignment == "×ó¶ÔÆë")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
}
|
if (HeaderAlignment == "ÓÒ¶ÔÆë")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
}
|
if (HeaderAlignment == "¾ÓÖÐ")
|
{
|
grdMain.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
}
|
|
string CellForeColor = ClsIni.ReadIni(HName, "Cell-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontFamily = ClsIni.ReadIni(HName, "Cell-FontFamily", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontSize = ClsIni.ReadIni(HName, "Cell-FontSize", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellFontStyle = ClsIni.ReadIni(HName, "Cell-FontStyle", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellBackColor = ClsIni.ReadIni(HName, "Cell-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellAlignment = ClsIni.ReadIni(HName, "Cell-Alignment", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellRowHeight = ClsIni.ReadIni(HName, "Cell-RowHeight", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellAlternatingBackColor = ClsIni.ReadIni(HName, "Cell-AlternatingBackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string CellDefaultBackColor = ClsIni.ReadIni(HName, "Cell-DefaultBackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
if (CellRowHeight != "" && CellRowHeight != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowTemplate.Height = DBUtility.ClsPub.isInt(CellRowHeight);
|
}
|
if (CellForeColor != "" && CellForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowsDefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml(CellForeColor);
|
}
|
if (CellBackColor != "" && CellBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.BackgroundColor = System.Drawing.ColorTranslator.FromHtml(CellBackColor);
|
}
|
if (CellFontStyle != "" && CellFontStyle != "ûÓÐÕÒµ½£¡")
|
{
|
if (CellFontStyle.Contains("Bold"))
|
{
|
grdMain.RowsDefaultCellStyle.Font = new Font(CellFontFamily, DBUtility.ClsPub.isSingle(CellFontSize), FontStyle.Bold);
|
}
|
else
|
{
|
grdMain.RowsDefaultCellStyle.Font = new Font(CellFontFamily, DBUtility.ClsPub.isSingle(CellFontSize));
|
}
|
}
|
if (CellAlignment != "" && CellAlignment != "ûÓÐÕÒµ½£¡")
|
{
|
if (CellAlignment == "×ó¶ÔÆë")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
}
|
if (CellAlignment == "ÓÒ¶ÔÆë")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
}
|
if (CellAlignment == "¾ÓÖÐ")
|
{
|
grdMain.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
}
|
}
|
if (CellAlternatingBackColor != "" && CellAlternatingBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(CellAlternatingBackColor);
|
grdMain.AlternatingRowsDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(CellAlternatingBackColor);
|
}
|
if (CellDefaultBackColor != "" && CellDefaultBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
grdMain.RowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml(CellDefaultBackColor);
|
grdMain.RowsDefaultCellStyle.SelectionBackColor = System.Drawing.ColorTranslator.FromHtml(CellDefaultBackColor);
|
}
|
//ҳü£¬Ò³½Å
|
|
string YeMeiForeColor = ClsIni.ReadIni(HName, "YeMei-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string YeMeiBackColor = ClsIni.ReadIni(HName, "YeMei-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string FooterForeColor = ClsIni.ReadIni(HName, "Footer-ForeColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
string FooterBackColor = ClsIni.ReadIni(HName, "Footer-BackColor", DBUtility.ClsPub.AppPath + @"/KanbanInfo.ini");
|
|
if (YeMeiForeColor != "" && YeMeiForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
if (Sp != null)
|
{
|
foreach (Control ct in Sp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "Label":
|
((Label)ct).ForeColor = System.Drawing.ColorTranslator.FromHtml(YeMeiForeColor);
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
}
|
|
if (YeMeiBackColor != "" && YeMeiBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
if (Sp != null)
|
{
|
Sp.BackColor = System.Drawing.ColorTranslator.FromHtml(YeMeiBackColor);
|
}
|
}
|
|
if (FooterForeColor != "" && FooterForeColor != "ûÓÐÕÒµ½£¡")
|
{
|
if (Sp2 != null)
|
{
|
foreach (Control ct in Sp2.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "Label":
|
((Label)ct).ForeColor = System.Drawing.ColorTranslator.FromHtml(FooterForeColor);
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
}
|
|
if (FooterBackColor != "" && FooterBackColor != "ûÓÐÕÒµ½£¡")
|
{
|
if (Sp2 != null)
|
{
|
Sp2.BackColor = System.Drawing.ColorTranslator.FromHtml(FooterBackColor);
|
}
|
}
|
//ÁбêÌâ±ß¿òÑùʽ
|
grdMain.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; ;
|
//±êÌâÑùʽÊÇ·ñʹÓÃÓû§µ±Ç°Ö÷ÌâµÄÑùʽ
|
grdMain.EnableHeadersVisualStyles = false;
|
//Òþ²ØÐбêÌâ
|
grdMain.RowHeadersVisible = false;
|
//¸ù¾ÝÄÚÈÝ×Ô¶¯µ÷Õû±êÌâ¸ß¶È
|
grdMain.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
}
|
|
//ÉèÖÃÍø¸ñÄÚÈÝ£¨×Ô¶¨ÒåÁУ©
|
public static void Sub_SetSelfValueToGrid(DataGridView grdMain,int iRow,int iCol,string sType,object oValue)
|
{
|
switch (sType)
|
{
|
case "×Ö·û":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isStrNull(oValue);
|
break;
|
case "ʵÊý":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isDoule(oValue);
|
break;
|
case "½ð¶î":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isSingle(oValue);
|
break;
|
case "Âß¼":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isBool(oValue);
|
break;
|
case "ÈÕÆÚ":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isDate(oValue);
|
break;
|
case "ÕûÊý":
|
grdMain.Rows[iRow].Cells[iCol].Value=DBUtility.ClsPub.isLong(oValue);
|
break;
|
default:
|
grdMain.Rows[iRow].Cells[iCol].Value = DBUtility.ClsPub.isStrNull(oValue);
|
break;
|
}
|
|
}
|
|
|
|
}
|
}
|