473,732 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove scrollbars from Browser Control

Hello,
I am trying to remove the scrollbars from any page I load up into the
browser control on a window form. I first tried the following:

browserDoc = (mshtml.HTMLDoc ument)browser.D ocument;
browserBody = (mshtml.HTMLBod y)browserDoc.bo dy;
browserBody.scr oll = "no";

This worked for most pages but not all. When I navigated to the following
web site:

http://www.levaquinspeakers.com

It still showed the vertical scroll bar although it was disabled since no
scrolling was needed. On sites like http://www.microsoft.com it worked
perfectly. So I did a little research and found people saying that I should
use SetWindowLong API passing it the compliment of WS_VSCROLL and WS_HSCROLL
to turn off the scrollbars. Here is the code I used:

private const int CONST_GWL_STYLE = -16;
private const int CONST_WS_VSCROL L = 0x00200000;
private const int CONST_WS_HSCROL L = 0x00100000;
private const int CONST_SWP_NOSIZ E = 0x0001;
private const int CONST_SWP_NOMOV E = 0x0002;
private const int CONST_SWP_NOZOR DER = 0x0004;
private const int CONST_SWP_FRAME CHANGED = 0x0020;
private const int CONST_SET_WINDO W_POS_FLAGS = CONST_SWP_NOMOV E |
CONST_SWP_NOSIZ E | CONST_SWP_NOZOR DER | CONST_SWP_FRAME CHANGED;

//API Calls.
[ DllImport( "user32.dll ", EntryPoint = "GetClientR ect" ) ]
private static extern int GetClientRect (IntPtr hWnd, ref Rectangle lpRect);
[ DllImport( "user32.dll ", EntryPoint = "GetWindowL ong" ) ]
private static extern IntPtr GetWindowLongPt r (IntPtr hWnd, int nIndex);
[ DllImport( "user32.dll ", EntryPoint = "SetWindowL ong" ) ]
private static extern IntPtr SetWindowLongPt r (IntPtr hWnd, int nIndex,
IntPtr dwNewLong);
[ DllImport( "user32.dll ", EntryPoint = "SetWindowP os" ) ]
private static extern int SetWindowPos (IntPtr hWnd, IntPtr hWndInsertAfter ,
int X, int Y, int cx, int cy, uint uFlags);

IntPtr windowStyle;
int returnValue;

windowStyle = GetWindowLongPt r(browser.Handl e, CONST_GWL_STYLE );
windowStyle = new IntPtr(windowSt yle.ToInt32() & ~CONST_WS_VSCRO LL &
~CONST_WS_HSCRO LL);
windowStyle = SetWindowLongPt r(browser.Handl e, CONST_GWL_STYLE ,
windowStyle);
returnValue = SetWindowPos(br owser.Handle, new IntPtr(0), 0, 0, 0, 0,
CONST_SET_WINDO W_POS_FLAGS);

I tried with and without the SetWindowPos call at the end. When I step
through the code I get a proper windowStyle back but it seems the window
already has the WS_VSCROLL and WS_HSCROLL because doing an AND with there
compliments does not change the style at all.

Is there anyway I can get the browser control to reliably remove the
scrollbars? If not is it possible to determine when either the vertical or
horizontal are displayed along with there widths? Thank you for any help you
can provide!!!
Thanks,
Ken
Nov 17 '05 #1
0 3543

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

Similar topics

24
4723
by: Nobody | last post by:
Okay, you are all so smart in here. Answer me this: IE6 in standards mode doesn't seem to hide scrollbars on the body element (overflow:hide) Ain't this a quandary. I have it in my head that I need to specify html instead. The scrollbars do hide on Gecko browsers though, so there is definitely a disagreement among browser developers on how to implement scrollbars (as a side note, Gecko browsers with their notoriously bug-ridden...
14
2293
by: Jorg Matter | last post by:
Hello I should like to define the colors of the scrollbars for divs with overflows set to auto. I have a design with black background and white text. Now the scrollbars do not look very nice and I should like to have them some sort of dark grey or so. Where and how do I define these colors? Jörg
7
26048
by: Sujan | last post by:
Hello all, Is it possible to remove scrollbar(s) without using frames. Is there any code which could be applied in body tag to remove scrollbar(s). Thanks in adv, Sujan
5
4969
by: jvb | last post by:
I hope this is the correct place to ask this question. If not, would some kind person tell me where I should? In IE, one can use the javascript code, "document.body.scroll='yes/no'" to dynamically control the visibility of a window's scrollbars. Is there an equivalent for W3C browsers (in my case firefox 1.0.6) that does not require messing with browser security? Thanks in advance, Jeff ----
0
1535
by: Kenneth H. Brannigan | last post by:
Hello, I am trying to remove the scrollbars from any page I load up into the browser control on a window form. I first tried the following: browserDoc = (mshtml.HTMLDocument)browser.Document; browserBody = (mshtml.HTMLBody)browserDoc.body; browserBody.scroll = "no"; This worked for most pages but not all. When I navigated to the following web site:
0
1901
by: Kenneth H. Brannigan | last post by:
Even though I can see that the scroll bars are visible a call to GetScrollBarinfo says they are not visible: private const uint CONST_OBJID_VSCROLL = 0xFFFFFFFB; private const uint CONST_OBJID_HSCROLL = 0xFFFFFFFA; //API Structires. public struct SCROLLBARINFO {
17
2090
by: Dino M. Buljubasic | last post by:
I have a treeview and a checked list view controls one beside another. I want to make them work so that when I scroll down or up one of them the other does the same. Any help will be appreciated -- Dino Buljubasic Software Developer http://rivusglobal.com
2
3805
by: Ernst Elzas | last post by:
Hello, If these questions have been asked numerous times before, please excuse me, I have not managed to find the information I needed. I'm making a webpage (for now it will only be in two languages, English and Hebrew), and noticed a few issues with scrollbars: I divided the page in divs, with drop-down menus appearing in the top-div: (quoting the relevant lines from the css file) html,body {background-color: #000008; color:red;...
1
1577
by: prashweenet | last post by:
Hi I cannot remove the scrollbars in my application using scrollbars=no My browser is IE 6.0.2900 sp2 help much appricated Code snippet is below var sreturnval = window.showModalDialog( ClassChangeFrame.page?ObjectKey=FromOvw&Object_revision=ObjRev,dialogWidth:400px;dialogHeight:210px;help=no;scrollbars=no;status=no; /PRASH
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
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
9307
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
9181
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
8186
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
6735
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
4550
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...
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.