Creating a Web application with Web controls
使用WEB控件创建一个Web应用程序。
The Web ADF includes a set of predefined controls add to existing Web applications or create new Web applications quickly and efficiently. The Web ADF controls are integrated with the visual design-time environment provided by Visual Studio 2005. This example shows you how to create a Web application from scratch using the Web ADF controls.
Web ADF 框架包括一系列的预定义的控件,这些控件可以添加到一个已经存在的WEB应用程序中或者能够快速、高效的的创建一个新的应用程序 Web ADF控件被集成到由VS2005提供的运行设计环境。下面的例子讲解了使用WEB ADF框架如何创建一Web 应用程序。
- Start Visual Studio 2005 and create a new project. Click the file menu, click New, and select Web Site.
- In the New Web Site dialog, set the Location value to HTTP, and Language to your language of choice.
- Under Visual Studio installed templates, click ASP.NET Web Site
1:启动VS2005并创建一个的工程。 单击文件菜单,单击新建,然后选择站点。
2:在创建web站点对话框里面,设置HTTP网络访问的路径以及你要使用的开发语言
3:找到 VS安装的模板,然后选择ASP.NET站点。
4:Enter a name and location for the Web application and click OK. Visual Studio 2005 should show a blank Default.aspx page in design view.
输入web 应用程序存储的路径以及文件名称。在设计视图下VS2005应该显示一个默认的空Default.aspx页面。
5:Open the Visual Studio Toolbox and expand the ArcGIS Web Controls tab. Drag a MapResourceManager control and a Map control onto the Default.aspx page.
打开VS的工具箱并展开ArcGIS Web 控件页签。拖拽一个MapResourceManager控件和一个Map控件到那个默认的空白页面:Default.aspx
6:Set the ResourceItems property on the MapResourceManager control. Click the "Edit Resources" verb on the control in the design view -or- in the MapResourceManager property page click the ellipsis next to the ResourceItems property to display the MapResourceItem Collection Editor dialog.
设置MapResourceManager的ResourceItems属性。 在设计试图下单击控件上的[Edit Resource],或者在MapResourceManager属性页面上单击ResourceItems属性后面省略号来显示MapResourceItem集合的编辑对话框。
7:In the MapResourceItem Collection Editor dialog, add a new MapResourceItem (click the Add button). Set its Definition property by clicking the ellipsis in the property page to display the Map Resource Definition Editor. Select a resource type and define the appropriate properties. See the Add Resources section in the MapResourceManager control topic for more detailed information. In general, you can use any resource type that generates a map image. Close the MapResourceItem Collection Editor.
在MapResourceItem集合编辑对话框里面,添加一个新的MapResourceItem项。单击属性页后面的省略号调用地图资源的编辑器来设置他的属性。选择一个资源类型,并定义他适合的属性。更多的信息请单击和MapResourceManager控件话题相关的Add Resources。一般来说,你可以使用任何可以产生地图图像的的资源。 关闭MapResourceItem集合编辑框。
8:Set the MapResourceManager property on the Map control. Select the Map control in design view or in the Properties window, then click the dropdown list for the MapResourceManager property. Select the name of the MapResourceManager added in a previous step (by default "MapResourceManager1").
设置地图控件上的MapResourceManager属性。在设计试图模式下选择地图控件或菏泽在属性窗口中,单击MapResourceManager的属性下拉列表框,选择在上一步添加大MapResourceManager的名称。
9:Change the size of the Map control to at least 300x300 pixels. This is not required, but will make the Map easier to visualize on the page.
设置地图控件的大小最小为300*300像素,这个不是必须的,但是可是使地图更好的在页面上显示。
10:Add a Toc control to the Default.aspx page.
添加一个TOC控件到Default.aspx页面。
11:Change the positioning of the control to be absolute, which will enable the control to be placed anywhere on the page. By default, Visual Studio 2005 adds controls in flow layout. Right-click the Toc control and select "Style". In the Style Builder dialog, select the Position option and click the dropdown list under "Position Mode". Select "Absolutely position" and click OK to exit the dialog. Select the Toc control in design view and start to drag it to another location on the page. Note that it will immediately display in the upper left corner of the page. This is default behavior associated with Web control positioning in Visual Studio 2005. Select the Toc control again and drag it to the right of the Map control。
设置控件的定位属性为绝对定位,这样能够让地图控件可以放置到页面的任何位置。默认的情况下VS2005利用浮动定位模式添加控件。右键单击TOC控件并选择样式。 在样式设置对话框里选择定位选项,然后选择位置模型为下拉框。
在样式编辑对话框里面,在位置模型的下拉框下选择下拉框选项。选择绝对定位属性并单击ok退出对话框,在设计视图模式下,选择TOC控件并且把他拖拽页面的其他的位置。需要注意的是:他将会立刻显示到页面的左上角的位置。 这个默认的操作是和VS里面的Web控件的定位是有关联的。再次选中TOC控件并把它拖动到地图控件的右边。
12:Set the BuddyControl property on the Toc control. Select the Toc control in design view or in the Properties window, then click the dropdown list for the BuddyControl property. The list will include the names of Map controls available on the page. Select the name of the Map control added in a previous step (by default "Map1"). This will buddy the Toc with the Map control.
设置TOC控件的BuddyControl属性。 在视图模式下选中TOCk控件护着在属性窗口中,单击BuddyControl属性的下拉框。列表中就会包括在页面能够获得的地图控件的名称列表。选择在上一步添加的地图控件的名称(默认的名称为:Map1),这样就将TOC控件和地图控件绑定起来了。
13:Add a Toolbar control to the Default.aspx page.
将toolBar控件添加到默认的地图页面。
14:Set the BuddyControls property on the Toolbar control. Select the Toolbar control in design view or in the Properties window, then click the ellipsis for the BuddyControls property. In the BuddyControl Collection Editor dialog, add a new item and set its Name property to the name of the Map control added in a previous step (by default "Map1").
设置工具条的BuddyContols属性。在设计视图下选择Toolbar控件,或者在属性窗口中,然后单击BuddyControls属性后面的省略号。在BuddyControls集合的编辑框里面,添加一个新项并设置他的Name属性为上一步添加的地图控件的名称。
15:Set the ToolbarItems property on the Toolbar control. Select the Toolbar control in design view or in the Properties window, then click the ellipsis for the ToolbarItems property. In the ToolbarItems Collection Editor dialog, add all tools under the "Navigation Tools" node. See the Add Toolbar Items section in the Toolbar control topic for more detailed information. Click OK to exit the editor dialog and save all changes to the Web site. In design view, the site should appear as follows:
设置Toolbar控件的ToolbarItems属性。在设计视图模式下选中ToolBar或者在属性窗口中,单击ToolbarItems属性后面的省略号。在ToolbarItems集合编辑框里面,添加导航工具下的所有工具。关于Toolbar控件的详细信息单击后面的Add Toolbar Items。单击ok退出编辑框并保存页面李所有的改变在设计视图下,站点就会如下图所示:
16:Click the Start button to run the application.
单击启动按钮,运行当前的程序。
17:Explore the interface of your Web application. For example, click the Zoom In tool on the toolbar and drag a rectangle over the map.
探索你的网站,比如:单击放大工具并在地图上拖动一个举行对话框
18:Click the Stop button to stop the application or the close the browser window.
单击停止运行按钮,或者关闭浏览器窗口,退出应用程序。
。
来源:https://www.cnblogs.com/xingchen/archive/2010/07/17/1779372.html