2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by nick.crane
0

Judith, you asked a similar question in this thread.
What effect are you trying to achieve?
[Edit]
What do you mean by "attach one user control to each menu strip"?

Edited by nick.crane: n/a

0

Have you looked at using a ToolStrip instead.
This allows you to "host" any control derived from Control.
A detailed example can be found here.

This is what I came up with to use a PictureBox in a ToolStripMenu.

public partial class Form2 : Form
	{
		ToolStripPictureBox toolstripPictureBox;
		public Form2()
		{
			InitializeComponent(); //<- toolStip1 added by designer
			toolstripPictureBox = new ToolStripPictureBox();
			toolstripPictureBox.PictureBoxImage = this.Icon.ToBitmap();
			toolStrip1.Items.Add(toolstripPictureBox);
		}
	}

	class ToolStripPictureBox : ToolStripControlHost
	{
		public ToolStripPictureBox()
			: base(new PictureBox())
		{
		}

		public PictureBox PictureBoxControl
		{
			get { return this.Control as PictureBox; }
		}

		public Image PictureBoxImage
		{
			get { return PictureBoxControl.Image; }
			set { PictureBoxControl.Image = value; }
		}
	}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.