How can I access a webpage from a windows form
Use the WebRequest class found in the System.Net namespace. //create the request object WebRequest req = WebRequest.Create(@’http://www.syncfusion.com’); //get the response and use the response WebResponse resp = req.GetResponse(); Stream stream = resp.GetResponseStream(); StreamReader sr = new StreamReader(stream); string s = sr.ReadToEnd(); textBox1.Text = s;
Is it possible to identify the source webpage where I came from?
You can identify the source webpage using the document.referrer command. The document object is the page currently loaded in the browser window – presumably your Web page. The referrer property is the page the visitor was at immediately prior to visiting the current page. You can code it as, functionIdentifySourceWebPage() { if(document.referrer != ’’) document.write(’You came from ’ + document.referrer); }
How to draw a shadow for a given transparent image?
The following method will draw a shadow of the supplied image at the specified location. The general usage pattern is to call this method first to draw a shadow at a (2,2) offset from where the original image will be drawn and then draw the original image itself. public static void DrawShadow(Graphics g, Image iconImage, int left, int top) { ImageAttributes ia = new ImageAttributes(); ColorMatrix cm = new ColorMatrix(); cm.Matrix00 = 0; cm.Matrix11 = 0; cm.Matrix22 = 0; cm.Matrix33 = 0.25f; ia.SetColorMatrix(cm); g.DrawImage(iconImage, new Rectangle(left, top, iconImage.Width, iconImage.Height), 0, 0, iconImage.Width, iconImage.Height, GraphicsUnit.Pixel, ia); }
How can I use the debugger paint and focus problems as the stops are always hit too early
Using dual monitors is one way to tackle this problem, but If you happen to be running on a terminal server machine there’s an even better way to do this. Create a terminal server session to your own machine and start the exe in the terminal server window. Start the debugger on the console window and attach it to the exe in the other session. This is helpful if you’re debugging paint/focus issues because then the debugger won’t steal focus from your app when a breakpoint gets hit. (from [email protected] on microsoft.public.dotnet.framework.windowsforms)
How do I add a tooltip to my Button control
From within the designer: 1) From the ToolBox, drop a ToolTip control to your form. 2) Check the properties of this toolTip1 object to make sure Active is set to true. 3) Click on your button, and in its Property page, set the ToolTip on toolTip1 entry. From code: private System.Windows.Forms.ToolTip toolTip1; …… …… this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1.Active = true; …… …… this.toolTip1.SetToolTip(this.button1, ‘Press for information…’);