例子不太方便上传,但是我相信楼主应该知道我的意识了吧,我吧其中的代码贴给你看下吧
private void Form_waterstealorder_Load(object sender, EventArgs e)
{
//工单状态栏选择
OracleConnection conn = new OracleConnection(SettingMpg.ConnenctionString_SZcallcenter);
string sql = string.Format(@"select * from (select dictname from dict where dictdom ='03') a " );
OracleCommand cmd = new OracleCommand(sql, conn);
OracleDataAdapter sda = new OracleDataAdapter();
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
sda.Fill(ds, "a");
DataRow dr = ds.Tables[0].NewRow();
dr["dictname"] = ("== 请选择 ==");
ds.Tables[0].Rows.InsertAt(dr, 0);
comboBox2.DataSource = ds.Tables["a"];
comboBox2.DisplayMember = "dictname";
//工单显示
string sql2 = string.Format(@"select reporter,reportedperson,reportphone,reporttime,acceptor,ordersource,orderstate from ding_waterstealorder");
cmd = new OracleCommand(sql2, conn);
sda.SelectCommand = cmd;
DataTable dt = new DataTable();
sda.Fill(dt);
fpSpread1_Sheet1.DataSource = dt;
conn.Close();
cmd.Dispose();
// 设置最后三列之间的边线不显示
fpSpread1_Sheet1.ColumnCount = 10;
fpSpread1.Sheets[0].VerticalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
FarPoint.Win.LineBorder border = new FarPoint.Win.LineBorder(Color.LightGray, 1, false, false, true, true);
fpSpread1.Sheets[0].Columns[0, fpSpread1.Sheets[0].Columns.Count - 4].Border = border;
//fpSpread1.Sheets[0].Cells[0, 7].Text = "操作";
fpSpread1_Sheet1.ColumnHeader.Cells[0, 7].Text = "操作";
fpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].ColumnSpan = 3;
fpSpread1.Sheets[0].Cells[0, 7].VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center;
fpSpread1.Sheets[0].Columns[7, 9].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
fpSpread1.Sheets[0].Columns[7, 9].ForeColor = Color.FromArgb(180,0,0);
for (int i = 0; i < fpSpread1.Sheets[0].Rows.Count; i++)
{
if (fpSpread1_Sheet1.Cells[i, 6].Text == "0305")
{
FarPoint.Win.Spread.CellType.ButtonCellType link = new FarPoint.Win.Spread.CellType.ButtonCellType();
FarPoint.Win.Spread.CellType.ButtonCellType link2 = new FarPoint.Win.Spread.CellType.ButtonCellType();
FarPoint.Win.Spread.CellType.ButtonCellType link3 = new FarPoint.Win.Spread.CellType.ButtonCellType();
link.Text = "查看";
fpSpread1_Sheet1.Cells[i, 7].CellType = link;
link2.Text = "修改";
fpSpread1_Sheet1.Cells[i, 8].CellType = link2;
link3.Text = "删除";
fpSpread1_Sheet1.Cells[i, 9].CellType = link3;
fpSpread1_Sheet1.DataAutoCellTypes = false;
}
else
{
FarPoint.Win.Spread.CellType.ButtonCellType link = new FarPoint.Win.Spread.CellType.ButtonCellType();
//fpSpread1_Sheet1.Cells[i, 7].CellType = link;
link.Text = "查看";
fpSpread1_Sheet1.Cells[i, 8].CellType = link;
fpSpread1_Sheet1.DataAutoCellTypes = false;
}
}
}
private void button1_Click(object sender, EventArgs e) //查询工单
{
Form_waterstealquery form = new Form_waterstealquery();
form.ShowDialog();
}
private void fpSpread1_ButtonClicked(object sender, FarPoint.Win.Spread.EditorNotifyEventArgs e) //单击button事件
{
Form_waterstealorder form = new Form_waterstealorder();
form.ShowDialog();
}
就是在单击button事件中,怎么去判断我点击的button的text是对应的查看,删除,修改,然后弹出相应的对话框 |