468,133 Members | 1,206 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

Web Browser Control - controlling the background color...

I am using a web browser control to display some PPT slides saved as HTML. My
client has recently asked that the background of the browser be changed to
sonething other than white so that the slides "standout". I've tried setting
the browser's BackColor setting, but that had no effect at run time. Any
suggestions on how to control the default back color of content displayed in
a web browser control?
Sep 20 '05 #1
9 13115
FYI, Also I've tried changing the back color in the PPT slides before
converting them to HTML - that works for the slide background but the space
around the slide is still white...

"hz****@nopost.com" wrote:
I am using a web browser control to display some PPT slides saved as HTML. My
client has recently asked that the background of the browser be changed to
sonething other than white so that the slides "standout". I've tried setting
the browser's BackColor setting, but that had no effect at run time. Any
suggestions on how to control the default back color of content displayed in
a web browser control?

Sep 20 '05 #2
You could use

AxWebBrowser1.Document.bgColor = "..."

or

AxWebBrowser1.Document.body.style.backgroundColor = "..."

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:3D**********************************@microsof t.com...
I am using a web browser control to display some PPT slides saved as HTML.
My
client has recently asked that the background of the browser be changed to
sonething other than white so that the slides "standout". I've tried
setting
the browser's BackColor setting, but that had no effect at run time. Any
suggestions on how to control the default back color of content displayed
in
a web browser control?

Sep 21 '05 #3
My web browser is part of my GUI... here's how its declared:
Friend WithEvents browser As AxSHDocVw.AxWebBrowser

So, when I tried
Me.browser.Document.bgColor = Color.Red
or
Me.browser.Document.body.style.backgroundColor = Color.Rad

I got a run time error. The only method that looks to be available under the
Document object is GetType.

Any other suggestions?
"Charles Law" wrote:
You could use

AxWebBrowser1.Document.bgColor = "..."

or

AxWebBrowser1.Document.body.style.backgroundColor = "..."

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:3D**********************************@microsof t.com...
I am using a web browser control to display some PPT slides saved as HTML.
My
client has recently asked that the background of the browser be changed to
sonething other than white so that the slides "standout". I've tried
setting
the browser's BackColor setting, but that had no effect at run time. Any
suggestions on how to control the default back color of content displayed
in
a web browser control?


Sep 21 '05 #4
Option Strict On

....

Dim doc As mshtml.IHTMLDocument2

doc = DirectCast(browser, mshtml.IHTMLDocument2)

doc.bgColor = "Red"

or

doc.body.style.backgroundColor = ColorTranslator.ToHtml(CType(Color.Red,
Color))
Note that because these methods use the document attribute, they must be
called when the document has been loaded, either in the DocumentComplete
event or after it has fired.

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:DD**********************************@microsof t.com...
My web browser is part of my GUI... here's how its declared:
Friend WithEvents browser As AxSHDocVw.AxWebBrowser

So, when I tried
Me.browser.Document.bgColor = Color.Red
or
Me.browser.Document.body.style.backgroundColor = Color.Rad

I got a run time error. The only method that looks to be available under
the
Document object is GetType.

Any other suggestions?
"Charles Law" wrote:
You could use

AxWebBrowser1.Document.bgColor = "..."

or

AxWebBrowser1.Document.body.style.backgroundColor = "..."

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:3D**********************************@microsof t.com...
>I am using a web browser control to display some PPT slides saved as
>HTML.
>My
> client has recently asked that the background of the browser be changed
> to
> sonething other than white so that the slides "standout". I've tried
> setting
> the browser's BackColor setting, but that had no effect at run time.
> Any
> suggestions on how to control the default back color of content
> displayed
> in
> a web browser control?


Sep 22 '05 #5
Thanks for the reply, but I get compile error:
When I dimension "doc As mshtml.IHTMLDocument2" I get "...is not defined" -
Is there an Import statement that I am missing?

Thanks for your attention to this matter!
"Charles Law" wrote:
Option Strict On

....

Dim doc As mshtml.IHTMLDocument2

doc = DirectCast(browser, mshtml.IHTMLDocument2)

doc.bgColor = "Red"

or

doc.body.style.backgroundColor = ColorTranslator.ToHtml(CType(Color.Red,
Color))
Note that because these methods use the document attribute, they must be
called when the document has been loaded, either in the DocumentComplete
event or after it has fired.

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:DD**********************************@microsof t.com...
My web browser is part of my GUI... here's how its declared:
Friend WithEvents browser As AxSHDocVw.AxWebBrowser

