2

I'm looking at updating some existing code and making a popup modal which contains a custom user control and wondering if this is possible?

I know if I was to place the custom UserControl inside another form this could be achieved quite easily but this seems a bit overkill.

(CommentBox is the custom control)

CommentBox comment = CommentManager.GetComments(commentType, foreignID);

.//Some code to determine location of the popup
.
.
Popup popup = new Popup(comment);
popup.Show(grid.PointToScreen(viewerLocation));
Standage
  • 1,517
  • 7
  • 22
  • 41

1 Answers1

1

If it has to be modal, then you have to use a form.

If you are just needing it to pop up over the form, then look into ToolStripDropDown and ToolStripControlHost to provide that ability. Here is an example: Padding/ Size / Margin, when using ToolstripControlHost for a popup control

Community
  • 1
  • 1
LarsTech
  • 80,625
  • 14
  • 153
  • 225
  • Cheers for that, I'm guessing ToolStripDown and ToolStripControlHost can't be made modal as well? – Standage Aug 09 '12 at 19:21
  • @Standage No, because they have a form for that. If you need it modal, you can always just create a form in code and add your control to it with a Dock.Fill type style, etc. – LarsTech Aug 09 '12 at 19:25