473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

source code for zoom window(c#.net)

i want creat an web application(c#.net),which contains an image and one radiobutton list with 3 radiobuttons(zoom in ,zoom out ,zoom window)
when user checked on zoom in
imge has to be zoom
inthe similar manner when zoom window is checked,it allow to create a rectangle window by using mouse pressed and released.and particular area of the map/image must be zoomed


or my source code writen bellow.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12.  
  13. public partial class Simple : System.Web.UI.Page
  14. {
  15.     private SharpMap.Map myMap;
  16.  
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         //Set up the map. We use the method in the App_Code folder for initializing the map
  20.         myMap = MapHelper.InitializeMap(new System.Drawing.Size((int)imgMap.Width.Value,(int)imgMap.Height.Value));
  21.         if (Page.IsPostBack) 
  22.         {
  23.             //Page is post back. Restore center and zoom-values from viewstate
  24.             myMap.Center = (SharpMap.Geometries.Point)ViewState["mapCenter"];
  25.             myMap.Zoom = (double)ViewState["mapZoom"];
  26.         }
  27.         else
  28.         {
  29.             //This is the initial view of the map. Zoom to the extents of the map:
  30.             //myMap.ZoomToExtents();
  31.             //or center on 0,0 and zoom to full earth (360 degrees)
  32.             //myMap.Center = new SharpMap.Geometries.Point(0,0);
  33.             //myMap.Zoom = 360;
  34.             //Create the map
  35.             GenerateMap();
  36.         }
  37.     }
  38.  
  39.     protected void imgMap_Click(object sender, ImageClickEventArgs e)
  40.     {
  41.         //Set center of the map to where the client clicked
  42.         myMap.Center = myMap.ImageToWorld(new System.Drawing.Point(e.X, e.Y));
  43.         //Set zoom value if any of the zoom tools were selected
  44.         if (rblMapTools.SelectedValue == "0") //Zoom in
  45.             myMap.Zoom = myMap.Zoom * 0.5;
  46.          if (rblMapTools.SelectedValue == "1") //Zoom out
  47.             myMap.Zoom = myMap.Zoom * 2;
  48.         else if (rblMapTools.SelectedValue == "3") // Zoom Extent
  49.             myMap.ZoomToExtents();
  50.  
  51.         //Create the map
  52.         GenerateMap();
  53.     }
  54.  
  55.     /// <summary>
  56.     /// Creates the map, inserts it into the cache and sets the ImageButton Url
  57.     /// </summary>
  58.     private void GenerateMap()
  59.     {
  60.         //Save the current mapcenter and zoom in the viewstate
  61.         ViewState.Add("mapCenter", myMap.Center);
  62.         ViewState.Add("mapZoom", myMap.Zoom);
  63.         //Render map
  64.         System.Drawing.Image img = myMap.GetMap();
  65.         string imgID = SharpMap.Web.Caching.InsertIntoCache(1, img);
  66.         imgMap.ImageUrl = "getmap.aspx?ID=" + HttpUtility.UrlEncode(imgID);
  67.     }
  68.  
  69. }
  70.  replay
Jan 23 '08 #1
0 8281

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Spare Change | last post by:
Ok, here's what I did all day ( besides baking an Eggplant Parmesan ). The SupraText Editor version 0.0001a : http://home.earthlink.net/~jabailo/Windopes%20SupraText/ Take down the binary...
3
by: jjmraz | last post by:
Hi, Heres the scenario: I have a couple of xml feeds coming in from another company. I would have a window service to check every so often for these xml files. The service would parse the xml...
0
by: raagz | last post by:
Hi, I have hosted an ASP.NET application on a windows 2003 server which has ..NET framework 1.1. I am also using skmenu.dll and component one studio (3rd party) dlls for generating menus and...
0
by: Philipp via DotNetMonster.com | last post by:
Hi forum users All of you who are interested in bpm, workflow, opensoucre and .net I would like to point to http://www.netbpm.org. There you can find a new open source bpm tool. If you like...
0
by: fwsmaster | last post by:
FWS Dotnetnukes websites focus on all DotNetNuke® (DNNT) related matter. The purpose of these sites is to support, demo and promote this open source .Net Webportal and Content Management System....
2
by: noone | last post by:
Posting this in a M$ public forum might attract some hostility but I'll ask anyway. I've noted two open source .net projects that will let me develop and execute somewhat transportable code...
11
by: volcano | last post by:
Hello, folks! A trivial question - I have a working Python script that I have to invoke from C++ code. No fancy stuff - just run the whole script with its parameters. No callbacks, no signalling -...
11
by: susiedba | last post by:
does anyone know of a framework; or tools; or something-- that describes an open source VB.net search engine / spider? anyone want to trade notes? I want to build something a lot more focused...
4
by: sloan | last post by:
Anyone know if this site has closed its doors? csharp-source.net I've tried for 3 days now, at work and at home. No go. ............
3
by: AshokG | last post by:
Hi, What are all the open source developer tools avaliable for .NET to name a few NUnit, NCover, NMock, NHibernate... I want to know the names of all the tools avaibale till the date like...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.