473,654 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AxWebBrowser body background

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\L OCALS~1\Temp\Sa lesBackGround.j pg'>

i have also tried

<body
background='fil e:///C:\DOCUME~1\use r\LOCALS~1\Temp \SalesBackGroun d.jpg;

' leftmargin='0' marginheight='0 ' marginwidth='0' ");

i have also tried copying the image to the executable's path

<body background='Sal esBackGround.jp g'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


Nov 16 '05 #1
10 2892
Hi Richard,
<body background='Sal esBackGround.jp g'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
Nov 16 '05 #2
Yes i can, once it has been saved as html
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:cj******** *****@news.t-online.com...
Hi Richard,
<body background='Sal esBackGround.jp g'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

Nov 16 '05 #3
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******** ******@tk2msftn gp13.phx.gbl...
Yes i can, once it has been saved as html
"Robert Jordan" <ro*****@gmx.ne t> wrote in message
news:cj******** *****@news.t-online.com...
Hi Richard,
<body background='Sal esBackGround.jp g'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


Nov 16 '05 #4
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
Nov 16 '05 #5

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.ne t> 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

Nov 16 '05 #6
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:blan k" 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
Nov 16 '05 #7
Robert

will the browser show a warning even if it embedded into a Windows Form?

Thanks

"Robert Jordan" <ro*****@gmx.ne t> 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:blan k" 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

Nov 16 '05 #8
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
Nov 16 '05 #9
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.ne t> 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

Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6075
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 "object expected" scripting error when a click event is raised. Can anyone help?
0
1275
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 also work:
0
2011
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 little window on the top left hand corner of the screen. Thinking that this may have something to do with the Print Preview dialog not being able to detect from it's caller's size so that it can set its own size equal to that of the caller, I...
3
2966
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 instance, I'd like to do something like the following: string page = "<HTML><BODY>This is a test.</BODY></HTML>"; And display the page variable's contents in the AxWebBrowser (without
2
1834
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 control is named wbb): object o = System.Reflection.Missing.Value; wbb.Navigate("about:blank", ref o, ref o, ref o, ref o); while (wbb == null) Application.DoEvents(); mshtml.HTMLDocument doc = (mshtml.HTMLDocument)wbb.Document;...
3
2570
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 axwebbrowser.document.body.innerhtml etc etc. thx
3
2871
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
2
3043
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) but with the power point also is showed a vertical scroll bar, and I wish don't show that scroll. May anyone please tell me how I can do that? Thanks in advance, Vicente.
19
3978
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, if the current component set has a resulting small height, this leaves most of the page with the original background color (white). However, if I set the property on the "html" element instead, it does color the entire visible page, beyond the...
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.