Apr 21, 2009

how to convert decimal degrees to miles + Javascript

To convert the decimal degrees to miles :

function distanceConverter(x1,y1,x2,y2)

// distance between 2 points from decimal degrees to miles
// where x values represent longitude
// where y values represent latitiude
dx = 69.172 * (x2 - x1) * Math.cos( y1 / 57.3);
dy = 69.172 * (y2 - y1);
var dist = Math.sqrt(dx * dx + dy * dy);
return dist;

Apr 14, 2009

how to display map co-ordinates for the mouse position + Mapextreme

          1. Add this line to public MapForm1():
mapControl1.MouseMove += new MouseEventHandler(MapControl1_MouseMove);
          2. Add this function to the project:
public void MapControl1_MouseMove(object sender, MouseEventArgs e)
System.Drawing.PointF DisplayPoint = new PointF(e.X,e.Y);
MapInfo.Geometry.DPoint MapPoint = new MapInfo.Geometry.DPoint();

MapInfo.Geometry.DisplayTransform converter = this.mapControl1.Map.DisplayTransform;
converter.FromDisplay(DisplayPoint, out MapPoint);

this.statusBar1.Text = "Cursor Location: " + MapPoint.x.ToString() + ", " + MapPoint.y.ToString();

This will display the current coordinates of the mouse position.

useful links for custom selection tools:

Apr 13, 2009

How to set the position of the Asp.Net control at runtime

The LEFT and TOP attributes in the following code sets the left and top positions of a control. You can call this code from any where in your code.

For example, if I have a table or calender control and want to change the position of the control dynamically, this is the code I need to add.

Calendar1.Attributes.Item("style") = "Z-INDEX: 176; LEFT: 334px; POSITION: absolute; TOP: 176px"

And in Asp.Net 3.5 it would be

Calendar1.Attributes.CssStyle.Value = "Z-INDEX: 176; LEFT: 334px; POSITION: absolute; TOP: 176px";

Apr 7, 2009

How to change the cursor style when mouse moves over the server controls

How to change the cursor style when mouse moves over the server controls :

Just we can set the cursor style on onmouseover and onmouseout events for any server controls like button, label textboxes etc.. as given below.

Open Triangle
asp:Button ID="Button1" runat="server" Text="" onmouseover="'underline'" onmouseout="'none'" style="cursor:pointer"
Close Triangle