windows forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gilit golit
    New Member
    • Feb 2011
    • 27

    windows forms

    Hi !

    What is the common and recommended way for writing GUI for a c# project ? Is it windows forms or not ? If so, does it have limitations (like number of buttons )?
    Is it simple to implement all the GUI for a commercial project using winforms ?
    Thanks
  • hype261
    New Member
    • Apr 2010
    • 207

    #2
    Windows forms or WPF currently is the standard for writing a commercial project using C#. I have never heard of any limitations on the number of controls you can have on your forms, but I believe it would be limited to the amount of memory and processing speed your target computer.

    That being said in OO programming there is a term called the Single Responsibility Principal and I believe this principal also applies to any forms you design. Don't over crowd them with tons of buttons and controls. You will confuse your users and make your forms unmodular.

    Comment

    • GaryTexmo
      Recognized Expert Top Contributor
      • Jul 2009
      • 1501

      #3
      Actually there is a limit for the number of controls you can put on a form. It's an operating system restriction and is around 10 000 controls (sometimes higher, sometimes lower), but you can change it at the OS level if you want (not really recommended). The limitation is actually the number of handles the operating system supports, and every control gets its own handle. When you reach this limit you get an exception.

      Error creating window handle.
      I made a tester a while ago when I discovered the issue, you're welcome to play around with it. The executable doesn't work, so just copy/paste the code into a new project.

      If nothing else, this will let you find out roughly where your OS limit is ;)



      I did some quick testing because I haven't played with it in a while and it looks like once you hit this limit, your program can't create any new handles, but the OS still can. I'm not really sure how it works, this was a couple years back, but you can look into it.

      Anyway, you should never actually hit this limit. As hype said, you shouldn't crowd your form with too much stuff. If you find yourself getting that high on the control count, you might want to start thinking of alternative solutions.

      Comment

      • gilit golit
        New Member
        • Feb 2011
        • 27

        #4
        Thanks
        Thats more then enought
        I wanted to know that Winform will not cause me troubles.
        What is the diff between winform and WPF ?

        Comment

        • gilit golit
          New Member
          • Feb 2011
          • 27

          #5
          Thanks

          What is the diff between winform and WPF ?

          Comment

          • hype261
            New Member
            • Apr 2010
            • 207

            #6
            WPF stands for Windows Presentation Foundation and came out with Visual Studio 2008. It is the "newer" way to build C# applications. Basically all your design of the forms is in xaml which is very similar to xml. With WPF it is a lot easier to design very visually interesting forms. With WinForms you could probably do the same thing, but you are going to have to program it all yourself.

            Comment

            Working...