Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

Webpage thumbnailer

, 17 Aug 2006
An article on how to get a webpage thumbnail and give your favorite links a face.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace net.grool.util
{   
	public partial class TestForm : Form
	{
		
		public TestForm()
		{
			InitializeComponent();
			
	     }
		PicDoc picDoc = null;
		BrowserForm browserForm=null;
		
		private void btnGo_Click(object sender, EventArgs e)
		{
			if (tbUrl.Text.Equals(string.Empty)) return;
			picDoc = new PicDoc();
			picDoc.refreshPicture += new RefreshPictureDelegate(picDoc_refreshPicture);
			picDoc.Url=tbUrl.Text;
			picDoc.PicSize = (PSize)this.cbPicSize.SelectedItem;
			browserForm.CurDoc = picDoc;
		    browserForm.getImageFromUrl(picDoc.Url);
			

		}
		/// <summary>
		/// Here I paint a border to picture and  display it
		/// </summary>
		/// <param name="im"></param>
		private void picDoc_refreshPicture(Image im) {

			Graphics g = Graphics.FromImage(im);
			g.DrawRectangle(Pens.Blue,new Rectangle(0,0,im.Width-1,im.Height-1));
			this.pPicture.BackgroundImage = im;
		
		
		}
		/// <summary>
		/// Here I populate combo box with PSize objects representing sizes available for thumbnails.
		/// Invisible BrowserForm is created  here as well.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void TestForm_Load(object sender, EventArgs e)
		{
			cbPicSize.Items.Add(new PSize(200, 200));
			cbPicSize.Items.Add(new PSize(300,300));
			cbPicSize.SelectedIndex = 0;
			browserForm = new BrowserForm();

		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

dooskoobi
Web Developer
Belgium Belgium
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 17 Aug 2006
Article Copyright 2006 by dooskoobi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid