GMMorris Posted March 13, 2004 Posted March 13, 2004 First of all, hello This is my first thread here so I feel a aslight introdaction is in order. My name is Gidi Morris, and I have only reacently moved, proffesionally, from DBA (Oracle) to application (.Net), and so I'm in the whole process of relearning what I knew before moving to databases, about actual programming. Hence I will be around alot :) since my regular community (Yaxay.com) is all desgn and web-programming, and no good at things like .Net. Any way - my problem: I've made a custom control I call DocumentLayout, which is basicaly the document display in Outlook 2003 (Where E-mails are displayed). (See screenshot) My problem is that at the moment contents are added through methods where the aparameters are objects which inherit from Control (Such as Panel and Button). What I want is for programmers to be able to drag controls from the toolbox and drop them into the control. How can I do this? P.S.: I'm building a library of controls I've made during my study of .Net and C# so its in your interest to help me, since I plan on releasing all my control to the public :D Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
*Experts* mutant Posted March 13, 2004 *Experts* Posted March 13, 2004 If I understood your question correctly then inheriting your control from ContainerControl rather then Control will allow the design time drag-and-drop of controls onto your control since then your cotnrol will be a container. Quote
GMMorris Posted March 13, 2004 Author Posted March 13, 2004 Ok, I'll try it and let you know :) Thanks. I hope it won't crash the whole thing, since at the moment I inherit from UserControl, which ibviously isn't something you can just go and switch :D we will see.. Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
GMMorris Posted March 13, 2004 Author Posted March 13, 2004 Ok, it worked great - except for 1 thing: It added the control to the actuall Object, and it is only the Panel in the center (the white part in the screen-shot that should contain the control. Is there a way for me to redirect the controls added to the Object in design time to that Panel instead of the object's "Controls" member? (Other than manually moving them at load time?) Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
*Experts* mutant Posted March 13, 2004 *Experts* Posted March 13, 2004 You could use the ControlAdded event of your container and add the control to the panel and remove it from your container. Quote
*Experts* mutant Posted March 13, 2004 *Experts* Posted March 13, 2004 One thing, why not directly inherit the panel? If the only reason you are doing it like that to have a grey border like that then don't do it. You can easily draw your own border using GDI+ in the control's paint event. Quote
GMMorris Posted March 13, 2004 Author Posted March 13, 2004 I thought of that (thats what I meant by "manually"), but I do add controls to it in the class's definition, which I do want, so what I need is a way to tell weather the controls were added during design/run time and not during the class's constraction. Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
GMMorris Posted March 13, 2004 Author Posted March 13, 2004 The reason I'm doing it that way is because there is more to it than you can see in the image. I have several panels there, in order to force particular layout behavior. I can't realy explain it, you'll see when I release the control's source code. Quote Latly it would seem as though I'm don't abnegate from anything... except women. :( :)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.