掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
横にスクロール (ID:78730)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
MSFlexでもMSHFlexでも Width(ColWidthの合計)が245745twip以下なら 表示すると思いますが? Option Explicit Private Const cUSEFLEX As String = "HFLex" '←"HFlex"にすればHFlexを表示 Private Const clngCOLMAX As Long = 11 Dim WithEvents Flex1 As MSFlexGridLib.MSFlexGrid Dim WithEvents HFlex1 As MSHierarchicalFlexGridLib.MSHFlexGrid Dim WithEvents Pic1 As PictureBox Dim WithEvents HScr1 As HScrollBar Dim WithEvents VScr1 As VScrollBar Dim mobjFlex As Object Dim mlngScaleH As Long Dim mlngScaleV As Long Private Function fncSetText() As String Dim i As Long Dim lngLen As Long lngLen = (2 ^ (clngCOLMAX - 1)) + 100 Dim buff As String buff = Space(lngLen + 4) For i = 0 To lngLen Step 4 Mid(buff, i + 1, 4) = Right("000" & CStr(i), 3) & "," Next fncSetText = buff End Function Private Sub SetFlex(obj As Object, strText As String) Dim i As Long Dim j As Long Dim strBuf As String Dim lngWidthBuf As Long With obj Set .Font = Me.Font .Cols = clngCOLMAX .Rows = 100 .FixedCols = 1 .FixedRows = 1 lngWidthBuf = 350 .Height = .RowHeight(0) * .Rows + lngWidthBuf For i = 0 To .Cols - 1 strBuf = Left(strText, 2 ^ i + 10) .ColWidth(i) = Me.TextWidth(strBuf & "A") lngWidthBuf = lngWidthBuf + .ColWidth(i) .TextMatrix(0, i) = "フィールド" & CStr(i) For j = 1 To .Rows - 1 If i = 0 Then .TextMatrix(j, i) = j Else .TextMatrix(j, i) = strBuf End If Next Next .Width = lngWidthBuf .TextMatrix(0, 0) = .Name End With End Sub Private Sub Form_Load() ' Dim i As Long ' Dim j As Long Dim strText As String ' Dim strBuf As String ' Dim lngWidthBuf As Long Set Pic1 = Me.Controls.Add("VB.PictureBox", "Pic1") Set Flex1 = Me.Controls.Add("MSFlexGridLib.MSFlexGrid", "Flex1", Pic1) Set HFlex1 = Me.Controls.Add("MSHierarchicalFlexGridLib.MSHFlexGrid", "HFlex1", Pic1) Set HScr1 = Me.Controls.Add("VB.HScrollBar", "HScr1") Set VScr1 = Me.Controls.Add("VB.VScrollBar", "VScr1") strText = fncSetText() With Pic1 .Width = Me.ScaleWidth - HScr1.Height .Height = Me.ScaleHeight - VScr1.Width .Left = 0 .Top = 0 .Visible = True End With Call SetFlex(Flex1, strText) Call SetFlex(HFlex1, strText) With HScr1 .Width = Pic1.Width .Left = Pic1.Left .Top = Pic1.Height mlngScaleH = ((Flex1.Width - Pic1.Width) \ 32768) + 1 .Max = ((Flex1.Width - Pic1.Width) \ mlngScaleH) + 1 .LargeChange = Pic1.Width \ mlngScaleH .SmallChange = 1 .Visible = True End With With VScr1 .Height = Pic1.Height .Left = Pic1.Width .Top = Pic1.Top mlngScaleV = ((Flex1.Height - Pic1.Height) \ 32768) + 1 .Max = ((Flex1.Height - Pic1.Height) \ mlngScaleV) + 1 .LargeChange = Pic1.Height \ mlngScaleV .SmallChange = 1 .Visible = True End With If cUSEFLEX = "FLex" Then Set mobjFlex = Flex1 Else Set mobjFlex = HFlex1 End If mobjFlex.Visible = True End Sub Private Sub HScr1_Change() mobjFlex.Left = -HScr1.Value * mlngScaleH End Sub Private Sub VScr1_Change() mobjFlex.Top = -VScr1.Value * mlngScaleV End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.