public object SelectedLayerInformation(IMxDocument pMxDocument, ref Inteer FrameIndex, ref int LayerIndex) { int intFrame = 0; int intLayer = 0; bool blnFrag = false; IMap pMap = default(IMap); //選択したレイヤのデータフレーム インデックス、レイヤ インデックスを取得 for (intFrame = 0; intFrame <= pMxDocument.Maps.Count - 1; intFrme++) { pMap = pMxDocument.Maps.Item(intFrame); for (intLayer = 0; intLayer <= pMap.LayerCount - 1; intLyer++) { if (object.ReferenceEquals(pMxDocument.SelectedLyer, pMap.Layer(intLayer))) { blnFrag = true; break; // TODO: might not be correct. Wa : Exit For } } if (blnFrag == true) { break; // TODO: might not be correct. Was : ExitFor } break; // TODO: might not be correct. Was : Exit For } //戻り値 FrameIndex = intFrame; LayerIndex = intLayer; }
Function SelectedLayerInformation(ByVal pMxDocument As IMxDocument, ByRef FrameIndex As Integer, ByRef LayerIndex As Integer) Dim intFrame As Integer Dim intLayer As Integer Dim blnFrag As Boolean Dim pMap As IMap '選択したレイヤのデータフレーム インデックス、レイヤ インデックスを取得 For intFrame = 0 To pMxDocument.Maps.Count - 1 Set pMap = pMxDocument.Maps.Item(intFrame) For intLayer = 0 To pMap.LayerCount - 1 If pMxDocument.SelectedLayer Is pMap.Layer(intLayer) Then blnFrag = True Exit For End If Next intLayer If blnFrag = True Then Exit For End If Exit For '戻り値 FrameIndex = intFrame LayerIndex = intLayer End Function