So, when I tried
Me.browser.Document.bgColor = Color.Red
or
Me.browser.Document.body.style.backgroundColor = Color.Rad

I got a run time error. The only method that looks to be available under
the
Document object is GetType.

Any other suggestions?
"Charles Law" wrote:
You could use

AxWebBrowser1.Document.bgColor = "..."

or

AxWebBrowser1.Document.body.style.backgroundColor = "..."

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:3D**********************************@microsof t.com...
>I am using a web browser control to display some PPT slides saved as
>HTML.
>My
> client has recently asked that the background of the browser be changed
> to
> sonething other than white so that the slides "standout". I've tried
> setting
> the browser's BackColor setting, but that had no effect at run time.
> Any
> suggestions on how to control the default back color of content
> displayed
> in
> a web browser control?


Sep 22 '05 #6
There is an import that you could use, but I do not recommend using it
because it will slow down the intellisense down tremendously.

The fact that you get a compile error suggests that the assembly is not in
your References. Right-click the References section in the solution explorer
and select Add Reference. Then add a reference to Microsoft.mshtml from the
list.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
Thanks for the reply, but I get compile error:
When I dimension "doc As mshtml.IHTMLDocument2" I get "...is not
defined" -
Is there an Import statement that I am missing?

Thanks for your attention to this matter!
"Charles Law" wrote:
Option Strict On

....

Dim doc As mshtml.IHTMLDocument2

doc = DirectCast(browser, mshtml.IHTMLDocument2)

doc.bgColor = "Red"

or

doc.body.style.backgroundColor = ColorTranslator.ToHtml(CType(Color.Red,
Color))
Note that because these methods use the document attribute, they must be
called when the document has been loaded, either in the DocumentComplete
event or after it has fired.

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:DD**********************************@microsof t.com...
> My web browser is part of my GUI... here's how its declared:
> Friend WithEvents browser As AxSHDocVw.AxWebBrowser
>
> So, when I tried
> Me.browser.Document.bgColor = Color.Red
> or
> Me.browser.Document.body.style.backgroundColor = Color.Rad
>
> I got a run time error. The only method that looks to be available
> under
> the
> Document object is GetType.
>
> Any other suggestions?
>
>
> "Charles Law" wrote:
>
>> You could use
>>
>> AxWebBrowser1.Document.bgColor = "..."
>>
>> or
>>
>> AxWebBrowser1.Document.body.style.backgroundColor = "..."
>>
>> HTH
>>
>> Charles
>>
>>
>> "hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote
>> in
>> message news:3D**********************************@microsof t.com...
>> >I am using a web browser control to display some PPT slides saved as
>> >HTML.
>> >My
>> > client has recently asked that the background of the browser be
>> > changed
>> > to
>> > sonething other than white so that the slides "standout". I've
>> > tried
>> > setting
>> > the browser's BackColor setting, but that had no effect at run time.
>> > Any
>> > suggestions on how to control the default back color of content
>> > displayed
>> > in
>> > a web browser control?
>>
>>
>>


Sep 22 '05 #7
Very good, I was missing the Reference...

So, I implemented he code you suggested below in my methods that "...Handles
browser.DocumentComplete"...

Problem is that my results are still the same - when I load up the HTML, the
background outside the converted PPT slide is still white...

Thanks for your help thus far!

"Charles Law" wrote:
There is an import that you could use, but I do not recommend using it
because it will slow down the intellisense down tremendously.

The fact that you get a compile error suggests that the assembly is not in
your References. Right-click the References section in the solution explorer
and select Add Reference. Then add a reference to Microsoft.mshtml from the
list.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
Thanks for the reply, but I get compile error:
When I dimension "doc As mshtml.IHTMLDocument2" I get "...is not
defined" -
Is there an Import statement that I am missing?

Thanks for your attention to this matter!
"Charles Law" wrote:
Option Strict On

....

Dim doc As mshtml.IHTMLDocument2

doc = DirectCast(browser, mshtml.IHTMLDocument2)

doc.bgColor = "Red"

or

doc.body.style.backgroundColor = ColorTranslator.ToHtml(CType(Color.Red,
Color))
Note that because these methods use the document attribute, they must be
called when the document has been loaded, either in the DocumentComplete
event or after it has fired.

