|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Define irregularly shaped area in UserControl where controls may be droppedI have a UserControl that consists of two areas - a header and a content area. Users are to drop controls only in the content area. While this wouldn't be much of a problem if I added i.e. a panel control, the resulting content area would be a rectangle. However, the content area can be irregularly shaped. Also, since the UserControl itself is already a ContainerControl, adding a panel comes with some overhead as I need to call EnableDesignMode() for that panel, resulting in an additional property for the control where controls are added by the WinForms designer (i.e. <MyUserControl.ContentArea> instead of <MyUserControl>). I guess it should actually be possible to directly place child controls in the UserControl itself and still be able to restrict the content area. Any pointers? To further clarify the issue: The real problem with a rectangular client area is simply the fact that, if you drop a control into the content area (which itself is not rectangular) and move it to its edges, that control would overlap the content area (which is being painted inside). Here's a little sample image of what this could look like: http://www.intuidev.de/otherstuff/ContainerControlProblem.png Here, the textbox is "out of bounds" and I can't seem to find a way of dealing with this. :-( Cheers, Olaf Hi there Olaf,
You can fix what you are attempting to do just by creating an irregular shaped form and putting the drag-drop code inside of that. http://www.thescarms.com/dotnet/IrregularForm.aspx The Region API is what you need to use. Nick. Hi,
nak wrote: > The Region API is what you need to use. how could I have missed a simple ...~MyContentArea.Region = TheRegionForControls Can't believe I spent *hours* trying to find that missing piece. Thanks bunches! Cheers, Olaf Hey,
> how could I have missed a simple ... haha no probs! I spend enough time doing that also :)> ~MyContentArea.Region = TheRegionForControls > > Can't believe I spent *hours* trying to find that missing piece. > Thanks bunches! Nick.
Visual Studio 2008 hogging memory
partition numbers in four terms ListView - Caching Thumbnails? System.IO.File.Copy + NTFS Streams + special ACLs VS2010 for database developers exporting dataset to Excel is slow Converting from Access 32bit 64bit store the data that is entered in the form store the data that is entered in the datagriview |
|||||||||||||||||||||||