Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

activex control not resizing to fit window

Status
Not open for further replies.

uncle05

MIS
Mar 15, 2006
12
US
Hello,
I have a sysmon, same as perfmon, activex control inside an ASP page. When I resize the window, the activex control does not automatically rezise itself to fit the window. I tried to set the style width and height on the object to 100%, but that didn't work. Does anyone know how this can be accomplished?
 
1) what is a sysmon and what does it have to do with javascript?
2) what is a perfmon and what does it have to do with javascript?
3) can you show some code or a link to your page, or at least be a bit more descriptive of your problem?

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
If you are running Windows, you can type in "perfmon" at the command prompt to see what it is. It's a microsoft activex control. This control can be dragged and dropped into any html or asp web page from the Toolbox in Visual Studio 2003. I'm trying to figure out a way to make the control resize automatically when the window is resized. If this is not the right forum for this type of question, would you be able to point me to a better site? Here is the pbject tag for this control.

<OBJECT id="PerfMonitor" style="WIDTH: 770px; HEIGHT: 520px; FONT-SIZE: 8pt; FONT-FAMILY: Tahoma" classid="clsid:C4D2D8E0-D1DD-11CE-940F-008029004347" VIEWASTEXT >
 
Since in the object declaration you are declaring a specific width of 770px and height of 520px the object will not resize. However, even if you remove those tags I do not know that the object will resize irregardless. Most HTML elements will only take up the amount of space they need. You might want to try posting this in the HTML/CSS forum, but I don't know that you'll get a lot of luck there either unfortunately.

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
This works fine for me:

Code:
<html>
<head>
	<style type="text/css">
		html, body {
			padding: 0px;
			margin: 0px;
		}
	</style>

	<script type="text/javascript">
	<!--

		onload = attachResizeEvent;

		function attachResizeEvent() {
			onresize = resizePerfMon;
			var perfMon = document.getElementById('perfMon');
			perfMon.style.height = document.getElementsByTagName('body')[0].clientHeight + 'px';
		}

		function resizePerfMon() {
			var perfMon = document.getElementById('perfMon');
			perfMon.style.height = document.getElementsByTagName('body')[0].clientHeight + 'px';
		}

	//-->
	</script>
</head>

<body>
	<object id="perfMon" style="font-size:8pt; width:100%; height:100; font-family:Tahoma" classid="clsid:C4D2D8E0-D1DD-11CE-940F-008029004347" viewastext />
</body>
</html>

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I'm sorry, I should've explained my problem better. I'm trying make the activex control automatically resize itself every time window is resized using the mouse. Currently, the activex control stays the same size even when the window is resized.
 
I'll try attaching this code to the window resize event and let you know if that works. Thanks.
 
Your code sample worked like a charm. Thanks Dan!
 
I don't understand the confusion - the code I gave [!]did[/!] harness the onresize event, and [!]did[/!] resize the control when the window was resized with the mouse.

Ah well - good to see you got it in the end.

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top