We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

"Mandatory control"-indicator

The project I work in is in need of a way of visualizing that a field/control is mandatory or not. Several approaches have been evaluated, and the preferred visual is a small triangular marker in the upper left corner (see attached JPG) inside the control. Why - well, the main reason is that this looks very much like the "mandatory" marker found on many paper-based forms. In the optimal case, the feature is controlled by a property "Is Mandatory" for the control. The problem: how to do this for the specified (see attached JPG) controls... -...especially for UpDown-based controls and ComboBoxes (!) We tried the same approach as described in the "Flat Controls" article at theCodeProject.com, but the text-part control overwrites any graphical parts we insert. -...making it possible to run the target app in Win2k and (!) WinXP -...without having to draw them completely from scratch ourselves? (Of course, we would like to think that it is only a question of adding a routine that draws the indicator on top of the control, or under it(setting the control contents transparent) - in order to let the standard control behaviour and visuals appear normally in WIn2K and WinXP...) Not-so-wanted approaches ;-) (We really _do_ want the triangular marker described above, and not...) -use an outside-marker instead (e.g., an asterisk as in a web solution) -use a surrounding frame with another colour (too intrusive) -use another background colour (ditto) -a label with different style/colour (visual focus on the wrong element) Most grateful for any kind of answer/comment! Best regards, Mikael Ericsson

2 Replies

PS Prakash S Syncfusion Team August 12, 2002 03:09 PM UTC

Hi Mikael, One approach that I can think of is to use a custom control that draws the marker triangle and parent this custom-control to your control (textbox/combo etc.,) requiring the mandatory marker. Setting the custom control's backcolor to be red and the window region to be equal to the marker triangle will ensure that painting is clipped to the triangular section and the parent control is visible in the remaining non-clipped regions. I have attached a sample with a UserControl that shows a bare-bones implementation. For the ComboBox control, you might have to access the constitutent Win32 TextBox control and parent the UserControl to it, rather than directly to the ComboBox. An added convenience feature would be to implement the custom-control as an extension-provider. This would make it a cinch to use within the designer. Prakash Syncfusion, Inc.


ME Mikael Ericsson August 29, 2002 10:58 AM UTC

Prakash, many thanks!!! Looking at your examples and improvising a bit, we now have a set of controls that actually does what we want!!!! Best regards, Mikael > Hi Mikael, > I have attached a sample with a UserControl that shows a bare-bones implementation. For the ComboBox control, you might have to access the constitutent Win32 TextBox control and parent the UserControl to it, rather than directly to the ComboBox. > ...

Loader.
Live Chat Icon For mobile
Up arrow icon