mo+c#中的 tips 实现

由于博客内容为空,无法提取关键信息生成摘要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

None.gif using  System; 
None.gif
using  System.Drawing; 
None.gif
using  System.Collections; 
None.gif
using  System.ComponentModel; 
None.gif
using  System.Windows.Forms; 
None.gif
using  System.Data; 
None.gif
None.gif
namespace  WindowsApplication67 
ExpandedBlockStart.gifContractedBlock.gif
dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif 
/**//// 
InBlock.gif 
/// Form1 的摘要说明。 
ExpandedSubBlockEnd.gif 
/// 

InBlock.gif public class Form1 : System.Windows.Forms.Form 
ExpandedSubBlockStart.gifContractedSubBlock.gif 
dot.gif
InBlock.gif  
private AxMapObjects2.AxMap axMap1; 
InBlock.gif  
private System.Windows.Forms.TextBox textBox1; 
InBlock.gif  
private System.Windows.Forms.Timer timer1; 
InBlock.gif  
private System.ComponentModel.IContainer components; 
InBlock.gif        
public maptips2  tips; 
InBlock.gif
InBlock.gif  
public Form1() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
// 
InBlock.gif   
// Windows 窗体设计器支持所必需的 
InBlock.gif   
// 
InBlock.gif
   InitializeComponent(); 
InBlock.gif
InBlock.gif   
// 
InBlock.gif   
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 
InBlock.gif   
// 
ExpandedSubBlockEnd.gif
  }
 
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// 
InBlock.gif  
/// 清理所有正在使用的资源。 
ExpandedSubBlockEnd.gif  
/// 

InBlock.gif  protected override void Dispose( bool disposing ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
if( disposing ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    
if (components != null
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif
InBlock.gif     components.Dispose(); 
ExpandedSubBlockEnd.gif    }
 
ExpandedSubBlockEnd.gif   }
 
InBlock.gif   
base.Dispose( disposing ); 
ExpandedSubBlockEnd.gif  }
 
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif  
Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// 
InBlock.gif  
/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
InBlock.gif  
/// 此方法的内容。 
ExpandedSubBlockEnd.gif  
/// 

InBlock.gif  private void InitializeComponent() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
this.components = new System.ComponentModel.Container(); 
InBlock.gif   System.Resources.ResourceManager resources 
= new System.Resources.ResourceManager(typeof(Form1)); 
InBlock.gif   
this.axMap1 = new AxMapObjects2.AxMap(); 
InBlock.gif   
this.textBox1 = new System.Windows.Forms.TextBox(); 
InBlock.gif   
this.timer1 = new System.Windows.Forms.Timer(this.components); 
InBlock.gif   ((System.ComponentModel.ISupportInitialize)(
this.axMap1)).BeginInit(); 
InBlock.gif   
this.SuspendLayout(); 
InBlock.gif   
// 
InBlock.gif   
// axMap1 
InBlock.gif   
// 
InBlock.gif
   this.axMap1.Location = new System.Drawing.Point(1624); 
InBlock.gif   
this.axMap1.Name = "axMap1"
InBlock.gif   
this.axMap1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMap1.OcxState"))); 
InBlock.gif   
this.axMap1.Size = new System.Drawing.Size(392224); 
InBlock.gif   
this.axMap1.TabIndex = 0
InBlock.gif   
this.axMap1.MouseDownEvent += new AxMapObjects2._DMapEvents_MouseDownEventHandler(this.axMap1_MouseDownEvent); 
InBlock.gif   
this.axMap1.MouseMoveEvent += new AxMapObjects2._DMapEvents_MouseMoveEventHandler(this.axMap1_MouseMoveEvent); 
InBlock.gif   
// 
InBlock.gif   
// textBox1 
InBlock.gif   
// 
InBlock.gif
   this.textBox1.Location = new System.Drawing.Point(16864); 
InBlock.gif   
this.textBox1.Name = "textBox1"
InBlock.gif   
this.textBox1.Size = new System.Drawing.Size(8021); 
InBlock.gif   
this.textBox1.TabIndex = 1
InBlock.gif   
this.textBox1.Text = "textBox1"
InBlock.gif   
// 
InBlock.gif   
// timer1 
InBlock.gif   
// 
InBlock.gif
   this.timer1.Enabled = true
