문제

I am attempting to add a simple toolstrip however I can't get it to show up on the screen here is all the code pertaining to it. Did I leave anything out?

Field:

  protected ToolStrip _commandToolStrip = new ToolStrip();

In the Constructor

     FillToolBar();
     _commandToolStrip.Visible = true;
     _commandToolStrip.BringToFront();

The Methods:

  private void FillToolBar()
  {

     _commandToolStrip.Dock = DockStyle.Right;
     _commandToolStrip.Visible = true;
     ToolStripButton commandButton = new ToolStripButton("test", convertIconToImage((System.Drawing.Icon)(resources.GetObject("$this.Icon"))), Command_NextWebPattern_Execute);
     _commandToolStrip.Items.Add(commandButton);
  }

   private Image convertIconToImage(Icon icon)
   {
      Bitmap bm = icon.ToBitmap();
      Image convertedImage = bm;
      return convertedImage;
   }

I cant seem to find any reason why it doesn't show.

도움이 되었습니까?

해결책

Found the problem almost as soon as I posted the question.. Lol

I needed to be sure that the parent was set to my form

The ToolStrip Parent was never set. I will leave the question up for anyone else who makes the same dumb mistake :P

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top