Provides a class to filter the color of the Visual objects. This class cannot be inherited.
public sealed class ColorTransform: Object
ObjectColorTransform
// 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;
gd.SetColor( 0, Color.FromArgb(255,0,0)); // red color
gd.SetColor( 1, Color.FromArgb(0,255,0) );// green color
gd.SetColor( 2, Color.FromArgb(0,0,255) );// blue color
// Creates a new instance of the ColorTransform
myColor = new ColorTransform();
// to filter the red color.
);
// 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);
}
}
public class MyForm : System.Windows.Forms.Form
{
private MyControl control1= null;
public MyForm()
{
InitializeComponent();
}
private void InitializeComponent()
{
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() );
}
}
Namespace System.Drawing Flash Library System.Drawing.scl Flash Library Version 2.0.0.1291 Silverlight Library System.Windows.Forms.dll
| © 2003-2007 NETiKA Technologies. All rights reserved. |