|
It is all in MSDN - look up the WebBrowser control (obviously).
The event is called "Navigating" as far as I can see.
It will fire for each click on a link. In the event handler do the following:
1) Cancel the navigation (a property or method on the event args)
2) Look at the target URL (it is in the event args) to find out which page the user requested
3) Fetch the HTML for that page from your DB
4) Set the HTML of the WebBrowser control to the new content
Notice that you will probably (can't remember it for sure) get an initial "Navigating" event fired when you initialize the WebBrowser control. Make sure you leave this alone (do not cancel it). Use the debugger to see if you get something like this, and how the URL looks so you can avoid canceling.
Obviously this is for .NET 2.0 - I can't remember how to do this (or if it is possible at all) with the horrible COM generated wrapper for the web browser in 1.1.
|
|
|
|
|
thanks in advance
but im working on VS2003.
could u help me for another problem??
i use follow functions for loadind my html pages,there are some pictures in my source code of html page , that have relative src ,
when the browser navigate , the pictures didn't show!!!
what can i do??
private void Form2_Load(object sender, System.EventArgs e)
{
object empty = System.Reflection.Missing.Value;
axWebBrowser1.Navigate("about:blank", ref empty, ref empty, ref empty, ref empty);
}
public void html_load(string context,string title)
{
string SourceCode="";
SourceCode="" + context+ "";
// create an IHTMLDocument2
mshtml.IHTMLDocument2 doc = axWebBrowser1.Document as mshtml.IHTMLDocument2;
// write to the doc
doc.clear();
doc.writeln(SourceCode);
doc.close();
}
|
|
|
|
|
I think the same event is available in the COM wrapper used in the old versions of .NET, but then you are on your own. Read the documentation.
For the images you might want to write the HTML and images to disk (temp directory or something) and load from there - then the relative path match.
|
|
|
|
|
Dear All,
Please send me the MCP QUESTION FOR C#
I m very interested to write a MCP exam for C#.
With GreatRegards,
Shiv
|
|
|
|
|
|
Shiv5 wrote: Please send me the MCP QUESTION FOR C#
Learn the damn stuff yourself - I worked hard for my certification and I will not have it devalued by a bunch of lazy idiots that don't want to spend the time learning the required course material.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Dude I recomand you to learn books by urself cuz it;s the best way to understand programming........
|
|
|
|
|
Hi guys,
I am currently writing a small app that contains an editable ListView based on the one detailed here:
http://www.c-sharpcorner.com/Code/2002/July/EditableListView.asp
I noticed a small bug in the code in case your interested, to correctly work out the column to edit from the x,y values of your mouse the code totals up the column widths to find an x value that matches entry of the bounds for the editable box your mouse clicked in. However, the first column width is already checked before it continues, when it continues it adds the first column width again before checking and therefore messes up if you have different column widths, so the line:
epos += this.Columns[i].Width;
simply needs changed to:
epos += this.Columns[i+1].Width;
Anyway, I have a small problem that has been bugging me for hours now and hope you can help. If the said ListView or any form control for that matter is larger than the size of the form, a scrollbar appears. Therefore when the user clicks on the screen you recieve the x,y coordinates from the top left of the form or part of the control that is visable (not sure myself) so.. is there a way to get the scrollbar offset so you can correctly determine the x,y coordinates even though a portion of the control is not visible?
Any help would be great and thanks for your time
Darren
|
|
|
|
|
Dear All,
How do i read and Execute a bunch of .Sql at the same time using C#
Send me sample code for that
GreatRegards,
Sivakumar Lakshmanan.
|
|
|
|
|
I am not sure what exactly you are trying to do with the .Sql but may I suggest that you look at the Database Application Block from Microsoft. The Application Block abstracts much of the database work into a series of static methods that are very useful.
Not withstanding the application block I would suggest that you explore the Data namespace and use the SqlCommand object. You will have to set the commandtext then execute the command. As a side note I would strongly suggest that you use stored procedures if you have a "bunch" of scripts to run.
Hope it helps
|
|
|
|
|
Hi All!
Could some one help me how to add a control on menu bar?
It looks like Microsoft Word, it has a combo box in top right corner.
Thanks
|
|
|
|
|
if you are using Visual Studio 2005 then you can simply insert a menustrip which allows you to include a combo box on the menustrip itself.
|
|
|
|
|
I'm working on a bible project. Part of it is to display bible verses on screen. Given that the bible text are in different formats (some are italics, some are in red, ...).
I tried using labels to display them. But if one chapter has 80 verses, I would have to create at least 80 labels. This is very slow - could take 15-20 seconds to display.
Apart from using labels, is there any other efficient way to handle text display?
Thanks!!
|
|
|
|
|
Graphics.DrawString()
Here is something to get you started:
class CustomDrawControl : Control
{
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawString("blah blah", Font, Brushes.Red, e.ClipRectangle);
}
}
|
|
|
|
|
Thanks! Since I'm new to C#, can you be more specific?
Do I use graphics instead for each text in those labels I created?
|
|
|
|
|
I have taken a look at it. But how can the drawstring be changed?
How is the "tabPage1.paint += new System.Windows.Forms.PaintEventHandler(tabPage1_paint)" triggered?
-- modified at 3:58 Tuesday 30th May, 2006
|
|
|
|
|
You could use the RichTextBox[^] control. It supports formatting.
|
|
|
|
|
But would RichTextBox control be as slow as label control?
Someone suggested using paint control. Do you know how to do that?
|
|
|
|
|
The rtb should be much faster than dynamically creating a mess of labels.
Paint isn't a control, it's an event for your form. It's more flexible, but if you're a beginner the price in increased effort needed to use is probably not worth it.
|
|
|
|
|
I managed to displayed text by using graphic object.
g = tabPage1.CreateGraphics();
g.DrawString(text, fnt, brsh, x, y);
g.Dispose();
I used labels before and the tabPage was scrollable (tabPage.AutoScroll = true). But now it is not scrollable any more and thus those text at the bottom are missing from the tabPage. Do you know why?
-- modified at 11:48 Tuesday 30th May, 2006
|
|
|
|
|
how to use atan2()? please help and show some example of it...thanks alot
|
|
|
|
|
Why do you want to use a function, that you dont know what it does?
|
|
|
|
|
char s[7];
long x,y,z;
float rad2;
sprintf(string,"%c", buffer1[0]);
x=atol(string);
printf(lcd_putc,"X=%ld", x);
sprintf(string,"%c", buffer1[9]);
y=atol(string);
printf(lcd_putc,"Y=%ld", y);
rad2 = atan2(x,y);
printf(lcd_putc,"%3.2f", rad2);
This is my program. I wanted to use the arc tangent formula to calculate the degree. I would really appreciate if anyone can tell me what's wrong with my program and what can i do to solve it. Thankx..
|
|
|
|
|
|
Then where should i post this?
|
|
|
|