'''''' Where I launch form
' ft.Opacity = 0
ft.Show()
Application.DoEvents() 'ft.Hide()
ft.SetPanelText()
ft.SizeTabControl(0)
ft.Session0Dirty = False
' ft.Opacity = 100
'''''SizeTabControl(0) procedure code
For Each cnt1 As Control In spl.Panel1.Controls
If TypeOf cnt1 Is FarPoint.Win.Spread.FpSpread Then
Dim cnt As FarPoint.Win.Spread.FpSpread = CType(cnt1, FarPoint.Win.Spread.FpSpread)
cR.Cnt = cnt
If InStr(cnt.Name, "Rear") Or InStr(cnt.Name, "TiresR") Then
cnt.Left = 5
End If
cnt.BackColor = Color.Transparent
cnt.Sheets(0).DefaultStyle.BackColor = Color.Transparent
cnt.BorderStyle = BorderStyle.None
cnt.ActiveSheet.GrayAreaBackColor = Color.Transparent
If Not InStr(cnt.Name, "Front") Or Not InStr(cnt.Name, "Rear") Or Not InStr(cnt.Name, "Tires") Then
cR.ResizeControls(sw)
Else
iLeft = fpFront.Left + fpFront.Width
iSpaceAvail = fpRear.Left - iLeft
cR.ResizeMidControls(iSpaceAvail, iLeft, sw)
'iMidWidth = cnt.Width
'iMidLeft = cnt.Left
End If
End If
Next
For Each cnt1 As Control In spl.Panel2.Controls
If TypeOf cnt1 Is FarPoint.Win.Spread.FpSpread Then
Dim cnt As FarPoint.Win.Spread.FpSpread = CType(cnt1, FarPoint.Win.Spread.FpSpread)
cR.Cnt = cnt
If InStr(cnt.Name, "Rear") Then
cnt.Left = 5
End If
cnt.BackColor = Color.Transparent
cnt.Sheets(0).DefaultStyle.BackColor = Color.Transparent
cnt.BorderStyle = BorderStyle.None
cnt.ActiveSheet.GrayAreaBackColor = Color.Transparent
If Not InStr(cnt.Name, "Front") Or Not InStr(cnt.Name, "Rear") Or Not InStr(cnt.Name, "Tires") Then
cR.ResizeControls(sw)
Else
iLeft = fpFront.Left + fpFront.Width
iSpaceAvail = fpRear.Left - iLeft
cR.ResizeMidControls(iSpaceAvail, iLeft, sw)
'iMidWidth = cnt.Width
'iMidLeft = cnt.Left
End If
End If
Next
''''ResizeControls(sw) procedure
Public Sub ResizeControls(ByVal iSplitWidth As Integer)
Dim sw As Integer = iSplitWidth
Dim cnt As FarPoint.Win.Spread.FpSpread
If TypeOf mControl Is FarPoint.Win.Spread.FpSpread Then
cnt = mControl
sw = sw / 4
'w = sw / 6
'sw = sw - w
mControl.Width = sw - 10
If InStr(mControl.Name, "Front") Or InStr(mControl.Name, "TiresF") Then
Dim iLeft As Integer = (iSplitWidth - mControl.Width) - 10
mControl.Left = iLeft
End If
ResizeColumns()
End If
End Sub
''''ResizeColumns() procedure
Public Sub ResizeColumns()
Dim iTotSize As Integer
Dim iCol As Integer
Dim i As Integer
Dim iPad As Integer = 0
Dim iScrollWidth As Integer = 0
Dim cnt As FarPoint.Win.Spread.FpSpread
Dim iCntWidth As Integer = 0
Dim iColWidth As Integer = 0
If TypeOf mControl Is FarPoint.Win.Spread.FpSpread Then
cnt = mControl
iCntWidth = cnt.Width
i = cnt.ActiveSheet.RowHeader.Columns(0).Width
i = i + cnt.ActiveSheet.Columns(1).Width
'We have the width of the hidden and label column
iColWidth = iCntWidth - i
If cnt.ActiveSheet.ColumnCount - 1 > 2 Then
iColWidth = iColWidth / 2
End If
'iColWidth = iColWidth /
With cnt
Try
If InStr(mControl.Name, "Tires") Then
iTotSize = cnt.ActiveSheet.Columns(1).Width
iTotSize = cnt.Width - iTotSize
iTotSize = iTotSize / 2
'get the width of the column that has text
If (cnt.BorderStyle = BorderStyle.Fixed3D) Then
iPad = 4
End If
If (cnt.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.Always Or cnt.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded) Then
iScrollWidth = cnt.VerticalScrollBarWidth
End If
For iCol = 2 To cnt.ActiveSheet.Columns.Count - 1
cnt.ActiveSheet.Columns(iCol).Width = iTotSize - 10 'cnt.Width - (iTotSize + iPad + iScrollWidth) / 2
Next
Else
If (cnt.BorderStyle = BorderStyle.Fixed3D) Then
iPad = 4
iPad = iPad / 2
End If
If (cnt.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.Always Or cnt.VerticalScrollBarPolicy = FarPoint.Win.Spread.ScrollBarPolicy.AsNeeded) Then
iScrollWidth = cnt.VerticalScrollBarWidth
iScrollWidth = iScrollWidth / 2
End If
For iCol = 2 To cnt.ActiveSheet.Columns.Count - 1
'iTotSize += cnt.ActiveSheet.Columns(iCol).Width
''cnt.ActiveSheet.Columns(cnt.ActiveSheet.Columns.Count - 1).Width = cnt.Width - ((iTotSize + i + iPad + iScrollWidth) - (i / 3))
cnt.ActiveSheet.Columns(iCol).Width = iColWidth - iScrollWidth - iPad
Next
' cnt.ActiveSheet.Columns(cnt.ActiveSheet.Columns.Count - 1).Width = cnt.Width - ((iTotSize + i + iPad + iScrollWidth) - (i / 3))
End If
Catch ex As Exception
End Try
End With
End If
End Sub
|