tagCANDY CGI VBレスキュー(花ちゃん)の Visual Basic 6.0用 掲示板
VBレスキュー(花ちゃん)の Visual Basic 6.0用 掲示板
[ツリー表示へ]  [ワード検索]  [Home]

タイトル 所定の位置に「×」ではなく数字に置き換えるには?
投稿日: 2008/03/01(Sat) 22:55
投稿者tea
ある所定の位置に横1列に「×」もしくは「=」を7つ表示させるよう
にしてあるんですが、これを「×」の箇所のみを設定した時間から経過
した時間を引いて最初の1文字(例えば3など)を表示するようにした
いんです。

現状では以下のようなコードが思い浮かばないんです。

'チャージドタイムアウト時の残り時間
Public Function TimeOutMin()
Dim A As Integer
Dim b As Integer
Dim c As Integer

    A = Left(vsGameTime.Value / 60, 1)
    b = Game.Setting.QuarterMinutes
    
    c = b - A
    
End Function

「×」を表示するコードは

RScoreSheeetCommanderクラス内の以下の箇所にあります。
また関係するコードも記載します。

Option Explicit

Implements IPrintCommander
Private Type URunningScore

    ColWidth As Single
    RowHeight As Single
    MarginWidth As Single
    RowsInDivide As Long
End Type

Private Type URScoreSheetCommander
    Game As Game
    RunningScore As URunningScore
End Type

Private mp As URScoreSheetCommander

Private Sub drawTeam(ByVal PE As PrintEngine, _
                     ByVal Left As Single, ByVal Top As Single, _
                     ByVal LeftColWidth As Single, _
                     ByVal RightColWidth As Single, _
                     ByVal TeamFoulMarginWidth As Single, _
                     ByVal TeamFaulColWidth As Single, _
                     ByVal RowHeight As Single, _
                     ByVal TeamMarginHeight As Single)
    Dim i As Long
    Dim j As Long
    
    Dim ixTeam As Long
    Dim ixQuarter As BBQuarter
    Dim ixPlayer As Long
    Dim cRows As Long, cCols As Long
    Dim cLefts As Long, cRights As Long
    Dim ixCol As Long, ixRow As Long
    Dim ixCoach As Long, oCoach As Player
    
    Dim w As Single, h As Single
    Const cNameCols = 8
    
    With PE
        For ixTeam = 0 To 1
            '---チャージドタイムアウトの表示。-------------------------                  ixRow = ixRow + 1
            
        For i = bbTimeOutMin To bbTimeOutMax
                .DrawMatrixBox i, ixRow, 1, 1
                
                If mp.Game.Team(ixTeam).TimeOutted(i) Then
                  '---以下が「×」を表示するコードですが、.DrawMatrixCross
          の代わりに経過時間を表示させる。---
                    .DrawMatrixCross i, ixRow, 1, 1, colorByQuarter _
                    (mp.Game.Team(ixTeam).TimeOutted(i))
                Else
                    '「=」ダブルラインを表示する。
                    .DrawMatrixCenterDoubleLine i, ixRow, 1, 0.95, _
                     colorByQuarter(mp.Game.Team(ixTeam).TimeOutted(i))
                End If
                
            Next
            
.DrawMatrixCrossはPrintEngineクラス内に

Option Explicit

Private Type UMatrix
    Left As Single
    Top As Single
    CellWidth As Single
    CellHeight As Single
End Type
    
Private Type UPrintEngine
    Canvas As Object
    BlackAndWhite As Boolean
    Ratio As Single
    ScaleRight As Single
    ScaleBottom As Single
    
    XOffset As Single
    YOffset As Single
    
    Matrix As UMatrix
    
    LastForeColor As Long
    LastFont As StdFont
    LastDrawWidth As Long
    LastFillStyle As Long
    LastFillColor As Long
End Type

Private mp As UPrintEngine

Public Sub DrawMatrixCross(ByVal Col As Single, _
                           ByVal Row As Single, _
                           ByVal Cols As Single, _
                           ByVal Rows As Single, _
                           Optional ByVal Color As Variant = Empty)
    With makeMatrixRect(Col, Row, Cols, Rows)
        drawLine .Left, .Top, .Right, .Bottom, False, Color
        drawLine .Left, .Top, .Right, .Bottom, True, Color
    End With
  
End Sub

makeMatrixRectは同じクラス内にあり・・・
Private Function makeMatrixRect(ByVal Col As Single, _
                                ByVal Row As Single, _
                                ByVal Cols As Single, _
                                ByVal Rows As Single) As UPrintRectangle
    With mp.Matrix
        makeMatrixRect.Left = .Left + (Col - 1) * .CellWidth
        makeMatrixRect.Top = .Top + (Row - 1) * .CellHeight
        makeMatrixRect.Right = makeMatrixRect.Left + .CellWidth * Cols
        makeMatrixRect.Bottom = makeMatrixRect.Top + .CellHeight * Rows
    End With
End Function

以上なんですが、わかっていることは前述の.DrawMatrixCrossを置き換えること
で対処できると思うんですが、その方法がわかりません。

基礎的な事柄かもしれませんが教えてください。
よろしくお願いします。

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。