阅读:1060回复:0
[求助]在VB中新建图层及属性的问题
<P ><FONT size=3><FONT face="Times New Roman">请问为什么在宣告的时候都会出现"使用者自定型态尚未定义"这个问题!?</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman"> Dim rs As DAO.Recordset <<<< Dim db As DAO.Database <<<< Dim flds As New MapXLib.Fields Dim lyrNew As MapXLib.Layer Dim ptNew As New MapXLib.Point Dim ftrNew As MapXLib.Feature Dim ff As MapXLib.FeatureFactory Dim li As New MapXLib.LayerInfo Dim rvs As New MapXLib.RowValues Dim ds As MapXLib.Dataset </FONT></FONT></P> <P ><FONT size=3><FONT face="Times New Roman"> Set db = DBEngine.OpenDatabase("C:\test\db1.mdb") Set rs = db.OpenRecordset("test") Set ff = Map1.FeatureFactory </FONT></FONT><FONT size=3><FONT face="Times New Roman"> flds.AddStringField "Company", 50 flds.AddStringField "City", 50 flds.AddStringField "State", 2 flds.AddNumericField "Order_Amt", 12, 2</FONT></FONT></P> <P ><FONT size=3><FONT face="Times New Roman"> 'define the LayerInfo object li.Type = miLayerInfoTypeNewTable li.AddParameter "FileSpec", App.Path ; "\custtab.tab" li.AddParameter "Name", "mycustomers" li.AddParameter "Fields", flds</FONT></FONT></P> <P ><FONT size=3><FONT face="Times New Roman"></FONT></FONT> </P> <P ><FONT size=3><FONT face="Times New Roman"> Map1.Layers.Add li, 1 </FONT></FONT><FONT size=3><FONT face="Times New Roman"> Set lyrNew = Map1.Layers(1) Set ds = Map1.DataSets.Add(miDataSetLayer, lyrNew) Set rvs = ds.RowValues(0) Do While Not rs.EOF rvs.Item("Company").Value = rs.Fields("Company") rvs.Item("City").Value = rs.Fields("City") rvs.Item("State").Value = rs.Fields("State") rvs.Item("Order_Amt").Value = rs.Fields("Order_Amt") ptNew.Set rs.Fields("X"), rs.Fields("Y") Set ftrNew = ff.CreateSymbol(ptNew) Set ftrNew = lyrNew.AddFeature(ftrNew, rvs) rs.MoveNext Loop Set rs = Nothing Set db = Nothing </P><p></p></FONT></FONT> |
|