Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Raghavendra Mudugal  
#1 Posted : Sunday, April 10, 2005 2:45:00 PM(UTC)
Raghavendra Mudugal

Rank: Member

Groups: Member
Joined: 3/27/2005(UTC)
Posts: 16

Hello :D

Is there any way to get the X pos and Y pos of the image loaded in the web component?

Like we have in for windows ActiveX, if I move the mouse pointer over the image, we
can see the X and Y co-ordinates in the mouse_move event.

And Anyone could please specify the major differences that can be used and can't between
windows component and web component of .NET control.

Thank you, and hope to receive your valuable response as soon ;)
With Regards,
Raghavendra Mudugal
Fedor  
#2 Posted : Sunday, April 10, 2005 6:18:00 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Is there any way to get the X pos and Y pos of the image loaded in the web component?

Like we have in for windows ActiveX, if I move the mouse pointer over the image, we
can see the X and Y co-ordinates in the mouse_move event.


Bitmap Viewer web control has a client-side MouseMove/MouseMove/MouseDown events, but these events are not documented in current version. Nevertheless web controls client-side scripts are not obfuscated, so we can easy check them how it is implemented :)

Here is short code snippet how to implement it:

Code:
<%@ Page language="VB" AutoEventWireup="false" culture="en-us" uiculture="en-us"%>
<%@ Register TagPrefix="aur" Namespace="Aurigma.GraphicsMill.WebControls" Assembly="Aurigma.GraphicsMill.WebControls" %>
<script runat="server" language="VB">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
	If Not Page.IsPostBack Then
		BitmapViewer1.Bitmap.Load("C:\mountain.jpg")
	End If
End Sub
</script>
<html>
	<head>
		<title>Aurigma Graphics Mill Web Controls</title>
		<link href="Style.css" type="text/css" rel="stylesheet">
			<script>
var bitmapViewer1;
		
function initPage(){
	bitmapViewer1 = document.getElementById("<%=BitmapViewer1.ClientID%>");
	bitmapViewer1.addMouseMove(bitmapViewer_MouseMove, window);		
}		

function bitmapViewer_MouseMove(e){
	var p=bitmapViewer1.controlToBitmapPoint(getOffsetPoint(e));
	document.getElementById("Coords").value=p.x+"==="+p.y;
}

//This function was taken from /aspnet_client/GraphicsMill/Controller.js file with a few modifications
function getOffsetPoint(e){		
	var el=bitmapViewer1.__scrollableArea;
	var x=0;var y=0;
	while(el.offsetParent){
		x+=el.offsetLeft;
		y+=el.offsetTop;
		el=el.offsetParent;
	}
	if(window.event){			
		var p=new Point(event.clientX-x+bitmapViewer1.scrollLeft,event.clientY-y+bitmapViewer1.scrollTop);
		if (!__browser.isCSS1Compat){
			var bw=__parseInt(bitmapViewer1.style.borderWidth);
			//TODO: 2 is a some magic constant!
			p.x=p.x-bw-2;
			p.y=p.y-bw-2;
		}			
		return p;
	}
	else{
		var p=new Point(e.pageX-x+bitmapViewer1.scrollLeft,e.pageY-y+bitmapViewer1.scrollTop);
		return p;
	}
}

function ZoomIn(){
	bitmapViewer1.setZoom(bitmapViewer1.getZoom()*1.5);
}

function ZoomOut(){
	bitmapViewer1.setZoom(bitmapViewer1.getZoom()/1.5);
}
		</script>
	</head>
	<body onload="initPage();">
		<form runat="server">
			<aur:BitmapViewer id="BitmapViewer1" runat="server" Width="510" height="400" 
				ScrollBarsStyle="Auto"
				BrowserImageFormat="Png"
				BrowserJpegQuality="30"
				PreviewImageEnabled="True"
			/>					
		</form>
		<input id="Coords" type="text">
		<input type="Button" onclick="ZoomIn();" value="Zoom in">
		<input type="Button" onclick="ZoomOut();" value="Zoom out">		
	</body>
</html>

Edited by user Monday, December 24, 2007 3:56:13 PM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
Fedor  
#3 Posted : Sunday, April 10, 2005 6:37:00 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
And Anyone could please specify the major differences that can be used and can't between
windows component and web component of .NET control.


All limitation of web controls are limitation of HTML and current browsers. For example web controls doesn't support displaying image with alpha channel (due the well-known PNG bug of Internet Explorer), as well as it is very difficult to implement freehand and curves drawing.

As Aurigma Graphics Mill Web Controls is shipped with server-side anf client-side source code, you can easily enhance and extend it.
Best regards,
Fedor Skvortsov
Raghavendra Mudugal  
#4 Posted : Tuesday, April 12, 2005 2:10:00 PM(UTC)
Raghavendra Mudugal

Rank: Member

Groups: Member
Joined: 3/27/2005(UTC)
Posts: 16

:) Hello Fedor Skvortsov

Thanks for the code sample.

when I run the application on the web the co-ordinates were not displayed exactly.
round about 20 pixel were reduced by Y-axis. Here you used in the code is the bitmapviewer
mouse move event. As Andrew guided me to use the ImageMouseMove event for correct
coordinates of the image X and Y. Do I have to change that event in the code or is there any
other way so i have to make some changes in the code.

Please help me on this

Thank You
With Regards,
Raghavendra Mudugal
Users browsing this topic
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.