//-------------------------------------------------------------------------
// StrokeDropShadow.cs (c) 2005 by Charles Petzold, www.charlespetzold.com
//-------------------------------------------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Ink;

class StrokeDropShadow: Form
{
	public static void Main()
	{
		Application.Run(new StrokeDropShadow());
	}
	public StrokeDropShadow()
	{
		Text = "Stroke Drop Shadow";
		BackColor = Color.White;
		Size = new Size(640, 480);

		InkOverlay inkov = new InkOverlay(this);
		inkov.DefaultDrawingAttributes.Width = 1000;
		inkov.DefaultDrawingAttributes.IgnorePressure = true;
		inkov.Stroke += new InkCollectorStrokeEventHandler(InkOverlayOnStroke);
		inkov.Enabled = true;
	}
	void InkOverlayOnStroke(object objSrc, InkCollectorStrokeEventArgs args)
	{
		Stroke stk = args.Stroke;
		Ink ink = stk.Ink;

		// Draw shadow using AND raster operation
		Stroke stkShadow = ink.CreateStroke(stk.GetPoints());
		stkShadow.DrawingAttributes = stk.DrawingAttributes.Clone();
		stkShadow.DrawingAttributes.Color = Color.Gray;
		stkShadow.DrawingAttributes.RasterOperation = RasterOperation.MaskPen;
		stkShadow.Move(250, 250);

		Invalidate();
	}
}