Represents a filter which adds a Gradient color frame to the VisualElement it is applied on.
public class GradientGlowFilter: Filter
ObjectFilterGradientGlowFilter
// This sample shows how to create an AsyncImage class and how to apply a DropShadowFilter on it.
using System;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing.Filters;
public class MyControl : System.Windows.Forms.Control
{
AsyncImage myAsyncImage;
public MyControl() {}
protected override void OnCreateControl()
{
Visual v= this.Visual;
// Initializes the Gradient object with 6 gradient color elements.
gd.SetColor( 0, Color.FromArgb(255,0,0) );
gd.SetAlpha(0, 15); // Sets the new value to alpha value.
gd.SetColor( 1, Color.FromArgb(0,255,0) );
gd.SetColor( 2, Color.FromArgb(0,0,255) );
gd.SetColor( 3, Color.FromArgb(255,0,0) );
gd.SetColor( 4, Color.FromArgb(0,255,0) );
gd.SetColor( 5, Color.FromArgb(255,0,255) );
// Displays the properties of the initial Gradient.
Debug.WriteLine("Properties of the initial gradient color element:");
Debug.WriteLine("\tThe number of the gradient color elements: " +gd
.Count);Debug.WriteLine("\tThe alpha value: " +gd.GetAlpha(5));
Debug.WriteLine("\tThe rgb value: " +gd.GetRgb(5));
Debug.WriteLine("\tThe Color structure: " +gd.GetColor(5));
Debug.WriteLine("\tThe offset value: " +gd.GetOffset(5));
string url= "http://www.netikatech.com/demos/resources/image.aspx?index=1";
// Creates a new instance of the AsyncImage.
this.myAsyncImage = new AsyncImage(v, 30, 20 );
// Creates a new GradientGlowFilter.
GradientGlowFilter graGlowFil = new GradientGlowFilter();
// Sets the gradient to the GradientGlowFilter.
// Gets, sets and displays some properties of the GradientGlowFilter object.
Debug.WriteLine("\nProperties of the Filter:");
Debug.WriteLine("\tAngle:" +graGlowFil.Angle);
graGlowFil.GlowType= GlowType.Outer;
Debug.WriteLine("\tGlowType:" +graGlowFil.GlowType);
Debug.WriteLine("\tBlurX:" +graGlowFil.BlurX);
Debug.WriteLine("\tBlurY:" +graGlowFil.BlurY);
Debug.WriteLine("\tDistance:" +graGlowFil.Distance);
Debug.WriteLine("\tKnockout:" +graGlowFil.Knockout);
Debug.WriteLine("\tQuality:" +graGlowFil.Quality);
Debug.WriteLine("\tStrength:" +graGlowFil.Strength);
// Applies the GradientGlowFilter to the AsyncImage.
this.myAsyncImage.ApplyFilter(graGlowFil);
// Creates a new Gradient.
Gradient copyGrad= new Gradient(6);
// Copies the gradient of the GradinetBevelFilter to a Gradient.
graGlowFil.CopyGradient(copyGrad);
// Displays the properties of the copy of the initial Gradient.
Debug.WriteLine("\nProperties of the copy of the initial gradient color element:");
Debug.WriteLine("\tThe number of the gradient color elements: " +copyGrad.Count);
Debug.WriteLine("\tThe alpha value: " +copyGrad.GetAlpha(5));
Debug.WriteLine("\tThe rgb value: " +copyGrad.GetRgb(5));
Debug.WriteLine("\tThe Color structure: " +copyGrad.GetColor(5));
Debug.WriteLine("\tThe offset value: " +copyGrad.GetOffset(5));
}
}
public class Form1 : System.Windows.Forms.Form
{
private MyControl control1= null;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.control1= new MyControl();
this.control1.Location= new System.Drawing.Point(10,10);
this.control1.Size= new Size(Application.Width-10,Application.Height-10);
this.Controls.Add(this.control1);
}
static void Main()
{
Application.Run( new Form1() );
}
}
/*
The output of the sample:
Properties of the initial gradient color element:
The number of the gradient color elements: 6
The alpha value: 255
The rgb value: 16711935
The Color structure: Color [R=255,G=0,B=255,A=255]
The offset value: 250
Properties of the Filter:
Angle:44.9999999772279
GlowType:1
BlurX:8
BlurY:8
Distance:5
Knockout:False
Quality:4
Strength:5
Properties of the copy of the initial gradient color element:
The number of the gradient color elements: 6
The alpha value: 255
The rgb value: 16711935
The Color structure: Color [R=255,G=0,B=255,A=255]
The offset value: 250
*/
Namespace System.Drawing.Filters Flash Library System.Windows.Forms.scl Flash Library Version 2.0.0.2118 Silverlight Library System.Windows.Forms.dll
| © 2003-2007 NETiKA Technologies. All rights reserved. |