Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Form Designer

Form Designer

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiotutorial
14 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J James T Johnson

    BLaZiNiX wrote: I want to create something similar to the C# Form Designer include in the C# IDE but not too advanced, I just want to know how can I lock a Form in my Main Application Window, anybody know how to make something like this ? From what I can tell the VS.NET forms designer actually loads the form up into a temporary app domain and displays it in the window. To display a Form inside another form use this bit of code.

    Form childForm = GetFormToDisplay();

    childForm.TopLevel = false;
    childForm.Location = GetLocation();

    this.Controls.Add(childForm);

    You'll also have to hook several messages using Application.AddMessageFilter so that the child form can't be moved around (NCHITTEST plus some WM_SYSCOMMAND). I have another message here that explains how to use Application.AddMessageFilter James Simplicity Rules!

    B Offline
    B Offline
    BLaZiNiX
    wrote on last edited by
    #3

    k i will try to code it, if I need help again I will post another msg BTW do you know how can I (suppose I have a button control) remove some property in the PropertyGrid and replace it by my own. In my application, I add a propertyGrid and I want to show only some property for some controls, how can I do this ? Thanks Again James :)

    J 1 Reply Last reply
    0
    • B BLaZiNiX

      I want to create something similar to the C# Form Designer include in the C# IDE but not too advanced, I just want to know how can I lock a Form in my Main Application Window, anybody know how to make something like this ? thanks. BTW, is it possible to create a DLL with the other dll I need to create an application like System.DLL, System.Windows.Form.DLL all those DLL include in one So after I can only compile my program using this DLL ??? if yes how can I do this ? Thanks Again :)

      J Offline
      J Offline
      James T Johnson
      wrote on last edited by
      #4

      Oops, I don't think I ever posted that message explaining Application.AddMessageFilter :-O AddMessageFilter takes an instance of the IMessageFilter interface, it has one method, PreFilterMessage which works like the WndProc except it returns true if the message has been filtered and doesn't need to be processed anymore. So to use it:

      public class MyClass : ......, IMessageFilter
      {
      bool IMessageFilter.PreFilterMessage(ref Message m)
      {
      // do something with m

      return bShouldContinueProcessing;
      

      }
      }

      Then when you want to add it to the Message filter, Application.AddMessageFilter(myClass as IMessageFilter); BLaZiNiX wrote: BTW, is it possible to create a DLL with the other dll I need to create an application like System.DLL, System.Windows.Form.DLL all those DLL include in one So after I can only compile my program using this DLL ??? if yes how can I do this ? Nope, not with strongly-named assemblies they cannot be modified since a checksum is used to ensure they haven't changed. There is a utility out there somewhere for combining multiple assemblies into one, but it can't be used on strong named assemblies because of the previously mentioned reasons. I forget the name of the utility; maybe Rama Krishna remembers it (it was mentioned on the dotnet list not too long ago; if i remembered the context I could look it up). James Simplicity Rules!

      1 Reply Last reply
      0
      • B BLaZiNiX

        k i will try to code it, if I need help again I will post another msg BTW do you know how can I (suppose I have a button control) remove some property in the PropertyGrid and replace it by my own. In my application, I add a propertyGrid and I want to show only some property for some controls, how can I do this ? Thanks Again James :)

        J Offline
        J Offline
        James T Johnson
        wrote on last edited by
        #5

        BLaZiNiX wrote: BTW do you know how can I (suppose I have a button control) remove some property in the PropertyGrid and replace it by my own. Without creating your own class derived from PropertyGrid you can't replace specific properties with your own. The property grid shows all properties with a BrowsableAttribute set to BrowsableAttribute.Yes. So you could create your own psuedo-button class that encapsulates a Button, and pass that as the SelectedObject in the property grid. James Simplicity Rules!

        1 Reply Last reply
        0
        • J James T Johnson

          BLaZiNiX wrote: I want to create something similar to the C# Form Designer include in the C# IDE but not too advanced, I just want to know how can I lock a Form in my Main Application Window, anybody know how to make something like this ? From what I can tell the VS.NET forms designer actually loads the form up into a temporary app domain and displays it in the window. To display a Form inside another form use this bit of code.

          Form childForm = GetFormToDisplay();

          childForm.TopLevel = false;
          childForm.Location = GetLocation();

          this.Controls.Add(childForm);

          You'll also have to hook several messages using Application.AddMessageFilter so that the child form can't be moved around (NCHITTEST plus some WM_SYSCOMMAND). I have another message here that explains how to use Application.AddMessageFilter James Simplicity Rules!

          N Offline
          N Offline
          Neil Van Note
          wrote on last edited by
          #6

          I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you. I used this technique a little while back to implement a Wizard97 look-a-like that allowed users to design their own forms and feed it to the primary Wizard form (sheet), all the wizard had to do was adjust a few properties and drop it into the mix, works well. Regards

          J B 2 Replies Last reply
          0
          • N Neil Van Note

            I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you. I used this technique a little while back to implement a Wizard97 look-a-like that allowed users to design their own forms and feed it to the primary Wizard form (sheet), all the wizard had to do was adjust a few properties and drop it into the mix, works well. Regards

            J Offline
            J Offline
            James T Johnson
            wrote on last edited by
            #7

            Neil Van Note wrote: I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you. LOL, yeah I always forget that; then wind up going over my code three times trying to find the bug ;P Simplicity Rules!

            N 1 Reply Last reply
            0
            • J James T Johnson

              Neil Van Note wrote: I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you. LOL, yeah I always forget that; then wind up going over my code three times trying to find the bug ;P Simplicity Rules!

              N Offline
              N Offline
              Neil Van Note
              wrote on last edited by
              #8

              Every time... :omg:

              1 Reply Last reply
              0
              • N Neil Van Note

                I believe you will need to do a childForm.Show() on that also. The Forms framework doesn't seem to do it for you. I used this technique a little while back to implement a Wizard97 look-a-like that allowed users to design their own forms and feed it to the primary Wizard form (sheet), all the wizard had to do was adjust a few properties and drop it into the mix, works well. Regards

                B Offline
                B Offline
                BLaZiNiX
                wrote on last edited by
                #9

                do you think you can send me a sample code of something like your Wizard app ? at this moment it's going well but I think I will have problem later :( Thanks Jonathan Pouliot

                N 1 Reply Last reply
                0
                • B BLaZiNiX

                  do you think you can send me a sample code of something like your Wizard app ? at this moment it's going well but I think I will have problem later :( Thanks Jonathan Pouliot

                  N Offline
                  N Offline
                  Neil Van Note
                  wrote on last edited by
                  #10

                  Well, if you follow James instructions above, it should do you pretty well. I really don’t feel right about releasing my code for this just yet, as it’s running in a current client’s system. Just shout when you need assistance and one of us will push you in the right direction, or possibly someone reading this may have something similar that they are a little more free to share. A word of caution up front though, in the current release of the .NET framework, forms created in this manner do not receive their OnClosing/OnClosed events naturally, and you should probably issue a Close on them manually when the container form receives its notification. A second solution, which I used, was to issue a custom set of Wizard related events to signal that the parent was about to close and it was time for the form(s) to cleanup. Using this method protects my code from issuing a second Close, just in case the boys and gals over at MSFT decide to fix the issue. The dispose methods do get called regardless. Regards

                  B 1 Reply Last reply
                  0
                  • N Neil Van Note

                    Well, if you follow James instructions above, it should do you pretty well. I really don’t feel right about releasing my code for this just yet, as it’s running in a current client’s system. Just shout when you need assistance and one of us will push you in the right direction, or possibly someone reading this may have something similar that they are a little more free to share. A word of caution up front though, in the current release of the .NET framework, forms created in this manner do not receive their OnClosing/OnClosed events naturally, and you should probably issue a Close on them manually when the container form receives its notification. A second solution, which I used, was to issue a custom set of Wizard related events to signal that the parent was about to close and it was time for the form(s) to cleanup. Using this method protects my code from issuing a second Close, just in case the boys and gals over at MSFT decide to fix the issue. The dispose methods do get called regardless. Regards

                    B Offline
                    B Offline
                    BLaZiNiX
                    wrote on last edited by
                    #11

                    the only thing it's after the user create the form dynamicly I want to include action on some controls like buttons and I want to compile all the form with the controls action in one file *.cs and after compile it to an exe. What I want to know it's how can I create the CS file to add the action and the form design in, like VC# does ? Thanks

                    N 1 Reply Last reply
                    0
                    • B BLaZiNiX

                      the only thing it's after the user create the form dynamicly I want to include action on some controls like buttons and I want to compile all the form with the controls action in one file *.cs and after compile it to an exe. What I want to know it's how can I create the CS file to add the action and the form design in, like VC# does ? Thanks

                      N Offline
                      N Offline
                      Neil Van Note
                      wrote on last edited by
                      #12

                      My wizard solution is something used by the clients developers, so it is more of a component than an application builder. Just out of curiosity, and I am definitely not the one that would try to stifle your ambition, but why are you trying to reinvent the wheel that was just built? It would seem to me that if you expose a good object model, extending an application built with .NET would be trivial without all of this, just having the clients developers use .NET to build extensions. Or are you looking for a mini environment like VBA in outlook? Regards

                      B 1 Reply Last reply
                      0
                      • N Neil Van Note

                        My wizard solution is something used by the clients developers, so it is more of a component than an application builder. Just out of curiosity, and I am definitely not the one that would try to stifle your ambition, but why are you trying to reinvent the wheel that was just built? It would seem to me that if you expose a good object model, extending an application built with .NET would be trivial without all of this, just having the clients developers use .NET to build extensions. Or are you looking for a mini environment like VBA in outlook? Regards

                        B Offline
                        B Offline
                        BLaZiNiX
                        wrote on last edited by
                        #13

                        I'm creating a Trainer Maker and I need to use a Form designer and I need to compile the form the user will create and I need to include some action like retreive the Textbox text to use it for a value and add Buttons action like to poke and freeze that's it. I want to make something similar to Trainer Maker Kit (try to look at this application,check for screenshot, if you want of course), it's in VC++ i think and I want to make something that can equal the perfection of this program. Of course with the .NET Technology. at this moment the form Designer works fine the only "hic" it's for that .CS file creating dynamicly. I'm suppose that is almost the same way as the C# IDE does, but i don't know very well how can I remake this. I don't want to make something big just a little file with the Window Form Designer code for all the controls and the action I will put on the controls. I will check how can I figure it out, but I think I will post a lot of question on this board :) I hope I don't bugging you with all my questions, if it's the case just tell me please Thanks

                        N 1 Reply Last reply
                        0
                        • B BLaZiNiX

                          I'm creating a Trainer Maker and I need to use a Form designer and I need to compile the form the user will create and I need to include some action like retreive the Textbox text to use it for a value and add Buttons action like to poke and freeze that's it. I want to make something similar to Trainer Maker Kit (try to look at this application,check for screenshot, if you want of course), it's in VC++ i think and I want to make something that can equal the perfection of this program. Of course with the .NET Technology. at this moment the form Designer works fine the only "hic" it's for that .CS file creating dynamicly. I'm suppose that is almost the same way as the C# IDE does, but i don't know very well how can I remake this. I don't want to make something big just a little file with the Window Form Designer code for all the controls and the action I will put on the controls. I will check how can I figure it out, but I think I will post a lot of question on this board :) I hope I don't bugging you with all my questions, if it's the case just tell me please Thanks

                          N Offline
                          N Offline
                          Neil Van Note
                          wrote on last edited by
                          #14

                          I think there is a sample in the C# section called LiveCode.NET that does something similar. I havent checked it out yet, but I am sure you have seen it in any event...

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups