Hello Anshul,
You can use the following code to get a reading/preview pane's location:
Public Shared Function ReadingPaneLayout(ByVal ExplorerObj As Object) As AddinExpress.OL.ADXOlReadingPaneLayout
Try
Dim CommandBarsObj As Object = Nothing
Dim ReadingPaneButton As Object = Nothing
Dim ReadingPaneCommandBar As Object = Nothing
Dim RightButton As Object = Nothing
Dim BottomButton As Object = Nothing
Dim OffButton As Object = Nothing
Try
CommandBarsObj = ExplorerObj.[GetType]().InvokeMember("CommandBars", System.Reflection.BindingFlags.GetProperty, Nothing, ExplorerObj, New Object() {})
If CommandBarsObj IsNot Nothing Then
ReadingPaneButton = CommandBarsObj.[GetType]().InvokeMember("FindControl", System.Reflection.BindingFlags.InvokeMethod, Nothing, CommandBarsObj, New Object() {10, 31134})
End If
If ReadingPaneButton IsNot Nothing Then
ReadingPaneCommandBar = ReadingPaneButton.[GetType]().InvokeMember("CommandBar", System.Reflection.BindingFlags.GetProperty, Nothing, ReadingPaneButton, New Object() {})
End If
If ReadingPaneCommandBar IsNot Nothing Then
Dim state As Integer = 0
RightButton = ReadingPaneCommandBar.[GetType]().InvokeMember("FindControl", System.Reflection.BindingFlags.InvokeMethod, Nothing, ReadingPaneCommandBar, New Object() {1, 7221})
If RightButton IsNot Nothing Then
state = Convert.ToInt32(RightButton.[GetType]().InvokeMember("State", System.Reflection.BindingFlags.GetProperty, Nothing, RightButton, New Object() {}))
If state = -1 Then
Return AddinExpress.OL.ADXOlReadingPaneLayout.Right
End If
End If
BottomButton = ReadingPaneCommandBar.[GetType]().InvokeMember("FindControl", System.Reflection.BindingFlags.InvokeMethod, Nothing, ReadingPaneCommandBar, New Object() {1, 7222})
If BottomButton IsNot Nothing Then
state = Convert.ToInt32(BottomButton.[GetType]().InvokeMember("State", System.Reflection.BindingFlags.GetProperty, Nothing, BottomButton, New Object() {}))
If state = -1 Then
Return AddinExpress.OL.ADXOlReadingPaneLayout.Bottom
End If
End If
OffButton = ReadingPaneCommandBar.[GetType]().InvokeMember("FindControl", System.Reflection.BindingFlags.InvokeMethod, Nothing, ReadingPaneCommandBar, New Object() {1, 7223})
If OffButton IsNot Nothing Then
state = Convert.ToInt32(OffButton.[GetType]().InvokeMember("State", System.Reflection.BindingFlags.GetProperty, Nothing, OffButton, New Object() {}))
If state = -1 Then
Return AddinExpress.OL.ADXOlReadingPaneLayout.Off
End If
End If
End If
Finally
If CommandBarsObj IsNot Nothing Then
Marshal.ReleaseComObject(CommandBarsObj)
End If
If ReadingPaneButton IsNot Nothing Then
Marshal.ReleaseComObject(ReadingPaneButton)
End If
If ReadingPaneCommandBar IsNot Nothing Then
Marshal.ReleaseComObject(ReadingPaneCommandBar)
End If
If RightButton IsNot Nothing Then
Marshal.ReleaseComObject(RightButton)
End If
If BottomButton IsNot Nothing Then
Marshal.ReleaseComObject(BottomButton)
End If
If OffButton IsNot Nothing Then
Marshal.ReleaseComObject(OffButton)
End If
End Try
Return AddinExpress.OL.ADXOlReadingPaneLayout.Off
Catch e As Exception
Throw e
End Try
End Function
I recommend you use the ADXOlFormsManager events to get current Reading Pane/Preview state:
Private ReadingPaneStateByFormsManager As AddinExpress.OL.ADXOlReadingPaneLayout = AddinExpress.OL.ADXOlReadingPaneLayout.Off
Private Sub AdxOlFormsManager1_ADXReadingPaneHide(ByVal sender As System.Object, ByVal args As AddinExpress.OL.ReadingPaneHideEventArgs) Handles AdxOlFormsManager1.ADXReadingPaneHide
ReadingPaneStateByFormsManager = AddinExpress.OL.ADXOlReadingPaneLayout.Off
End Sub
Private Sub AdxOlFormsManager1_ADXReadingPaneMove(ByVal sender As System.Object, ByVal args As AddinExpress.OL.ReadingPaneMoveEventArgs) Handles AdxOlFormsManager1.ADXReadingPaneMove
ReadingPaneStateByFormsManager = args.ReadingPaneLayout
End Sub
Private Sub AdxOlFormsManager1_ADXReadingPaneShow(ByVal sender As System.Object, ByVal args As AddinExpress.OL.ReadingPaneShowEventArgs) Handles AdxOlFormsManager1.ADXReadingPaneShow
ReadingPaneStateByFormsManager = args.ReadingPaneLayout
End Sub
|