Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7.  
  8. namespace myProgram
  9. {
  10. public class MyToolBar : BindingNavigator
  11. {
  12. private ToolStripButton DataGrid_ToolstripMoveNext = new ToolStripButton();
  13. private ToolStripButton toolStripButton1 = new ToolStripButton();
  14. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
  15.  
  16. public override void AddStandardItems()
  17. {
  18. this.Items.AddRange(new ToolStripItem[] { DataGrid_ToolstripMoveNext, toolStripButton1 });
  19. }
  20.  
  21. private void OnClick(object sender, EventArgs e)
  22. {
  23. // here is some code that doesn't execute
  24. }
  25. public MyToolBar()
  26. {
  27. // Default button
  28. DataGrid_ToolstripMoveNext.Name = "DataGrid_ToolstripMoveNext";
  29. DataGrid_ToolstripMoveNext.Text = "Move next";
  30. DataGrid_ToolstripMoveNext.MouseHover += new EventHandler((sender, e) => //code that doesn't work either);
  31.  
  32. // My custom button
  33. toolStripButton1.Name = "DataGrid_MyButton";
  34. toolStripButton1.Text = "My Button2";
  35. toolStripButton1.MouseHover += new EventHandler(OnClick);
  36.  
  37. MoveNextItem = DataGrid_ToolstripMoveNext;
  38.  
  39. MoveNextItem.Enabled = true;
  40. toolStripButton1.Enabled = true;
  41. }
  42.  
  43. private void InitializeComponent()
  44. {
  45. ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
  46. this.SuspendLayout();
  47. ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
  48. this.ResumeLayout(false);
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement