This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
Fedor  
#1 Posted : Thursday, June 23, 2005 8:21:00 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Guest
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Hello everyone,

Here is simple code how to resize BitmapViewer web control on client side:

Code:
<%@ Page Language="vb" AutoEventWireup="false"%>
<%@ Register TagPrefix="aur" Namespace="Aurigma.GraphicsMill.WebControls" Assembly="Aurigma.GraphicsMill.WebControls" %>
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	If Not Page.IsPostBack Then
		BitmapViewer1.Bitmap.Load(Server.MapPath("TestImages/building.jpg"))
	Else
		'Check whether control width and height were changed on client side
		If Request.Form("newWidth")<>"" And Request.Form("newHeight")<>"" Then
			BitmapViewer1.Width=Unit.op_Implicit(Int32.Parse(Request.Form("newWidth")))
			BitmapViewer1.Height=Unit.op_Implicit(Int32.Parse(Request.Form("newHeight")))
		End If
	End If
End Sub
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<LINK href="Style.css" type="text/css" rel="stylesheet">
		<script language="javascript">
function resizeBitmapViewer(){
	var bitmapViewer1=document.getElementById("<%=BitmapViewer1.ClientID%>");
	var newWidth=640;
	var newHeight=480;
	
	//Resize control
	bitmapViewer1.style.width=newWidth+"px";
	bitmapViewer1.style.height=newHeight+"px";
	
	//Refresh control
	bitmapViewer1.delayedRefresh();

	//Save width and height in hidden form fields for syncing on server-side
	document.getElementById("newWidth").value=newWidth;
	document.getElementById("newHeight").value=newHeight;	
}
			</script>
	</HEAD>
	<body>
		<form id="Form1" runat="server">
			<input type="button" value="Resize Bitmap Viewer" onclick="resizeBitmapViewer()">
			
			<input type="hidden" value="" name="newWidth" id="newWidth">
			<input type="hidden" value="" name="newHeight" id="newHeight">
	
			<asp:Button Runat="server" Text="Make Roundtrip"></asp:Button>	
		
			<aur:bitmapviewer id="BitmapViewer1" runat="server" Width="344" height="270"
				BorderWidth="2" BorderStyle="Inset" ScrollBarsStyle="Auto" BackColor="White" Zoom="4"></aur:bitmapviewer>
		</form>
	</body>
</HTML>

Edited by user Sunday, December 23, 2007 6:06:58 PM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.