📄 frmhistoryview.cs
字号:
}
}
}
sTemp[j] = tempNum.ToString();
}
rows.Add(sTemp);
}
}
private void btnStatMap_Click(object sender, EventArgs e)
{
ShowChartPanl("btnStatMap");
if (mtbDateNum.Text.Trim().Length < 1)
{
MessageBox.Show("请输入统计期数!");
mtbDateNum.Focus();
return;
}
StatHistoryRedBall1(int.Parse (mtbDateNum.Text .Trim ().ToString ()));
}
#region//统计历史红球数据分布图
/// <summary>
/// 统计指定期数的历史红球数据分布图
/// </summary>
/// <param name="awardDataNum">统计数据期数</param>
//private void StatHistoryRedBall(int awardDataNum)
//{
// ArrayList tempArray;
// string[][] redBall;
// string[] sTemp;
// tempArray = new ArrayList();
// tempArray = this.historyAnalyse.GetRedData(awardDataNum);
// tempArray = RedBall.GetStatResult(tempArray);
// redBall = new string[tempArray.Count][];
// tempArray.CopyTo(redBall);
// //显示数据
// DataGridViewRowCollection rows = this.dgwHistoryView.Rows;
// SetDgvType();
// for (int i = 0; i < redBall.Length; i++)
// {
// sTemp = new string[35];
// redBall[i].CopyTo(sTemp, 0);
// rows.Add(sTemp);
// }
// //设置单元格颜色设置
// string sValue;
// DataGridViewCellStyle MyStyle = new DataGridViewCellStyle();
// MyStyle.BackColor = Color.Red;
// MyStyle.ForeColor = Color.White;
// DataGridViewCellStyle MyStyle1 = new DataGridViewCellStyle();
// MyStyle1.BackColor = Color.White;
// MyStyle1.ForeColor = Color.Black;
// for (int i = 0; i < redBall.Length; i++)
// {
// this.dgwHistoryView.Rows[i].Cells[0].Style = MyStyle1;
// this.dgwHistoryView.Rows[i].Cells[1].Style = MyStyle1;
// for (int j = 2; j < 35; j++)
// {
// DataGridViewCell cell = this.dgwHistoryView.Rows[i].Cells[j];
// sValue = cell.Value.ToString();
// if (sValue.StartsWith("-"))
// {
// sValue = sValue.Substring(1).ToString();
// //把一位中奖号前添零变成两位中奖号
// if (sValue.Length == 1)
// {
// sValue = "0" + sValue;
// }
// cell.Value = sValue;
// cell.Style = MyStyle;
// }
// }
// }
//}
#endregion
#region//统计指定期数的历史红球数据分布图+6位上期数据
/// <summary>
/// 统计指定期数的历史红球数据分布图+6位上期数据
/// </summary>
/// <param name="awardDataNum">统计数据期数</param>
private void StatHistoryRedBall1(int awardDataNum)
{
ArrayList tempArray;
string[][] redBall;
string[] sTemp;
tempArray = new ArrayList();
tempArray = this.historyAnalyse.GetRedData(awardDataNum);
tempArray = RedBall.GetStatResult(tempArray);
redBall = new string[tempArray.Count][];
tempArray.CopyTo(redBall);
//显示数据
DataGridViewRowCollection rows = this.dgwHistoryView.Rows;
SetDgwType("btnStatMap");
for (int i = 0; i < redBall.Length; i++)
{
int iSix=45;
int iMantissa = 0;
string sRedBallValue="";
sTemp = new string[51];
redBall[i].CopyTo(sTemp, 0);
if (i != 0)
{
for (int j = 2; j < 35; j++)
{
if (sTemp[j].StartsWith("-"))
{
//尾号10位
iMantissa = Convert.ToInt32(sTemp[j].Substring(sTemp[j].Length - 1));
sTemp[35 + iMantissa] = iMantissa.ToString();
//尾号6位
sRedBallValue = redBall[i - 1][j].ToString();
if (sRedBallValue.StartsWith("-"))
{
sTemp[iSix] = "0";
}
else
{
sTemp[iSix] = sRedBallValue;
}
iSix = iSix + 1;
}
}
}
else
{
for (int j = 2; j < 35; j++)
{
if (sTemp[j].StartsWith("-"))
{
//尾号10位
iMantissa = Convert.ToInt32(sTemp[j].Substring(sTemp[j].Length - 1));
sTemp[35 + iMantissa] = iMantissa.ToString();
}
}
}
rows.Add(sTemp);
}
//设置单元格颜色设置
string sValue;
DataGridViewCellStyle MyStyle = new DataGridViewCellStyle();
MyStyle.BackColor = Color.Red;
MyStyle.ForeColor = Color.White;
DataGridViewCellStyle MyStyle1 = new DataGridViewCellStyle();
MyStyle1.BackColor = Color.White;
MyStyle1.ForeColor = Color.Black;
DataGridViewCellStyle MyStyle10 = new DataGridViewCellStyle();
MyStyle10.BackColor = Color.PaleGoldenrod;
MyStyle10.ForeColor = Color.Black ;
DataGridViewCellStyle MyStyle6 = new DataGridViewCellStyle();
MyStyle6.BackColor = Color.PaleGreen ;
MyStyle6.ForeColor = Color.Black;
for (int i = 0; i < redBall.Length; i++)
{
this.dgwHistoryView.Rows[i].Cells[0].Style = MyStyle1;
this.dgwHistoryView.Rows[i].Cells[1].Style = MyStyle1;
for (int j = 2; j < 35; j++)
{
DataGridViewCell cell = this.dgwHistoryView.Rows[i].Cells[j];
sValue = cell.Value.ToString();
if (sValue.StartsWith("-"))
{
sValue = sValue.Substring(1).ToString();
//把一位中奖号前添零变成两位中奖号
if (sValue.Length == 1)
{
sValue = "0" + sValue;
}
cell.Value = sValue;
cell.Style = MyStyle;
}
}
for (int j = 35; j < 45; j++)
{
DataGridViewCell cell = this.dgwHistoryView.Rows[i].Cells[j];
cell.Style = MyStyle10;
}
for (int j = 45; j < 51; j++)
{
DataGridViewCell cell = this.dgwHistoryView.Rows[i].Cells[j];
cell.Style = MyStyle6;
}
}
}
#endregion
#region//初始化dgwHistoryView
//private void SetDgvType()
//{
// dgwHistoryView.Rows.Clear();
// dgwHistoryView.DataSource = null;
// dgwHistoryView.ColumnCount = 51;
// dgwHistoryView.RowHeadersVisible = false;
// dgwHistoryView.Columns[0].Name = "ID";
// dgwHistoryView.Columns[0].Width = 30;
// dgwHistoryView.Columns[1].Name = "开奖期号";
// dgwHistoryView.Columns[1].Width = 80;
// for (int i = 2; i < 35; i++)
// {
// dgwHistoryView.Columns[i ].Name = Convert .ToString ((i-1));
// dgwHistoryView.Columns[i ].Width = 25;
// }
// for (int i = 35; i < 45; i++)
// {
// dgwHistoryView.Columns[i].Name =Convert .ToString ((i-34));
// dgwHistoryView.Columns[i].Width = 25;
// }
// for (int i = 45; i < 51; i++)
// {
// dgwHistoryView.Columns[i].Name = Convert.ToString((i - 44));
// dgwHistoryView.Columns[i].Width = 25;
// }
// System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
// dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
// dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Silver;
// this.dgwHistoryView.RowsDefaultCellStyle = dataGridViewCellStyle1;
//}
#endregion
#region//填充红球列表
/// <summary>
/// 填充红球列表
/// </summary>
private void InitCBRedNo()
{
string redNo;
for (int i = 1; i <= 33; i++)
{
if (i < 10)
{
redNo = "0" + i.ToString();
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -