Bonjour, j'ai recupérer le code de cet page:http://www.developerfusion.co.uk/show/4712/
ca me sert à faire une copie image de la page web chargée dans un composant webbrowser, seulement lorsque je veux generer la solution (sous vs net2003),j'ai cette erreur:C:\Documents and Settings\[...](171): Le type ou le nom d'espace de noms 'GDI32' est introuvable (une directive using ou une référence d'assembly est-elle manquante*?),
et voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices; 
using SHDocVw; 
using mshtml; 
 
namespace tmwebb
{	
	[Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"),
	InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
	ComVisible(true),
	ComImport]
	interface IHTMLElementRender
			{
				void DrawToDC([In] IntPtr hDC);
				void SetDocumentPrinter([In, MarshalAs(UnmanagedType.BStr)] string bstrPrinterName, [In] IntPtr hDC);
			};
 
	/// <summary>
	/// Description résumée de Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		public AxSHDocVw.AxWebBrowser axWebBrowser1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.PictureBox pictureBox1;
		/// <summary>
		/// Variable nécessaire au concepteur.
		/// </summary>
		private System.ComponentModel.Container components = null;
 
		public Form1()
		{
			//
			// Requis pour la prise en charge du Concepteur Windows Forms
			//
			InitializeComponent();
 
			//
			// TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
			//
		}
 
		/// <summary>
		/// Nettoyage des ressources utilisées.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
 
		#region Code généré par le Concepteur Windows Form
		/// <summary>
		/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
		/// le contenu de cette méthode avec l'éditeur de code.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
			this.button1 = new System.Windows.Forms.Button();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
			this.SuspendLayout();
			// 
			// axWebBrowser1
			// 
			this.axWebBrowser1.Enabled = true;
			this.axWebBrowser1.Location = new System.Drawing.Point(8, 24);
			this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
			this.axWebBrowser1.Size = new System.Drawing.Size(312, 416);
			this.axWebBrowser1.TabIndex = 0;
			this.axWebBrowser1.Enter += new System.EventHandler(this.axWebBrowser1_Enter);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(8, 0);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(80, 24);
			this.button1.TabIndex = 1;
			this.button1.Text = "button1";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(96, 0);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(536, 20);
			this.textBox1.TabIndex = 2;
			this.textBox1.Text = "textBox1";
			// 
			// pictureBox1
			// 
			this.pictureBox1.Location = new System.Drawing.Point(336, 32);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(312, 408);
			this.pictureBox1.TabIndex = 3;
			this.pictureBox1.TabStop = false;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(656, 454);
			this.Controls.Add(this.pictureBox1);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.axWebBrowser1);
			this.Name = "Form1";
			this.Text = "Form1";
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
			this.ResumeLayout(false);
 
		}
		#endregion
 
 
		/// <summary>
		/// Point d'entrée principal de l'application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}
		private void OnDocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
		{
			IHTMLDocument2 document = (IHTMLDocument2) this.axWebBrowser1.Document;
			if (document != null)
			{
				IHTMLElement element = (IHTMLElement) document.body;
				if (element != null)
				{
					IHTMLElementRender render = (IHTMLElementRender) element;
					if (render != null)
					{
						using (Graphics graphics = this.pictureBox1.CreateGraphics())
						{
							IntPtr hdcDestination = graphics.GetHdc();
							render.DrawToDC(hdcDestination);
							IntPtr hdcMemory = GDI32.CreateCompatibleDC(hdcDestination);
							IntPtr bitmap = GDI32.CreateCompatibleBitmap(
								hdcDestination,  
								this.axWebBrowser1.ClientRectangle.Width, this.axWebBrowser1.ClientRectangle.Height
								);
 
							if (bitmap != IntPtr.Zero)
							{
								IntPtr hOld = (IntPtr) GDI32.SelectObject(hdcMemory, bitmap);
								GDI32.BitBlt(
									hdcMemory,
									0, 0,
									this.axWebBrowser1.ClientRectangle.Width, this.axWebBrowser1.ClientRectangle.Height,
									hdcDestination,
									0, 0,
									(int) GDI32.TernaryRasterOperations.SRCCOPY
									);
								GDI32.SelectObject(hdcMemory, hOld);
								GDI32.DeleteDC(hdcMemory);
								graphics.ReleaseHdc(hdcDestination);
 
								this.pictureBox1.Image = Image.FromHbitmap(bitmap);
							}
						}
					}
				}
			}
		}
 
		private void axWebBrowser1_Enter(object sender, System.EventArgs e)
		{
 
		}
 
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
 
		}
 
		private void button1_Click(object sender, System.EventArgs e)
		{
			System.Object nullObject = 0;
			string str = "";
			System.Object nullObjStr = str;
			Cursor.Current = Cursors.WaitCursor;
			axWebBrowser1.Navigate(textBox1.Text, ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
			Cursor.Current = Cursors.Default;
 
 
		}
	}
}
je suppose que je dois referencer gdi32.dll ? J'ai essayé de voir sur google et je suis tombé sur des trucs que je pige pas comme d'hab ... J'espere que dans mon explication je n'oublie rien, voilà merci