投稿日 | : 2007/03/06(Tue) 13:28 |
投稿者 | : ダンボ |
Eメール | : |
URL | : |
タイトル | : Re^2: -75000左 |
あっまだ終わってなかったんですね。下記汚いですけど、とりあえずは回避できます。
(SSTabの中にFlameがあって更にその中にあるコントロールは失敗する?)
(75000こそマジックナンバーと呼ぶべきだなぁ)
'-------Class1
Option Explicit
Public csControl As Control
Public csHideSSTab As Boolean
Public csLeft As Double
Public csTop As Double
Public csWidth As Double
Public csHeight As Double
Public csFontSize As Double
'-------Form1
Option Explicit
Private Clipped As Boolean
Private ctls As Collection
Private clpScaleWidth As Double
Private clpScaleHeight As Double
Private Function ClipControl()
'コントロールの現在の状態をクリップする
Dim ctl As Control
Dim ctlst As Class1
Set ctls = New Collection
clpScaleWidth = Me.ScaleWidth
clpScaleHeight = Me.ScaleHeight
For Each ctl In Me.Controls
Set ctlst = New Class1
With ctlst
Set .csControl = ctl
If (TypeOf ctl.Container Is SSTab) And (ctl.Left < 0) Then
.csHideSSTab = True
.csLeft = ctl.Left + 75000
Else
.csHideSSTab = False
.csLeft = ctl.Left
End If
.csTop = ctl.Top
.csWidth = ctl.Width
.csHeight = ctl.Height
On Error Resume Next
.csFontSize = ctl.FontSize
On Error GoTo 0
End With
Call ctls.Add(ctlst)
Next
Clipped = True
End Function
Private Sub Form_Load()
Call ClipControl
End Sub
Private Sub Form_Resize()
'クリップしたコントロールをリサイズする
Dim ctlst As Class1
Dim ratScaleWidth As Double
Dim ratScaleHeight As Double
If Clipped Then
On Error Resume Next
'水平、垂直方向の拡大率を決定する
ratScaleWidth = Me.ScaleWidth / clpScaleWidth
ratScaleHeight = Me.ScaleHeight / clpScaleHeight
'それぞれのコントロールを拡大する
For Each ctlst In ctls
With ctlst
If .csHideSSTab Then
.csControl.Left = .csLeft * ratScaleWidth - 75000
Else
.csControl.Left = .csLeft * ratScaleWidth
End If
.csControl.Top = .csTop * ratScaleHeight
.csControl.Width = .csWidth * ratScaleWidth
.csControl.Height = .csHeight * ratScaleHeight
.csControl.FontSize = .csFontSize * ratScaleWidth 'フォントサイズの拡大幅は適当です
End With
Next
End If
End Sub