using System.Windows.Forms; using System.Runtime.InteropServices; namespace Moth { [MsdnMag.PreviewHandler("The Moth: HelloWorld Preview Handler", ".moth", "{F060452D-41EF-4c1c-BFFF-861869261A1D}")] [ProgId("Moth.MothPreviewHandler")] [Guid("4B590766-64A8-4f83-A230-BF8107607001")] [ClassInterface(ClassInterfaceType.None)] [ComVisible(true)] public sealed class MothPreviewHandler : MsdnMag.FileBasedPreviewHandler { protected override MsdnMag.PreviewHandlerControl CreatePreviewHandlerControl() { return new MothPreviewHandlerControl(); } } public sealed class MothPreviewHandlerControl : MsdnMag.FileBasedPreviewHandlerControl { public override void Load(System.IO.FileInfo file) { TextBox label1 = new TextBox(); label1.Multiline = true; label1.ReadOnly = true; label1.Dock = DockStyle.Fill; label1.Text = "Hello world from the Moth preview handler. \r\n You should use the file parameter and do more meaningful stuff :-)"; base.Controls.Add(label1); } } }