阅读:1834回复:3
我做了个查找的.........最近看到帮助有个Find Samples的 就想也做一个,不过运行Find Samples时都不行,请高手们 帮忙看看 帮个忙 ,谢谢你们~~~~~~~ |
|
1楼#
发布于:2006-09-12 09:22
![]() ![]() ![]() |
|
|
2楼#
发布于:2006-09-11 20:29
请各位都来看看帮帮忙呀 小弟,谢过了~~~~~~~
|
|
3楼#
发布于:2006-09-11 20:27
using System; namespace Find /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { public System.Windows.Forms.Button cmdLoad; public System.Windows.Forms.TextBox txbPath; public System.Windows.Forms.Label Label1; public System.Windows.Forms.Label Label6; public System.Windows.Forms.Label Label5; public System.Windows.Forms.Label Label3; public System.Windows.Forms.Label Label2; public System.Windows.Forms.ComboBox cboLayers; public System.Windows.Forms.Button cmdFlicker; public System.Windows.Forms.Button cmdFlash; public System.Windows.Forms.Button cmdFindNext; public System.Windows.Forms.Button cmdFind; private ArcReaderSearchDef m_SearchDef; private IARFeatureCursor m_FeatureCursor; private IARFeature m_Feature; private System.Collections.SortedList m_LayerCollection = new System.Collections.SortedList(); private ESRI.ArcGIS.ArcReaderControl.AxArcReaderControl axArcReaderControl2; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() // /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.cmdLoad = new System.Windows.Forms.Button(); this.txbPath = new System.Windows.Forms.TextBox(); this.Label1 = new System.Windows.Forms.Label(); this.Label6 = new System.Windows.Forms.Label(); this.Label5 = new System.Windows.Forms.Label(); this.Label3 = new System.Windows.Forms.Label(); this.Label2 = new System.Windows.Forms.Label(); this.cboLayers = new System.Windows.Forms.ComboBox(); this.cmdFlicker = new System.Windows.Forms.Button(); this.cmdFlash = new System.Windows.Forms.Button(); this.cmdFindNext = new System.Windows.Forms.Button(); this.cmdFind = new System.Windows.Forms.Button(); this.axArcReaderControl2 = new ESRI.ArcGIS.ArcReaderControl.AxArcReaderControl(); ((System.ComponentModel.ISupportInitialize)(this.axArcReaderControl2)).BeginInit(); this.SuspendLayout(); // // cmdLoad // this.cmdLoad.BackColor = System.Drawing.SystemColors.Control; this.cmdLoad.Cursor = System.Windows.Forms.Cursors.Default; this.cmdLoad.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmdLoad.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdLoad.Location = new System.Drawing.Point(470, 9); this.cmdLoad.Name = "cmdLoad"; this.cmdLoad.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdLoad.Size = new System.Drawing.Size(98, 27); this.cmdLoad.TabIndex = 3; this.cmdLoad.Text = "Load PMF"; this.cmdLoad.Click += new System.EventHandler(this.cmdLoad_Click); // // txbPath // this.txbPath.AcceptsReturn = true; this.txbPath.AutoSize = false; this.txbPath.BackColor = System.Drawing.SystemColors.Window; this.txbPath.Cursor = System.Windows.Forms.Cursors.IBeam; this.txbPath.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.txbPath.ForeColor = System.Drawing.SystemColors.WindowText; this.txbPath.Location = new System.Drawing.Point(10, 9); this.txbPath.MaxLength = 0; this.txbPath.Name = "txbPath"; this.txbPath.RightToLeft = System.Windows.Forms.RightToLeft.No; this.txbPath.Size = new System.Drawing.Size(452, 27); this.txbPath.TabIndex = 2; this.txbPath.Text = ""; // // Label1 // this.Label1.BackColor = System.Drawing.SystemColors.Control; this.Label1.Cursor = System.Windows.Forms.Cursors.Default; this.Label1.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Label1.ForeColor = System.Drawing.SystemColors.Highlight; this.Label1.Location = new System.Drawing.Point(586, 129); this.Label1.Name = "Label1"; this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No; this.Label1.Size = new System.Drawing.Size(241, 27); this.Label1.TabIndex = 16; this.Label1.Text = "5) Loop though any other features that were found."; // // Label6 // this.Label6.BackColor = System.Drawing.SystemColors.Control; this.Label6.Cursor = System.Windows.Forms.Cursors.Default; this.Label6.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Label6.ForeColor = System.Drawing.SystemColors.Highlight; this.Label6.Location = new System.Drawing.Point(586, 69); this.Label6.Name = "Label6"; this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No; this.Label6.Size = new System.Drawing.Size(241, 18); this.Label6.TabIndex = 15; this.Label6.Text = "3) Enter a search string to find."; // // Label5 // this.Label5.BackColor = System.Drawing.SystemColors.Control; this.Label5.Cursor = System.Windows.Forms.Cursors.Default; this.Label5.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Label5.ForeColor = System.Drawing.SystemColors.Highlight; this.Label5.Location = new System.Drawing.Point(586, 95); this.Label5.Name = "Label5"; this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No; this.Label5.Size = new System.Drawing.Size(241, 27); this.Label5.TabIndex = 14; this.Label5.Text = "4) Flash or flicker the found feature."; // // Label3 // this.Label3.BackColor = System.Drawing.SystemColors.Control; this.Label3.Cursor = System.Windows.Forms.Cursors.Default; this.Label3.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Label3.ForeColor = System.Drawing.SystemColors.Highlight; this.Label3.Location = new System.Drawing.Point(586, 43); this.Label3.Name = "Label3"; this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No; this.Label3.Size = new System.Drawing.Size(241, 18); this.Label3.TabIndex = 13; this.Label3.Text = "2) Select a layer to search."; // // Label2 // this.Label2.BackColor = System.Drawing.SystemColors.Control; this.Label2.Cursor = System.Windows.Forms.Cursors.Default; this.Label2.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Label2.ForeColor = System.Drawing.SystemColors.Highlight; this.Label2.Location = new System.Drawing.Point(586, 9); this.Label2.Name = "Label2"; this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No; this.Label2.Size = new System.Drawing.Size(241, 27); this.Label2.TabIndex = 12; this.Label2.Text = "1) Enter a valid file path and load the PMF."; // // cboLayers // this.cboLayers.BackColor = System.Drawing.SystemColors.Window; this.cboLayers.Cursor = System.Windows.Forms.Cursors.Default; this.cboLayers.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cboLayers.ForeColor = System.Drawing.SystemColors.WindowText; this.cboLayers.Items.AddRange(new object[] { "Layer", "Field"}); this.cboLayers.Location = new System.Drawing.Point(586, 207); this.cboLayers.Name = "cboLayers"; this.cboLayers.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cboLayers.Size = new System.Drawing.Size(231, 22); this.cboLayers.TabIndex = 17; // // cmdFlicker // this.cmdFlicker.BackColor = System.Drawing.SystemColors.Control; this.cmdFlicker.Cursor = System.Windows.Forms.Cursors.Default; this.cmdFlicker.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmdFlicker.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdFlicker.Location = new System.Drawing.Point(701, 310); this.cmdFlicker.Name = "cmdFlicker"; this.cmdFlicker.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdFlicker.Size = new System.Drawing.Size(116, 36); this.cmdFlicker.TabIndex = 21; this.cmdFlicker.Text = "Flicker Feature"; this.cmdFlicker.Click += new System.EventHandler(this.cmdFlicker_Click); // // cmdFlash // this.cmdFlash.BackColor = System.Drawing.SystemColors.Control; this.cmdFlash.Cursor = System.Windows.Forms.Cursors.Default; this.cmdFlash.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmdFlash.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdFlash.ImageAlign = System.Drawing.ContentAlignment.TopCenter; this.cmdFlash.Location = new System.Drawing.Point(586, 310); this.cmdFlash.Name = "cmdFlash"; this.cmdFlash.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdFlash.Size = new System.Drawing.Size(116, 36); this.cmdFlash.TabIndex = 20; this.cmdFlash.Text = "Flash Feature"; this.cmdFlash.Click += new System.EventHandler(this.cmdFlash_Click); // // cmdFindNext // this.cmdFindNext.BackColor = System.Drawing.SystemColors.Control; this.cmdFindNext.Cursor = System.Windows.Forms.Cursors.Default; this.cmdFindNext.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmdFindNext.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdFindNext.ImageAlign = System.Drawing.ContentAlignment.TopCenter; this.cmdFindNext.Location = new System.Drawing.Point(701, 250); this.cmdFindNext.Name = "cmdFindNext"; this.cmdFindNext.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdFindNext.Size = new System.Drawing.Size(116, 44); this.cmdFindNext.TabIndex = 19; this.cmdFindNext.Text = "Find Next"; this.cmdFindNext.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.cmdFindNext.Click += new System.EventHandler(this.cmdFindNext_Click); // // cmdFind // this.cmdFind.BackColor = System.Drawing.SystemColors.Control; this.cmdFind.Cursor = System.Windows.Forms.Cursors.Default; this.cmdFind.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmdFind.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdFind.ImageAlign = System.Drawing.ContentAlignment.TopCenter; this.cmdFind.Location = new System.Drawing.Point(586, 250); this.cmdFind.Name = "cmdFind"; this.cmdFind.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdFind.Size = new System.Drawing.Size(116, 44); this.cmdFind.TabIndex = 18; this.cmdFind.Text = "Find"; this.cmdFind.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.cmdFind.Click += new System.EventHandler(this.cmdFind_Click); // // axArcReaderControl2 // this.axArcReaderControl2.Location = new System.Drawing.Point(8, 48); this.axArcReaderControl2.Name = "axArcReaderControl2"; this.axArcReaderControl2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axArcReaderControl2.OcxState"))); this.axArcReaderControl2.Size = new System.Drawing.Size(536, 384); this.axArcReaderControl2.TabIndex = 22; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(835, 506); this.Controls.Add(this.axArcReaderControl2); this.Controls.Add(this.cmdFlicker); this.Controls.Add(this.cmdFlash); this.Controls.Add(this.cmdFindNext); this.Controls.Add(this.cmdFind); this.Controls.Add(this.cboLayers); this.Controls.Add(this.Label1); this.Controls.Add(this.Label6); this.Controls.Add(this.Label5); this.Controls.Add(this.Label3); this.Controls.Add(this.Label2); this.Controls.Add(this.cmdLoad); this.Controls.Add(this.txbPath); this.Name = "Form1"; this.Text = "Form1"; this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing); this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.axArcReaderControl2)).EndInit(); this.ResumeLayout(false); } /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) private void cmdFind_Click(object sender, System.EventArgs e) //Determine whether a document is loaded //Determine whether permission to search layers
//Get string to search for from the user if (res.Result == DialogResult.Cancel) return; //Get IARFeatureCursor interface. Because there is no 'WhereClause' set string sWhereClause = ""; //Loop through the feature's fields to find the field names of any string //Set the search definiton WhereClause if (m_Feature == null) private void cmdFindNext_Click(object sender, System.EventArgs e) if (m_Feature == null) private void cmdFlash_Click(object sender, System.EventArgs e) private void cmdFlicker_Click(object sender, System.EventArgs e) private void cmdLoad_Click(object sender, System.EventArgs e) private void DisplayLayerNames() //Loop through each layer in the focus map //Select the first layer in the combo box private void axArcReaderControl1_OnCurrentViewChanged(object sender, ESRI.ArcGIS.ArcReaderControl.IARControlEvents_OnCurrentViewChangedEvent e) private void axArcReaderControl1_OnDocumentLoaded(object sender, ESRI.ArcGIS.ArcReaderControl.IARControlEvents_OnDocumentLoadedEvent e) private void axArcReaderControl1_OnFocusARMapChanged(object sender, ESRI.ArcGIS.ArcReaderControl.IARControlEvents_OnFocusARMapChangedEvent e) private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) |
|