HTH

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:DD**********************************@microsof t.com...
> My web browser is part of my GUI... here's how its declared:
> Friend WithEvents browser As AxSHDocVw.AxWebBrowser
>
> So, when I tried
> Me.browser.Document.bgColor = Color.Red
> or
> Me.browser.Document.body.style.backgroundColor = Color.Rad
>
> I got a run time error. The only method that looks to be available
> under
> the
> Document object is GetType.
>
> Any other suggestions?
>
>
> "Charles Law" wrote:
>
>> You could use
>>
>> AxWebBrowser1.Document.bgColor = "..."
>>
>> or
>>
>> AxWebBrowser1.Document.body.style.backgroundColor = "..."
>>
>> HTH
>>
>> Charles
>>
>>
>> "hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote
>> in
>> message news:3D**********************************@microsof t.com...
>> >I am using a web browser control to display some PPT slides saved as
>> >HTML.
>> >My
>> > client has recently asked that the background of the browser be
>> > changed
>> > to
>> > sonething other than white so that the slides "standout". I've
>> > tried
>> > setting
>> > the browser's BackColor setting, but that had no effect at run time.
>> > Any
>> > suggestions on how to control the default back color of content
>> > displayed
>> > in
>> > a web browser control?
>>
>>
>>


Sep 22 '05 #8
Are you certain that the border is not part of the converted slide?

You could also try posting this to
microsoft.public.inetsdk.programming.webbrowser_ct l, where Igor lives.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
Very good, I was missing the Reference...

So, I implemented he code you suggested below in my methods that
"...Handles
browser.DocumentComplete"...

Problem is that my results are still the same - when I load up the HTML,
the
background outside the converted PPT slide is still white...

Thanks for your help thus far!

"Charles Law" wrote:
There is an import that you could use, but I do not recommend using it
because it will slow down the intellisense down tremendously.

The fact that you get a compile error suggests that the assembly is not
in
your References. Right-click the References section in the solution
explorer
and select Add Reference. Then add a reference to Microsoft.mshtml from
the
list.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
> Thanks for the reply, but I get compile error:
> When I dimension "doc As mshtml.IHTMLDocument2" I get "...is not
> defined" -
> Is there an Import statement that I am missing?
>
> Thanks for your attention to this matter!
>
>
> "Charles Law" wrote:
>
>> Option Strict On
>>
>> ....
>>
>> Dim doc As mshtml.IHTMLDocument2
>>
>> doc = DirectCast(browser, mshtml.IHTMLDocument2)
>>
>> doc.bgColor = "Red"
>>
>> or
>>
>> doc.body.style.backgroundColor =
>> ColorTranslator.ToHtml(CType(Color.Red,
>> Color))
>>
>>
>> Note that because these methods use the document attribute, they must
>> be
>> called when the document has been loaded, either in the
>> DocumentComplete
>> event or after it has fired.
>>
>> HTH
>>
>> Charles
>>
>>
>> "hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote
>> in
>> message news:DD**********************************@microsof t.com...
>> > My web browser is part of my GUI... here's how its declared:
>> > Friend WithEvents browser As AxSHDocVw.AxWebBrowser
>> >
>> > So, when I tried
>> > Me.browser.Document.bgColor = Color.Red
>> > or
>> > Me.browser.Document.body.style.backgroundColor = Color.Rad
>> >
>> > I got a run time error. The only method that looks to be available
>> > under
>> > the
>> > Document object is GetType.
>> >
>> > Any other suggestions?
>> >
>> >
>> > "Charles Law" wrote:
>> >
>> >> You could use
>> >>
>> >> AxWebBrowser1.Document.bgColor = "..."
>> >>
>> >> or
>> >>
>> >> AxWebBrowser1.Document.body.style.backgroundColor = "..."
>> >>
>> >> HTH
>> >>
>> >> Charles
>> >>
>> >>
>> >> "hz****@nopost.com" <hz*************@discussions.microsoft.com>
>> >> wrote
>> >> in
>> >> message news:3D**********************************@microsof t.com...
>> >> >I am using a web browser control to display some PPT slides saved
>> >> >as
>> >> >HTML.
>> >> >My
>> >> > client has recently asked that the background of the browser be
>> >> > changed
>> >> > to
>> >> > sonething other than white so that the slides "standout". I've
>> >> > tried
>> >> > setting
>> >> > the browser's BackColor setting, but that had no effect at run
>> >> > time.
>> >> > Any
>> >> > suggestions on how to control the default back color of content
>> >> > displayed
>> >> > in
>> >> > a web browser control?
>> >>
>> >>
>> >>
>>
>>
>>


