Can anyone help me
I am developing an application runs on a PC (client) only. For graphical
reasons it was decided that the content would be displayed in a Browser that
is embedded in a Windows Forms application (VS net 2003) c#
I have a Windows Form that uses a webbrowser (AxWebBrowser) )to display
html derived from internal classes that builds data from a database. The
HTML displays correctly. The HTML is built at runtime and the images are
stored locally on the c: drive
The issue i am having is displaying a background JPG using a body background
tag.
for example
<body background='C:\DOCUME~1\user\LOCALS~1\Temp\SalesBa ckGround.jpg'>
i have also tried
<body
background='file:///C:\DOCUME~1\user\LOCALS~1\Temp\SalesBackGround.jpg ;
' leftmargin='0' marginheight='0' marginwidth='0'");
i have also tried copying the image to the executable's path
<body background='SalesBackGround.jpg'leftmargin='0' marginheight='0'
marginwidth='0'
Eveything after this statement displays corectly but the body background
if i copy the HTML after runtime to a new file (say in frontpage) and
preview the html it works perfectly
Can anybody help me
Thank You
Richard 10 2869
Hi Richard, <body background='SalesBackGround.jpg'leftmargin='0' marginheight='0' marginwidth='0'
Eveything after this statement displays corectly but the body background
if i copy the HTML after runtime to a new file (say in frontpage) and preview the html it works perfectly
Can you preview that HTML file with IE?
bye
Rob
Yes i can, once it has been saved as html
"Robert Jordan" <ro*****@gmx.net> wrote in message
news:cj*************@news.t-online.com... Hi Richard,
<body background='SalesBackGround.jpg'leftmargin='0' marginheight='0' marginwidth='0'
Eveything after this statement displays corectly but the body background
if i copy the HTML after runtime to a new file (say in frontpage) and preview the html it works perfectly
Can you preview that HTML file with IE?
bye Rob
I have also gone through the DOM and accessed the body.background, this is
blank at runtime
I have managed to trick the WebBrowser to load the background by navigating
to
a html file that has the background image, then i load the dynamic html into
the DOM's innerHTML
my original plan though, was to have all my images as a embeded resource and
load the background
depending on the method at runtime ans simply load the HTML into the DOM's
innerHTML , i wanted to avoid navigating to a html file
as this loads the scrollbars and my application does not call for scroll
bars
Is this a bug or am i missing something
"Richard Steele" <ri************@megwich.com> wrote in message
news:OA**************@tk2msftngp13.phx.gbl... Yes i can, once it has been saved as html
"Robert Jordan" <ro*****@gmx.net> wrote in message news:cj*************@news.t-online.com... Hi Richard,
<body background='SalesBackGround.jpg'leftmargin='0' marginheight='0' marginwidth='0'
Eveything after this statement displays corectly but the body background
if i copy the HTML after runtime to a new file (say in frontpage) and preview the html it works perfectly
Can you preview that HTML file with IE?
bye Rob
Hi Richard, I have also gone through the DOM and accessed the body.background, this is blank at runtime
I have managed to trick the WebBrowser to load the background by navigating to
a html file that has the background image, then i load the dynamic html into the DOM's innerHTML
This is not recommended. If you set the document like this,
the browser will put it in some strange security zone.
At least not in the local machine zone.
You should load the HTML from file beacuse it's the less cumbersome
solution.
You can embedd the HTML file as a .NET resource and
extract it at runtime into user's temp folder, for example. my original plan though, was to have all my images as a embeded resource and load the background
So how do you want to load those images into the browser?
Using the res:-protocol? This doesn't work with .NET-resources.
It requires Win32-resources which you cannot embed using
Visual Studio.
depending on the method at runtime ans simply load the HTML into the DOM's innerHTML , i wanted to avoid navigating to a html file
as this loads the scrollbars and my application does not call for scroll bars
I don't understand what you mean with "does not call for scroll bars".
Do you want to prevent the scrollbars from apearing?
Use [body scroll="no"].
bye
Rob
Robert
thanks for your help
so far i have managed to work out that the browser must have a preloaded
html file as i suppose it must initliaise itself
(sorry i am fairly new to c#, so i dont know the technical term)
The scroll bar question is mute, i have turned them of using the example you
gave me
once the browser has a preloaded file, i am free to change the backgound
image at will, this now works
are you suggesting that i never write the html directly to the innerHTML? or
should i create a HTML file on the fly
and navigate to that instead
Thanks
Richard
"Robert Jordan" <ro*****@gmx.net> wrote in message
news:cj*************@news.t-online.com... Hi Richard,
I have also gone through the DOM and accessed the body.background, this is blank at runtime
I have managed to trick the WebBrowser to load the background by navigating to
a html file that has the background image, then i load the dynamic html into the DOM's innerHTML
This is not recommended. If you set the document like this, the browser will put it in some strange security zone. At least not in the local machine zone.
You should load the HTML from file beacuse it's the less cumbersome solution.
You can embedd the HTML file as a .NET resource and extract it at runtime into user's temp folder, for example.
my original plan though, was to have all my images as a embeded resource and load the background
So how do you want to load those images into the browser? Using the res:-protocol? This doesn't work with .NET-resources. It requires Win32-resources which you cannot embed using Visual Studio.
depending on the method at runtime ans simply load the HTML into the DOM's innerHTML , i wanted to avoid navigating to a html file
as this loads the scrollbars and my application does not call for scroll bars
I don't understand what you mean with "does not call for scroll bars". Do you want to prevent the scrollbars from apearing? Use [body scroll="no"].
bye Rob
Hi Richard Steele wrote: are you suggesting that i never write the html directly to the innerHTML? or should i create a HTML file on the fly
and navigate to that instead
The 2nd is recommended way. After you've loaded that local file
you can write directly to body.innerHTML.
BTW, you may wonder why this is required: if you don't
load a local file, the browser assumes the document
is in a special zone, the same zone as "about :blank" or so.
If you mix content from several zones (for example you
have some IFRAME, FRAME oder OBJECT tags) IE will show
a security warning or even worse: it will simply ignore the tags.
So just stick with that local file, even if it's not elegant.
bye
Rob
Robert
will the browser show a warning even if it embedded into a Windows Form?
Thanks
"Robert Jordan" <ro*****@gmx.net> wrote in message
news:cj*************@news.t-online.com... Hi Richard Steele wrote:
are you suggesting that i never write the html directly to the innerHTML? or should i create a HTML file on the fly
and navigate to that instead
The 2nd is recommended way. After you've loaded that local file you can write directly to body.innerHTML.
BTW, you may wonder why this is required: if you don't load a local file, the browser assumes the document is in a special zone, the same zone as "about:blank" or so. If you mix content from several zones (for example you have some IFRAME, FRAME oder OBJECT tags) IE will show a security warning or even worse: it will simply ignore the tags.
So just stick with that local file, even if it's not elegant.
bye Rob
Hi Richard, Robert
will the browser show a warning even if it embedded into a Windows Form?
Yes. It depends on the user security setting. Very nasty.
bye
Rob
Thanks Robert, u have been very helpful
i have created a html file with a nice error graphic, that will
be my initial page to navigate to
if anything fails then the user will see a nice graphic (error.htm)
BTW, i have managed to extract the images from my resource file
the issue i was also having was that the original image is a JPEG, when
the image was extracted it tripled in size (i presume it is a BMP)
i managed to find an example of code to convert it back
to a jpg, this now works and the background image gets replaced as per the
spec
do you happen to know if VS2005 will have a webbrowser control (managed
code)
Richard
"Robert Jordan" <ro*****@gmx.net> wrote in message
news:cj*************@news.t-online.com... Hi Richard,
Robert
will the browser show a warning even if it embedded into a Windows Form?
Yes. It depends on the user security setting. Very nasty.
bye Rob
Hi Richard, do you happen to know if VS2005 will have a webbrowser control (managed code)
It has, indeed. However, it will have the same flaw: http://msdn2.microsoft.com/library/8bbc4s4h.aspx
When you set the DocumentText property, the WebBrowser
loads about :blank ;-)
bye
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chris Soulsby |
last post by:
Hi,
I'm displaying a html page in the AxWebBrowser web control. The html
contains some JavaScript. When I run this in IE it all works fine,
however, when I run it in AxWebBrowser I get a...
|
by: Pocholo |
last post by:
I'm working with AxWebBrowser and i try to change the entire page, but i
don't find any way to do it
also i try to change by parts:
First the body:
htmlDoc1.body.innerHTML="....";
and this...
|
by: John |
last post by:
I have a class that creates an AxWebBrowser object in the
background, loads some arbitrary html content, then shows
the user a print preview. The only problem is, this print
preview is a tiny...
|
by: Michael C |
last post by:
Hi all,
Quick question about the AxSHDocVw.AxWebBrowser Component. I was wondering
if there is a way to view pages generated internally within my application
without writing them to disk. For...
|
by: Dan |
last post by:
I'd like to display some HTML code in a form using the axwebbrowser control,
without having to create a temporary file to navigate to. I'm trying the
following code (let's say that the web browser...
|
by: MeNotHome |
last post by:
I have been trying to find all the properties and methods
documentation on the axwebbrowser control.
For example a list of follwing and their results
axwebbrowser.document.body.outerhtml...
|
by: Ajai Kumar .R |
last post by:
Hai all,
I'm getting javascript errors/alert windows on AxWebBrowser. Does any body
know how to disable these popups.
Thanks in advance.
Ajai Kumar .R
|
by: Vicente García |
last post by:
hello all,
Sorry for my English. I am making up an application and I must show a web. The web contains a power point but I have a problem because I type something like:
AxWebBrowser.Navigate(URL)
...
|
by: david.karr |
last post by:
If in my CSS I set the "background-color" property on the "body"
element, it only covers the background of the elements defined in the
body, up to the current width and height of the page. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |