#region 绑定行按钮
///
/// 绑定行按钮
///
private void BindOpearButton()
{
Dictionary<object, string> dicButtons = new Dictionary<object, string>();
dicButtons.Add("dispatch", "派单");
//dicButtons.Add("pay", "缴费");
RepositoryItemButtonEdit ribeFile = CreateRepositoryItemButtonEdit(dicButtons);
ribeFile.ButtonClick += ribeFile_ButtonClick; //绑定事件
//gcData.RepositoryItems.Add(ribeFile);
//this.Operate.ColumnEdit = ribeFile;
gridView2.Columns["Operae"].ColumnEdit = ribeFile;
gridView2.BestFitColumns();//自动列宽
}
private void ribeFile_ButtonClick(object sender, ButtonPressedEventArgs e)
{
int i = gridView2.FocusedRowHandle;
//MessageBox.Show(i.ToString() + e.Button.Caption);
switch (e.Button.Caption)
{
case "派单":
string MoDid = gridView2.GetFocusedRowCellValue("MoDid").ToString();
MessageBox.Show(MoDid);
break;
default:
break;
}
}
private RepositoryItemButtonEdit CreateRepositoryItemButtonEdit(Dictionary<object, string> dicButtons)
{
RepositoryItemButtonEdit repositoryBtn = new RepositoryItemButtonEdit();
repositoryBtn.AppearanceDisabled.Options.UseTextOptions = true;
repositoryBtn.AppearanceDisabled.TextOptions.HAlignment = HorzAlignment.Near;
repositoryBtn.AutoHeight = false;
repositoryBtn.TextEditStyle = TextEditStyles.HideTextEditor;
repositoryBtn.ButtonsStyle = BorderStyles.UltraFlat;
repositoryBtn.Buttons.Clear();
EditorButton btn = null;
foreach (KeyValuePair<object, string> item in dicButtons)
{
btn = new EditorButton();
btn.Kind = ButtonPredefines.Glyph;
btn.Appearance.BackColor = Color.DodgerBlue;
btn.Appearance.ForeColor = Color.White;
btn.Caption = item.Value;
btn.Tag = item.Key;
repositoryBtn.Buttons.Add(btn);
}
return repositoryBtn;
}
#endregion
private void FormOrderU8_Load(object sender, EventArgs e)
{
BindOpearButton();
}