I am designing a custom web part that basically wraps the existing PageViewerWebPart. I am doing this because I want to have some properties hard-coded and I want the URL to be formed dynamically when the site page loads.
However, I am having problems getting scroll bars to disappear whenever I start resizing the page viewer control in my code. Here is what I have currently written:
[ToolboxItemAttribute(false)]
public class VisualWebPart1 : System.Web.UI.WebControls.WebParts.WebPart
{
protected override void CreateChildControls()
{
// Create a page viewer with the attributes that we want.
PageViewerWebPart customPageViewer = new PageViewerWebPart();
customPageViewer.ContentLink = "http://www.google.com";
customPageViewer.Height = "8.5in"; // scrollbars appear whenever a value is set here
customPageViewer.Width = "11in"; // same if a value is set here
customPageViewer.SuppressWebPartChrome = true;
customPageViewer.ScrollBars = ScrollBars.None;
//customPageViewer.Wrap = true;
// Manipulate our custom web part.
this.Height = new Unit(8.5, UnitType.Inch);
this.Width = new Unit(11, UnitType.Inch);
this.ChromeType = PartChromeType.None;
this.ScrollBars = ScrollBars.None;
// Add the page viewer to our web part.
this.Controls.Add(customPageViewer);
}
}
Now, if I don't set height or width for either the page viewer or for "this", the Google website appears without scrollbars, and it appears that the width defaults to the width of the browser and the height defaults to about 200 pixels (so the bottom of the page gets cut off).
If I set the height and width of "this" (the web part itself), I am able to stretch out the width and height of my custom control. However, the page viewer itself remains the same, as expected, too small.
But, if I set the height or width of my page viewer, the scroll bars always appear =(
And they always seem to have just a tiny amount of space for scrolling (maybe 15 pixels wide or vertically). I've tried seemingly endless combinations of heights and widths for both the page viewer and the custom web part, and I cannot get the scrollbars to disappear. I do have ScrollBars set to None for both properties. I've tried this for various website URLs and also my web app URL, and all the results are the same. The scroll bars appear and they have about 15 pixels of scrollability each.
I need the actual screen of the website to take up 8.5 inches by 11 inches and the custom web part needs to be the same size or just bigger to fit the page viewer; in the end the whole thing is 8.5 x 11 inches. Even if I make both the page viewer and the custom web part 2000 pixels wide or high, scrollbars still want to appear with a small amount to scroll in the bar.
Anyone know how I resolve this? Thanks!