Prev: This works to display images and just setting document text
Next: No TableAdapterManager created by Visual Studio Dataset Designer
From: Ed on 27 Apr 2010 17:49 string Body = "<body><b><center>Bold Test of the Printer</center></b><br />" + "This is just a standard line. <u>Underlined</u><br />" + "Signature <img src=\"" + file + "\" alt=\"img001.jpg\"></body>"; webBrowser1.DocumentText = Head + Body; // if it still gets cutoff it looks like this // img src="your image.jpg" /> // it uses the base href setup in the header to // find the image Ed Tischofer wrote: This works to display images and just setting document text 27-Apr-10 // I was going to use the browser control to display // a print preview and made this prototype. // The key is the base href in the header using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.IO; using System.Windows.Forms; namespace CFWBPrintPreview { public partial class PrintPreview : Form { const string file = @"img001.jpg"; string filePath; public PrintPreview() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { filePath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName; filePath = Path.GetDirectoryName(filePath); string Head = "<head><title>Print Preview</title><base href=\"file://localhost"+filePath+"/\" /></head>"; string Body = "<body><b><center>Bold Test of the Printer</center></b><br />" + "This is just a standard line. <u>Underlined</u><br />" + "Signature <img src=\"" + file + "\" alt=\"img001.jpg\"></body>"; webBrowser1.DocumentText = Head + Body; } } } Previous Posts In This Thread: Submitted via EggHeadCafe - Software Developer Portal of Choice Crypto Obfuscator for .NET - Product Review http://www.eggheadcafe.com/tutorials/aspnet/bf15c41b-6510-403e-9af8-f5fd987fafb1/crypto-obfuscator-for-ne.aspx |