InBlock.gif   
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); 
InBlock.gif   
// 
InBlock.gif   
// Form1 
InBlock.gif   
// 
InBlock.gif
   this.AutoScaleBaseSize = new System.Drawing.Size(614); 
InBlock.gif   
this.ClientSize = new System.Drawing.Size(496285); 
InBlock.gif   
this.Controls.Add(this.textBox1); 
InBlock.gif   
this.Controls.Add(this.axMap1); 
InBlock.gif   
this.Name = "Form1"
InBlock.gif   
this.Text = "Form1"
InBlock.gif   
this.Load += new System.EventHandler(this.Form1_Load); 
InBlock.gif   ((System.ComponentModel.ISupportInitialize)(
this.axMap1)).EndInit(); 
InBlock.gif   
this.ResumeLayout(false); 
InBlock.gif
ExpandedSubBlockEnd.gif  }
 
ExpandedSubBlockEnd.gif  
#endregion
 
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif  
/**//// 
InBlock.gif  
/// 应用程序的主入口点。 
ExpandedSubBlockEnd.gif  
/// 

InBlock.gif  [STAThread] 
InBlock.gif  
static void Main() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   Application.Run(
new Form1()); 
ExpandedSubBlockEnd.gif  }
 
InBlock.gif
InBlock.gif  
private void Form1_Load(object sender, System.EventArgs e) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   MapObjects2.IMoDataConnection  dc; 
InBlock.gif   MapObjects2.IMoMapLayer  layer; 
InBlock.gif   dc
=new MapObjects2.DataConnectionClass(); 
InBlock.gif   dc.Database
=@"f:\data\usa"
InBlock.gif   
if (!dc.Connect()) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    MessageBox.Show(
"无法连"); 
ExpandedSubBlockEnd.gif   }
 
InBlock.gif   
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    layer
=new MapObjects2.MapLayerClass(); 
InBlock.gif    layer.GeoDataset
=dc.FindGeoDataset("STATES"); 
InBlock.gif    axMap1.Layers.Add(layer); 
InBlock.gif
InBlock.gif   
InBlock.gif
InBlock.gif   tips
=new maptips2(); 
InBlock.gif   tips.initialize(axMap1,timer1,textBox1); 
InBlock.gif            tips.setlay(layer,
"STATE_NAME"); 
InBlock.gif
ExpandedSubBlockEnd.gif}
 
ExpandedSubBlockEnd.gif  }
 
InBlock.gif
InBlock.gif  
private void axMap1_MouseDownEvent(object sender, AxMapObjects2._DMapEvents_MouseDownEvent e) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   MapObjects2.Rectangle  r; 
InBlock.gif   r
=   new MapObjects2.RectangleClass(); 
InBlock.gif   r
=axMap1.TrackRectangle() ; 
InBlock.gif
InBlock.gif   axMap1.Extent
=r;
InBlock.gif
ExpandedSubBlockEnd.gif  }

InBlock.gif
InBlock.gif  
private void axMap1_MouseMoveEvent(object sender, AxMapObjects2._DMapEvents_MouseMoveEvent e) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
this.tips.mousemove(e.x,e.y ); 
ExpandedSubBlockEnd.gif  }
 
InBlock.gif
InBlock.gif  
private void timer1_Tick(object sender, System.EventArgs e) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
this.tips.timer(); 
ExpandedSubBlockEnd.gif  }
 
ExpandedSubBlockEnd.gif }
 
ExpandedBlockEnd.gif}
 
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
None.gif
//
None.gif

None.gif
using  System; 
None.gif
using  MapObjects2; 
None.gif
None.gif
namespace  WindowsApplication67 
ExpandedBlockStart.gifContractedBlock.gif
dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif 
/**//// 
InBlock.gif 
/// maptips2 的摘要说明。 
ExpandedSubBlockEnd.gif 
/// 

InBlock.gif public class maptips2 
ExpandedSubBlockStart.gifContractedSubBlock.gif 
dot.gif
InBlock.gif  
public maptips2() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
// 
InBlock.gif   
// TODO: 在此处添加构造函数逻辑 
InBlock.gif   
// 
ExpandedSubBlockEnd.gif
  }
 
