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.
Unfortunately, activation email could not send to your email. Please try again.

"Mandatory control"-indicator

Thread ID:

Created:

Updated:

Platform:

Replies:

748 Aug 12,2002 03:58 AM Aug 29,2002 06:58 AM Windows Forms 2
loading
Tags: FAQ
Mikael Ericsson
Asked On August 12, 2002 03:58 AM

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

Prakash S [Syncfusion]
Replied On August 12, 2002 11:09 AM

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.

Mikael Ericsson
Replied On August 29, 2002 06:58 AM

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. > ...

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;