GOA - System.Drawing.ColorTransform

ColorTransform Class


Provides a class to filter the color of the Visual objects. This class cannot be inherited.

Definition

public sealed class ColorTransform: Object

Members Table

MethodDescription
ClearRemoves the current offsets and scales of ARGB components of the ColorTransform.
ClearAddRemoves the current offsets of ARGB components of the ColorTransform.
ClearScaleRemoves the current scales of ARGB components of the ColorTransform.
ColorTransformOverloaded. Initializes a new instance of ColorTransform.
EqualsOverloaded. Compares two objects to determine if they are equal.
GetHashCodeOverriden. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetTypeGets the Type of the current instance. (Inherited from Object)
ReferenceEqualsDetermines whether the specified Object instances are the same instance. (Inherited from Object)
SetAddSets the specified offsets of ARGB components to the ColorTransform.
SetScaleSets the specified scales of ARGB components to the ColorTransform.
ToStringReturns a String that represents the current Object. (Inherited from Object)
PropertyDescription
AddAlphaGets or sets the offset for the alpha component of the ColorTransform.
AddBlueGets or sets the offset for the blue component of the ColorTransform.
AddGreenGets or sets the offset for the green component of the ColorTransform.
AddRedGets or sets the offset for the red component of the ColorTransform.
ScaleAlphaGets or sets the scale for the alpha component of the ColorTransform.
ScaleBlueGets or sets the scale for the blue component of the ColorTransform.
ScaleGreenGets or sets the scale for the green component of the ColorTransform.
ScaleRedGets or sets the scale for the red component of the ColorTransform.
OperatorDescription
operator !=Determines whether two specified ColorTransform instances are different.
operator *Multiplies two specified ColorTransform instances by their matrices to create a new ColorTransform.
operator ==Determines whether two specified ColorTransform instances are equivalent.

Inheritance Hierarchy

Object
ColorTransform

Examples

// This sample shows how to implement the ColorTransform class to filter the color.

 

using System.Drawing;

using System.Windows.Forms;

 

public class MyControl : System.Windows.Forms.Control

{

     ColorTransform myColor ;

     protected override void OnPaint( PaintEventArgs e )

     {

          Visual v= this.Visual;

          Gradient gd= new Gradient(3);

          gd.SetColor( 0, Color.FromArgb(255,0,0)); // red color

          gd.SetOffset( 0, 0 );

          gd.SetColor( 1, Color.FromArgb(0,255,0) );// green color

          gd.SetOffset( 1, 100);

          gd.SetColor( 2, Color.FromArgb(0,0,255) );// blue color

          gd.SetOffset( 2, 255 );

 

          // Creates a new instance of the ColorTransform

          myColor = new ColorTransform();

          // to filter the red color.

          myColor.SetScale(0,1,1,1);

          v.SetColorTransform(myColor);

 

          // A transparent rectangle filled with a radial gradient

          v.BeginLinearGradientFill( gd, new PointF(10,10), new PointF(360,260) );

          v.DrawRectangle(10,10,360,260);

          v.EndFill();

     }

}

 

 

public class MyForm : System.Windows.Forms.Form

{

     private MyControl control1= null;

     public MyForm()

     {

          InitializeComponent();

     }

     private void InitializeComponent()

     {

          SuspendLayout();

          control1= new MyControl();

          control1.Location= new System.Drawing.Point(5,5);

          control1.Size= new Size(Application.Width-10,Application.Height-10);

          Controls.Add(this.control1);

          ResumeLayout(false);

     }

     static void Main()

     {

          Application.Run( new MyForm() );

     }

}

Class Information

NamespaceSystem.Drawing
Flash LibrarySystem.Drawing.scl
Flash Library Version2.0.0.1291
Silverlight LibrarySystem.Windows.Forms.dll



© 2003-2007 NETiKA Technologies. All rights reserved.