您的位置:首页 > Web前端

Look and Feel Technology - Much More than just Paint Styles

2006-04-23 17:48 447 查看
This white paper will introduce you to the LookAndFeel technology developed by Developer Express for its .NET WinForms controls. This technology lets you provide a consistent appearance across different controls (XtraGrid, XtraTreeList, XtraVerticalGrid, XtraBars and etc.) making it much easier to customize their appearance.

What is look and feel?

With the release of the XtraGrid Suite v2 we have introduced the unique LookAndFeel technology to our Windows® Forms .NET products. This technology enables you to provide a consistent appearance across your entire application and then to change the appearance of all the controls at once.

It is important not to confuse LookAndFeel technology with Styles. Modifying a control's look and feel settings doesn't involve specifying the colors and fonts used to paint individual elements. The LookAndFeel determines how the control's elements such as headers, scrollbars, borders, buttons are painted and the way in which they respond to user actions such as clicking, hovering with the mouse cursor, etc.

Currently, Developer Express controls provide you with 5 look and feel choices (Flat, Style3D, UltraFlat, XP and Office2003) and this collection constantly being added to, so you can imitate the latest Office and Windows look and feel solutions. For example, the recently added Office2003 style emulates the look and feel of Microsoft Office® 2003. The image below shows you a sample of an application with the Office2003 look and feel applied.

using DevExpress.LookAndFeel;
//
UserLookAndFeel.Default.UseWindowsXPTheme = false;

VB.NET

Imports DevExpress.LookAndFeel
'
UserLookAndFeel.Default.UseWindowsXPTheme = False

How does This Work

The Look and feel settings used (either by default or by a single control) are represented by a DevExpress.Utils.UserLookAndFeel object whose main properties are shown below:

using DevExpress.LookAndFeel;
//
// creating a new look and feel and customizing its settings
UserLookAndFeel customLookAndFeel = new UserLookAndFeel();
customLookAndFeel.UseDefaultLookAndFeel = false;
customLookAndFeel.Style = LookAndFeelStyle.Office2003;
// assigning the created look and feel to the tree list and grid controls
treeList1.LookAndFeel.ParentLookAndFeel = customLookAndFeel;
gridControl1.LookAndFeel.ParentLookAndFeel = customLookAndFeel;

VB.NET:

Imports DevExpress.LookAndFeel
'
' creating a new look and feel and customizing its settings
Dim customLookAndFeel As UserLookAndFeel = New UserLookAndFeel()
customLookAndFeel.UseDefaultLookAndFeel = False
customLookAndFeel.Style = LookAndFeelStyle.Office2003
' assigning the created look and feel to the tree list and grid controls
TreeList1.LookAndFeel.ParentLookAndFeel = customLookAndFeel
GridControl1.LookAndFeel.ParentLookAndFeel = customLookAndFeel

The following image illustrates the look and feel mechanism, and the way in which it affects the controls' appearances.



Figure 5. The Look And Feel mechanism.

Extra Look and Feels

Some Developer Express Windows® Forms .NET controls (XtraGrid, XtraNavBar, XtraEditors, etc.) support unique look and feels. For example, the XtraGrid has the MixedXP style that can be applied to its views. This style is the same as "WindowsXP", but column headers, band headers, footer, group footers and some other elements are painted flat. This paint style has been introduced to allow flat-painted elements to have custom styles while the rest are painted using the Windows XP theme applied.



Figure 6. The XtraGrid control with the MixedXP style applied.

One more example is the XtraNavBar control that has 13 predefined views which enable you to specify its desired look and feel. The views provided by the XtraNavBar are not affected by the LookAndFeel technology since the control introduces several different XP theme painted views, ultra-flat views, etc.



Figure 7. The XtraNavBar control with different views applied.

Summary

With Developer Express controls you get:




The latest look and feels



Quicker customization of the appearances of controls - fewer code lines



Several approaches to look and feel customization – from the entire application down to individual controls



A flexible approach to specifying the look and feel – with and without XP themes



More than just the standard appearances – some controls give you unique paint styles
Note that this is not all. The appearance of all Developer Express Windows® Forms .NET controls can be also customized by setting their individual style properties which gives you the ability to provide exactly the look and feel that your Business needs dictate.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: