i am creatnig an windows desktop application. and in the main form i have a menu stript. what i want to do is attached one user control to eacn menu stript. each user control has a different design.
how can i do this???
any tutorial

Recommended Answers

All 2 Replies

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

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();

	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; }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.