In this post I will show you the new Highlighter component that will be included in DotNetBar for Windows Forms 8.1 that we are planning on releasing soon.
Highlighter component allows you to visually highlight any control on the form using distinctive border style. You can use it with our SuperValidator component to highlight validation errors on the form. You can use it to highlight currently focused text-box. Or simply to draw user attention to control on the form.
To start using Highlighter control just double-click the highlighter component in VS.NET Toolbox to add it to the form:
Figure 1 – Highlighter Components in VS.NET toolbox
This is how form looks like with Highlighter component added:
Figure 2 – Highlighter Component on the form
To each control on the form the Highlighter component will add two properties:
- HighlightColor – Specifies the color to highlight the control with.
- HighlightOnFocus – Specifies whether control is automatically highlighted when it receives input focus. Highlighter.FocusHighlightColor property specifies the color that will be used for focus based highlighting.
To highlight any control on the form select the control and set HighlightColor property:
Figure 3 – Setting HighlightColor property
This is how control would appear at run-time with HighlightColor property set:
Figure 4 – Highlighter component highlighting the control
Setting HighlightColor from code
To set HighlightColor using code, use following statement:
highlighter1.SetHighlightColor(textBoxX1, eHighlightColor.Green)
To remove highlight from the control use following statement:
highlighter1.SetHighlightColor(textBoxX1, eHighlightColor.None)
Highlighting Focused Control
Highlighter component provides you with functionality to highlight control with the input focus automatically. All you have to do is set HighlightOnFocus property on each control on the form that you want to highlight. The easiest way to do that is to select all controls on the form you want to highlight as they receive focus:
Figure 5 – Select all controls you want to highlight on focus
Then in VS.NET property window set HighlightOnFocus property to true:
Now when you run your project and tab through controls on the form you will see the focused control highlighted:
To create focus highlighting from code use following statement:
highlighter1.SetHighlightOnFocus(textBoxX1, True)
and to remove focus highlight use following statement:
highlighter1.SetHighlightOnFocus(Me.textBoxX1, False)
I hope that this provides you with the good overview of the new Highlighter component that is unique to DotNetBar. I am sure in couple of months you will see clones everywhere, like it usually happens with new stuff we create 🙂
Looks cool; hope 8.1 is released before my subscription expires (few days).
Hey we have to give you reason to renew 🙂
That it’s true, that was the reason why a renew my site license =) .
All I can say is “this is just a good stuff”. I wanted this feature badly and here it is.
You said…”All you have to do is set HighlightOnFocus property to TRUE on each control on the form that you want to highlight”. But I would suggest to make this property value TRUE by default so that there is no extra bit of work involved for designers/developers. Why I am suggesting this bcoz there are greate number of chances that when NEW controls are added during the course of time on the form then each time dev needs to set those controls property value to true manually and if this is not done then the form will be inconsistant! I hope you will get my point. Just dropping a highlighter control should takecare of highlighting a control by default and no more property settings.
Hitesh
Can’t wait till this is released, will immediately start using this in combination with the SuperValidator when it becomes available.
Internally we have a mini-version of what you are creating that suites our needs, just. Can’t wait to drop that and replace it with the
Dotnetbar version, the less we maintain ourself, the more value we are getting for the money we paid for Dotnetbar (and that value
is already incredibly high).
Thanks and keep up the good work!
@dennis Thank you so much for using our controls. This should be released the week of 20th or at the latest week after that.
This just looks amazing. I can’t wait for the Highlighter and Validator to make their way into the suite. I will make extensive use of these two controls for sure.
Great work!
Thank you for using DotNetBar.
Cool stuff! Any plans for a lite suite for Windows Mobile?
Thanks!
Hi Denis Basaric,
May I request you to share your view on my suggestion given above abt making DEFAULT value of highligter property to TRUE instead of FALSE?
@hitesh No, we will not be doing that. The False is most sensible value. Otherwise we would have to guess which controls you want to highlight which is error prone process. For example any custom Panel control that you drop on the form which we do not know that it is a Panel should not be highlighted. But automatic highlighting does not have intelligence that you do to decide what needs to be highlighted. Same applies to any composite control from other vendors as well. So in short you know exactly what you want highlighted, but we do not so we leave that for you to set.
Looks really cool.
I implemented this manually on my controls (using the backcolor of the controls).
Would there be support for this too in a future version?
Higlighter.HighlightProperty = eHighlightProperty.BorderColor;
Higlighter.HighlightProperty = eHighlightProperty.BackColor;
Higlighter.HighlightProperty = eHighlightProperty.BorderColor | eHighlightProperty.ForeColor; // combinations perhaps
Ike, it would possible to add BackColor support as well. I’ll log your request. Thanks!