Question: Propper Design and Implementation of a WinForms Custom Control

Gliddador

Member
Joined
Jan 22, 2023
Messages
24
Programming Experience
5-10
Yesterday, I decided to start writing an application, providing the user a convenient interface for making and editing outlines. I want to implement an OutlineEditorControl control to allow this.

However, I want to do a good job on the creation of this control, making its API conform to .NET standards. I also saw something in GTK called CellRenderer and some MVC stuff. This makes me wonder if I can adhere to .NET standards as well as possible while also using the MVC pattern and way of rendering controls by having each UI element have a customizable renderer.

So, my question is: What is the proper way to design and implement a WinForms custom control, with some deviation to ways of doing things outside .NET? And also, for Desktop applications, should I create only the parts of the custom control that are necessary for the application?
 
I've decided not to continue working on that project, but I would still like to know how to properly design and implement .NET WinForms custom controls.
 
Microsoft is not prescriptive about how to write WinForms code (unlike WPF where they advocate using MVVM). WinForms was designed to be an easy transition for people who used to write Win32 API or MFC code, and the subset of VB6 programmers. All that mattered was that you handled the Windows messages. It didn't matter if your code was structured using the MVP (Model-View-Presenter), MVC, MVVM, or just spaghetti code.
 
I should amend what I wrote in post #3.

Microsoft is not prescriptive about how you write the private internals of your WinForms code. Microsoft is prescriptive about your code's public facing API. Microsoft is also prescriptive about how Windows UI should look and act like.

If ever you hear "I don't like Windows because the UI is so inconsistent. Give me a Mac instead.", it because people are not following the UI design guidelines and decide to strike out on their own. Microsoft, unlike Apple, doesn't have much power to enforce the UI guidelines.

 
Back
Top Bottom