|
阅读:1101回复:1
PageLayoutControl如何加载图层
请问各位高手,PageLayoutControl这个东东处理使用LoadMxFile方法外?还有其他方法来增加我需要的图层吗?<img src="images/post/smile/dvbbs/em12.gif" />
|
|
|
1楼#
发布于:2005-07-11 21:10
<P><FONT size=1>'''''AddLayer<BR>Private Sub cmdAddLayer_Click()<BR>'New Factory<BR> Dim myFWKS As IFeatureWorkspace<BR> Dim myWKSF As IWorkspaceFactory<BR> Set myWKSF = New ShapefileWorkspaceFactory<BR> <FONT color=#f73809>Set myFWKS = myWKSF.OpenFromFile("E:\ArcGIS\DeveloperKit\samples\samples\data\usa", 0) 'Your Shp File<BR></FONT> If Not myFWKS Is Nothing Then<BR> ''''Open featureClass<BR> Dim myFC As IFeatureClass<BR> <FONT color=#ee1111>Set myFC = myFWKS.OpenFeatureClass("wind")</FONT> 'your FeatureClass<BR> Dim myDS As IDataset<BR> Set myDS = myFC<BR> Dim myFLayer As IFeatureLayer<BR> Set myFLayer = New FeatureLayer<BR> Set myFLayer.FeatureClass = myFC<BR> myFLayer.Name = myDS.Name<BR> PageLayoutControl1.ActiveView.FocusMap.AddLayer myFLayer<BR> End If<BR>End Sub<BR>'''Load Mxd<BR>Private Sub cmdLoad_Click()<BR>CommonDialog1.DialogTitle = "Browse Map Document"<BR> CommonDialog1.Filter = "Map Documents (*.mxd)|*.mxd"<BR> CommonDialog1.ShowOpen<BR> <BR> 'Exit if no map document is selected<BR> Dim sFilePath As String<BR> sFilePath = CommonDialog1.FileName<BR> If sFilePath = "" Then Exit Sub<BR> <BR> 'If valid map document<BR> If PageLayoutControl1.CheckMxFile(sFilePath) Then<BR> 'Set mouse pointers<BR> PageLayoutControl1.MousePointer = esriPointerHourglass</FONT></P>
<P><FONT size=1> 'Load map document<BR> PageLayoutControl1.LoadMxFile sFilePath<BR> 'Set mouse pointers<BR> PageLayoutControl1.MousePointer = esriPointerDefault</FONT></P> <P><FONT size=1> Else<BR> MsgBox sFilePath ; " is not a valid ArcMap document"<BR> Exit Sub<BR> End If<BR>End Sub<BR></FONT></P> |
|
|