c# 創建右鍵功能
//定義右鍵
ToolStripMenuItem DeletePhraseMe = new ToolStripMenuItem();
DeletePhraseMe.Name = "DeleteBookMark";
DeletePhraseMe.Text = "刪除詞庫";
//定義右鍵事件
DeletePhraseMe.Click += new EventHandler(DeletePhraseMe_Click);
//增加控件(dgvMe)右鍵
dgvMe.gmnRightMenu.Items.Add(DeletePhraseMe);
ToolStripMenuItem DeletePhraseMe = new ToolStripMenuItem();
DeletePhraseMe.Name = "DeleteBookMark";
DeletePhraseMe.Text = "刪除詞庫";
//定義右鍵事件
DeletePhraseMe.Click += new EventHandler(DeletePhraseMe_Click);
//增加控件(dgvMe)右鍵
dgvMe.gmnRightMenu.Items.Add(DeletePhraseMe);
/// <summary>
/// 公用詞庫右鍵刪除功能
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void DeletePhraseComm_Click(object sender, EventArgs e)
{
//得到主鍵GUID值
//msPraGUID = dgvCommon.CurrentRow.Cells[0].Value.ToString();
string sPrimaryKey = mdtSource.PrimaryKey[0].ToString();
//得到主鍵GUID值
msPraGUID = dgvCommon.CurrentRow.Cells[sPrimaryKey].Value.ToString();
if (this.tabPra.SelectedTab.Name.ToString() == "tabComm" && dgvCommon.CurrentRow != null)
{
bool delSucceeded = FrontRemoting.Remoting.DeletePraRecord(ClbFrontInfo.clsFrontInfo.UserKey, this.Tag.ToString(), "//@filterGUID", msPraGUID);
if (delSucceeded)
{
//從界面上刪除已刪除的資料
dgvCommon.Rows.Remove(dgvCommon.CurrentRow);
FrontHelper.ShowMsg(2, "刪除成功!");
}
}
}
/// 公用詞庫右鍵刪除功能
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void DeletePhraseComm_Click(object sender, EventArgs e)
{
//得到主鍵GUID值
//msPraGUID = dgvCommon.CurrentRow.Cells[0].Value.ToString();
string sPrimaryKey = mdtSource.PrimaryKey[0].ToString();
//得到主鍵GUID值
msPraGUID = dgvCommon.CurrentRow.Cells[sPrimaryKey].Value.ToString();
if (this.tabPra.SelectedTab.Name.ToString() == "tabComm" && dgvCommon.CurrentRow != null)
{
bool delSucceeded = FrontRemoting.Remoting.DeletePraRecord(ClbFrontInfo.clsFrontInfo.UserKey, this.Tag.ToString(), "//@filterGUID", msPraGUID);
if (delSucceeded)
{
//從界面上刪除已刪除的資料
dgvCommon.Rows.Remove(dgvCommon.CurrentRow);
FrontHelper.ShowMsg(2, "刪除成功!");
}
}
}