InBlock.gif  
protected int  m_x; 
InBlock.gif  
protected int  m_y; 
InBlock.gif  
protected int  m_lastx; 
InBlock.gif  
protected int  m_lasty; 
InBlock.gif        
protected  AxMapObjects2.AxMap axMap1; 
InBlock.gif  
protected  System.Windows.Forms.Timer m_time; 
InBlock.gif  
protected  System.Windows.Forms.TextBox m_edit; 
InBlock.gif  
protected  MapObjects2.IMoMapLayer  m_layer; 
InBlock.gif  
protected  string  m_field; 
InBlock.gif  
protected  MapObjects2.Recordset m_recs; 
InBlock.gif
InBlock.gif  
public void doseach() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   MapObjects2.Point  pt; 
InBlock.gif   pt
=new MapObjects2.PointClass(); 
InBlock.gif   pt
=axMap1.ToMapPoint(m_x,m_y); 
InBlock.gif   
if (m_layer.shapeType.ToString()=="23"
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_recs
=m_layer.SearchShape(pt,MapObjects2.SearchMethodConstants.moPointInPolygon ,""); 
InBlock.gif     
InBlock.gif
ExpandedSubBlockEnd.gif   }
 
InBlock.gif   
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_recs
=m_layer.SearchByDistance(pt,axMap1.ToMapDistance(10),""); 
InBlock.gif
ExpandedSubBlockEnd.gif   }
 
InBlock.gif    
InBlock.gif
ExpandedSubBlockEnd.gif  }
 
InBlock.gif  
public void initialize(AxMapObjects2.AxMap  map,System.Windows.Forms.Timer tmr,System.Windows.Forms.TextBox edit ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   axMap1
=map; 
InBlock.gif   m_time
=tmr; 
InBlock.gif   m_edit
=edit; 
InBlock.gif   m_edit.Visible
=false
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif  }
 
InBlock.gif  
public void mousemove(int x,int y) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
if ( m_time.Interval==1
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_x
=x; 
InBlock.gif    m_y
=y; 
InBlock.gif    m_time.Interval
=100
ExpandedSubBlockEnd.gif   }
 
InBlock.gif   
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_edit.Visible
=false
InBlock.gif
ExpandedSubBlockEnd.gif   }
 
ExpandedSubBlockEnd.gif  }
 
InBlock.gif  
public void setlay(MapObjects2.IMoMapLayer  layer,string fid) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   m_layer
=layer; 
InBlock.gif   m_field
=fid; 
InBlock.gif
ExpandedSubBlockEnd.gif  }
 
InBlock.gif  
public void showtiptext(string text) 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif          m_edit.Text
=text; 
InBlock.gif          m_edit.Visible
=true
InBlock.gif          m_edit.Left
=axMap1.Left+m_x; 
InBlock.gif          m_edit.Top 
=axMap1.Top+m_y+20
InBlock.gif
ExpandedSubBlockEnd.gif  }
 
InBlock.gif  
public void timer() 
ExpandedSubBlockStart.gifContractedSubBlock.gif  
dot.gif
InBlock.gif   
string s; 
InBlock.gif   MapObjects2.IMoFields flds; 
InBlock.gif   MapObjects2.IMoField fld ; 
InBlock.gif   
if ((m_x==m_lastx)&&(m_y==m_lasty)) 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_time.Interval
=1
InBlock.gif    doseach(); 
InBlock.gif    
if(m_recs.EOF ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif
InBlock.gif     m_edit.Visible
=false
InBlock.gif
ExpandedSubBlockEnd.gif    }
 
InBlock.gif    
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif
InBlock.gif     flds
=m_recs.Fields ; 
InBlock.gif     fld
= flds.Item(m_field); 
InBlock.gif     s
=fld.Value.ToString(); 
InBlock.gif     
this.showtiptext(s); 
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif    }
 
InBlock.gif              
ExpandedSubBlockEnd.gif   }
 
InBlock.gif   
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif   
dot.gif
InBlock.gif    m_lastx
=m_x; 
InBlock.gif    m_lasty
=m_y; 
InBlock.gif
ExpandedSubBlockEnd.gif   }

InBlock.gif
InBlock.gif    
ExpandedSubBlockEnd.gif  }
 
InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif }
 
ExpandedBlockEnd.gif}
 
None.gif
None.gif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值