using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Pub_Class
{
///
/// 单据 合计网格
///
public class ClsGridViewSum
{
public DataGridView ogrdMain = new DataGridView();
public DataGridView oGridsum = new DataGridView();
private string sTotalCols;
private string sAllowEdit;
public Cell OldCell = new Cell();
public bool Changelock;
public bool Gdtlock;
public bool EditStatus;
public bool DisplayNoCol;
public Int32 NoCol;
public string KeyItem;
public bool NotAllowADDRow;
public bool NotAllowDELRow;
public char chr = Convert.ToChar(",");
//建立 合计列
public void BuildTotalCols(string[] Cols)
{
Int64 i;
string tStr;
tStr = "";
for (i = 0; i < Cols.Length; i++)
{
if (i == 0)
{
tStr = Cols[i];
}
else
{
tStr = tStr + "," + Cols[i];
}
}
sTotalCols= tStr;
}
//建立 可编辑列
public void BuildAllowEditCols(string[] Cols)
{
Int64 i;
string tStr;
tStr = "";
for (i = 0; i < Cols.Length; i++)
{
if (i == 0)
{
tStr = Cols[i];
}
else
{
tStr = tStr + "," + Cols[i];
}
}
sAllowEdit= tStr;
}
//设置主网格属性
public void SetGridMain()
{
for(int i=0;iogrdMain.Size.Height && ogrdMain.TopRow!=Toprowte)
//{
// Toprowte=ogrdMain.TopRow;
// ogrdMain.TopRow=ogrdMain.TopRow+1;
//}
//Toprowte = 0;
//while (ogrdMain.CellTop < ogrdMain.FixedRows * ogrdMain.get_RowHeight(0) && ogrdMain.TopRow != Toprowte)
//{
// Toprowte = ogrdMain.TopRow;
// if (ogrdMain.TopRow > 1)
// {
// ogrdMain.TopRow = ogrdMain.TopRow -1;
// }
//}
}
//public void CheckRowData()
//{
// int r;
// if (ogrdMain.Row >= ogrdMain.FixedRows)
// {
// if (ClsPub.isStrNull(ogrdMain.get_TextMatrix(ogrdMain.Row, 0).ToString()) != "*")
// {
// for ( r = ogrdMain.FixedRows; r < ogrdMain.Rows; r++)
// {
// if (ClsPub.isStrNull(ogrdMain.get_TextMatrix(r, 0).ToString()) != "*")
// {
// if (NotAllowADDRow)
// {
// Changelock = true;
// ogrdMain.Select(r - 1, ogrdMain.Col);
// Changelock = false;
// return;
// }
// else
// {
// break;
// }
// }
// }
// //
// if (r <= ogrdMain.Rows - 1)
// {
// Changelock = true;
// ogrdMain.Select(r , ogrdMain.Col);
// Changelock = false;
// }
// else
// {
// Changelock = true;
// ogrdMain.Select(ogrdMain.Rows - 1, ogrdMain.Col);
// Changelock = false;
// }
// }
// DisplayCurRow();
// }
//}
//刷新行号
public void RefreshNoCol()
{
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;
}
//
}
}