ActiveReports 6 Online Help
Style Class
Members  Example 

Represents the formatting properties of a control.
Object Model
Style ClassStyle Class
Syntax
'Declaration
 
Public Class Style 
public class Style 
Remarks

The Style class encapsulates the properties that control the appearance of a control and can be applied to multiple controls to provide a common appearance.

Style properties can be cascaded using inheritance.  When creating a new style you can set the values of unset properties to inherit from a parent style.  For example, if you have a style named "Normal", you can create a new style named "NormalBold" and set only the Parent property to "Normal" and the FontBold property to true. The remaining properties will be set the same as the parent style.

ActiveReports has a set of built-in styles that are defined in the StyleSheet class.

Example
Paste inside the ReportStart event.
this.StyleSheet.Add("MyStyle");
    this.StyleSheet["MyStyle"].Alignment = TextAlignment.Center;
    this.StyleSheet["MyStyle"].BackColor = System.Drawing.Color.White;
    this.StyleSheet["MyStyle"].FontBold = true;
    this.StyleSheet["MyStyle"].FontItalic = false;
    this.StyleSheet["MyStyle"].FontName = "Arial";
    this.StyleSheet["MyStyle"].FontSize = 10.5f;
    this.StyleSheet["MyStyle"].FontStrikeThrough = false;
    this.StyleSheet["MyStyle"].FontUnderline = false;
    this.StyleSheet["MyStyle"].ForeColor = System.Drawing.Color.YellowGreen;
    Console.WriteLine(this.StyleSheet["MyStyle"].Name.ToString());
    Console.WriteLine(this.StyleSheet["MyStyle"].Value.ToString());
    this.StyleSheet["MyStyle"].VerticalAlignment = VerticalTextAlignment.Middle;

    label1.ClassName = "MyStyle";

    if (this.StyleSheet.Count > 10)
    {
        this.StyleSheet.Remove("MyStyle");
    }
Paste inside the ReportStart event.
Me.StyleSheet.Add("MyStyle")
   Me.StyleSheet("MyStyle").Alignment = TextAlignment.Center
   Me.StyleSheet("MyStyle").BackColor = System.Drawing.Color.White
   Me.StyleSheet("MyStyle").FontBold = True
   Me.StyleSheet("MyStyle").FontItalic = False
   Me.StyleSheet("MyStyle").FontName = "Arial"
   Me.StyleSheet("MyStyle").FontSize = 10.5
   Me.StyleSheet("MyStyle").FontStrikeThrough = False
   Me.StyleSheet("MyStyle").FontUnderline = False
   Me.StyleSheet("MyStyle").ForeColor = System.Drawing.Color.YellowGreen
   Console.WriteLine(Me.StyleSheet("MyStyle").Name.ToString())
   Console.WriteLine(Me.StyleSheet("MyStyle").Value.ToString())
   Me.StyleSheet("MyStyle").VerticalAlignment = VerticalTextAlignment.Middle

   Label1.ClassName = "MyStyle"

   If Me.StyleSheet.Count > 10 Then
       Me.StyleSheet.Remove("MyStyle")
   End If
Inheritance Hierarchy

System.Object
   DataDynamics.ActiveReports.Style

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Style Members
DataDynamics.ActiveReports Namespace
Label Class
ClassName Property
StyleSheet Class

How To

Use External Style Sheets

Send Feedback