Common: Add SplitContainerBuilder
This commit is contained in:
parent
eba52bbcd8
commit
5172f1643e
@ -209,6 +209,7 @@
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ObjectPropertyDialog\AttributeControls.vb" />
|
||||
<Compile Include="SplitContainerBuilder.vb" />
|
||||
<Compile Include="SQLEditor\Placeholder.vb" />
|
||||
<Compile Include="SQLEditor\Placeholders.vb" />
|
||||
<Compile Include="SQLEditor\SQLSyntaxHighlightService.vb" />
|
||||
|
||||
80
GUIs.Common/SplitContainerBuilder.vb
Normal file
80
GUIs.Common/SplitContainerBuilder.vb
Normal file
@ -0,0 +1,80 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports DevExpress.XtraBars.Ribbon
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class SplitContainerBuilder
|
||||
Inherits BaseClass
|
||||
|
||||
Private LastWindowState As FormWindowState = FormWindowState.Normal
|
||||
Private SplitContainer As SplitContainerControl
|
||||
Private WithEvents Form As Form
|
||||
|
||||
Private Const BIG_SIDEPANEL_LIMIT = 0.55
|
||||
Private Const SMALL_SIDEPANEL_LIMIT = 0.9
|
||||
Private Const RESIZE_FACTOR_HORIZONTAL = 0.7
|
||||
Private Const RESIZE_FACTOR_VERTICAL = 0.4
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pForm As Form, pSplitContainer As SplitContainerControl)
|
||||
MyBase.New(pLogConfig)
|
||||
Form = pForm
|
||||
SplitContainer = pSplitContainer
|
||||
End Sub
|
||||
|
||||
Public Sub InitAutoResize()
|
||||
AddHandler Form.Resize, AddressOf Form_Resize
|
||||
AddHandler Form.ResizeEnd, AddressOf Form_ResizeEnd
|
||||
End Sub
|
||||
|
||||
Private Sub Form_ResizeEnd(sender As Object, e As EventArgs)
|
||||
ResizePanel()
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Resize(sender As Object, e As EventArgs)
|
||||
If LastWindowState <> Form.WindowState Then
|
||||
LastWindowState = Form.WindowState
|
||||
ResizePanel()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ResizePanel()
|
||||
Dim oWindowDimension As Integer
|
||||
Dim oResizeFactor As Double
|
||||
Dim oSplitterPosition As Integer = SplitContainer.SplitterPosition
|
||||
Dim oPlaceholdersExpanded As Boolean = Not SplitContainer.Collapsed
|
||||
|
||||
If SplitContainer.Horizontal Then
|
||||
oWindowDimension = Form.Width
|
||||
oResizeFactor = RESIZE_FACTOR_HORIZONTAL
|
||||
Else
|
||||
oWindowDimension = Form.Height
|
||||
oResizeFactor = RESIZE_FACTOR_VERTICAL
|
||||
|
||||
' Factor in the height of the RibbonControl
|
||||
If TypeOf Form Is RibbonForm Then
|
||||
oWindowDimension -= 160
|
||||
End If
|
||||
End If
|
||||
|
||||
If oSplitterPosition > (oWindowDimension * SMALL_SIDEPANEL_LIMIT) Then
|
||||
' Very small Sidepanel
|
||||
'----------------,----
|
||||
'| | |
|
||||
'| main panel |sp|
|
||||
'| | |
|
||||
'---------------------
|
||||
oSplitterPosition = oWindowDimension * oResizeFactor
|
||||
ElseIf oSplitterPosition < (oWindowDimension * BIG_SIDEPANEL_LIMIT) Then
|
||||
' Very big Sidepanel
|
||||
'----------,----------
|
||||
'| | |
|
||||
'|mp| side panel |
|
||||
'| | |
|
||||
'---------------------
|
||||
oSplitterPosition = oWindowDimension * oResizeFactor
|
||||
End If
|
||||
|
||||
SplitContainer.SplitterPosition = oSplitterPosition
|
||||
End Sub
|
||||
End Class
|
||||
Loading…
x
Reference in New Issue
Block a user