Sep 22 '05 #9
No I'm not sure - being an HTML novice I'm not sure how to tell either... but
it looks like is now realted to the HTML, so I'll dig in an see is there's a
background colr being controled by the conversion of the PPT to HTML...
thanks for your help.
I'll repost this thread as you suggested.

"Charles Law" wrote:
Are you certain that the border is not part of the converted slide?

You could also try posting this to
microsoft.public.inetsdk.programming.webbrowser_ct l, where Igor lives.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
Very good, I was missing the Reference...

So, I implemented he code you suggested below in my methods that
"...Handles
browser.DocumentComplete"...

Problem is that my results are still the same - when I load up the HTML,
the
background outside the converted PPT slide is still white...

Thanks for your help thus far!

"Charles Law" wrote:
There is an import that you could use, but I do not recommend using it
because it will slow down the intellisense down tremendously.

The fact that you get a compile error suggests that the assembly is not
in
your References. Right-click the References section in the solution
explorer
and select Add Reference. Then add a reference to Microsoft.mshtml from
the
list.

Charles
"hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote in
message news:CF**********************************@microsof t.com...
> Thanks for the reply, but I get compile error:
> When I dimension "doc As mshtml.IHTMLDocument2" I get "...is not
> defined" -
> Is there an Import statement that I am missing?
>
> Thanks for your attention to this matter!
>
>
> "Charles Law" wrote:
>
>> Option Strict On
>>
>> ....
>>
>> Dim doc As mshtml.IHTMLDocument2
>>
>> doc = DirectCast(browser, mshtml.IHTMLDocument2)
>>
>> doc.bgColor = "Red"
>>
>> or
>>
>> doc.body.style.backgroundColor =
>> ColorTranslator.ToHtml(CType(Color.Red,
>> Color))
>>
>>
>> Note that because these methods use the document attribute, they must
>> be
>> called when the document has been loaded, either in the
>> DocumentComplete
>> event or after it has fired.
>>
>> HTH
>>
>> Charles
>>
>>
>> "hz****@nopost.com" <hz*************@discussions.microsoft.com> wrote
>> in
>> message news:DD**********************************@microsof t.com...
>> > My web browser is part of my GUI... here's how its declared:
>> > Friend WithEvents browser As AxSHDocVw.AxWebBrowser
>> >
>> > So, when I tried
>> > Me.browser.Document.bgColor = Color.Red
>> > or
>> > Me.browser.Document.body.style.backgroundColor = Color.Rad
>> >
>> > I got a run time error. The only method that looks to be available
>> > under
>> > the
>> > Document object is GetType.
>> >
>> > Any other suggestions?
>> >
>> >
>> > "Charles Law" wrote:
>> >
>> >> You could use
>> >>
>> >> AxWebBrowser1.Document.bgColor = "..."
>> >>
>> >> or
>> >>
>> >> AxWebBrowser1.Document.body.style.backgroundColor = "..."
>> >>
>> >> HTH
>> >>
>> >> Charles
>> >>
>> >>
>> >> "hz****@nopost.com" <hz*************@discussions.microsoft.com>
>> >> wrote
>> >> in
>> >> message news:3D**********************************@microsof t.com...
>> >> >I am using a web browser control to display some PPT slides saved
>> >> >as
>> >> >HTML.
>> >> >My
>> >> > client has recently asked that the background of the browser be
>> >> > changed
>> >> > to
>> >> > sonething other than white so that the slides "standout". I've
>> >> > tried
>> >> > setting
>> >> > the browser's BackColor setting, but that had no effect at run
>> >> > time.
>> >> > Any
>> >> > suggestions on how to control the default back color of content
>> >> > displayed
>> >> > in
>> >> > a web browser control?
>> >>
>> >>
>> >>
>>
>>
>>


Sep 22 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Al Franz | last post: by
reply views Thread by =?Utf-8?B?UmljaA==?= | last post: by
3 posts views Thread by =?Utf-8?B?R3JlZw==?= | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.