home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "CDraw" Attribute VB_Creatable = False Attribute VB_Exposed = False Option Explicit ' ' Pictures painted in various places, set by owndraw.drm ' Public m_Picture1 As PictureBox Public m_Picture2 As PictureBox Public m_Picture3 As PictureBox Public m_Picture4 As PictureBox Public Function IMCaptionPaint_CaptionHeight(height As Integer) As Boolean ' ' List/X+ control needs to know the caption height ' m_Picture2.ScaleMode = Pixel height = m_Picture2.ScaleHeight + 3 ' ' Let the control know that the return value is valid ' IMCaptionPaint_CaptionHeight = True End Function Public Function IMListPaint_ItemHeight(ByVal itemnum As Long, height As Integer) As Boolean If (itemnum >= 0) Then ' ' List height ' m_Picture1.ScaleMode = Pixel height = m_Picture1.ScaleHeight Else ' ' Heading height ' m_Picture3.ScaleMode = Pixel height = m_Picture3.ScaleHeight End If IMListPaint_ItemHeight = True End Function Public Function IMCaptionPaint_PaintCaption(ByVal MPicture As MabryCtl.IMPicture) As Boolean Dim h As Integer Dim w As Integer Dim x As Integer Dim y As Integer Dim s As String s = "List/X+ Rules" MPicture.ScaleMode = Pixel MPicture.PaintPicture m_Picture2.Picture, 0, 2, 24, 24 h = MPicture.TextHeight(s) w = MPicture.TextWidth(s) x = 32 y = (MPicture.ScaleHeight - h) / 2 MPicture.FontTransparent = True MPicture.ForeColor = RGB(255, 255, 255) MPicture.DrawText s, x - 1, y - 1, x + w - 1, y + h - 1, 0 MPicture.ForeColor = RGB(128, 128, 128) MPicture.DrawText s, x + 1, y + 1, x + w + 1, y + h + 1, 0 MPicture.ForeColor = RGB(0, 0, 0) MPicture.DrawText s, x, y, x + w, y + h, 0 IMCaptionPaint_PaintCaption = True End Function Public Function IMListPaint_PaintColumn(ByVal MPicture As MabryCtl.IMPicture, ByVal Item As Long, ByVal Column As Long, ByVal Selected As Boolean) As Boolean Dim s As String Dim h As Integer Dim w As Integer Dim x As Integer Dim y As Integer MPicture.ScaleMode = Pixel ' ' Handle headings here ' If (Item = -1) Then Select Case Column Case 0: IMListPaint_PaintColumn = True Case 1: s = "Text && Graphics!" MPicture.ScaleMode = Pixel h = MPicture.TextHeight(s) w = MPicture.TextWidth(s) x = 0 y = (MPicture.ScaleHeight - h) / 2 MPicture.DrawText s, x, y, x + w, y + h, 0 m_Picture4.ScaleMode = Pixel MPicture.PaintPicture m_Picture4.Picture, MPicture.ScaleWidth - m_Picture4.ScaleWidth, 0, m_Picture4.ScaleWidth, m_Picture4.ScaleHeight IMListPaint_PaintColumn = True Case 2: MPicture.PaintPicture m_Picture3.Picture, 0, 0, 20, 23 IMListPaint_PaintColumn = True Case Else IMListPaint_PaintColumn = False End Select Exit Function End If ' ' Painting the list itself ' IMListPaint_PaintColumn = True Select Case Column Case 0: ' ' stretchs to fit column ' MPicture.PaintPicture m_Picture1.Picture, 0, 0 ' ' no stretch ' ' MPicture.PaintPicture Picture1.Picture, 0, 0, 32, 32 Case 1: MPicture.Font = m_Picture1.Font If (Selected) Then MPicture.ForeColor = RGB(255, 192, 0) Else MPicture.ForeColor = RGB(0, 128, 0) End If If (Item Mod 3) = 0 Then MPicture.DrawText "Cool!", 0, 0, MPicture.ScaleWidth, MPicture.ScaleHeight, tfSingleLine Or tfVertCenter Or tfCenter Else MPicture.DrawText "Line " & CStr(Item), 0, 0, MPicture.ScaleWidth, MPicture.ScaleHeight, tfSingleLine Or tfVertCenter Or tfCenter End If Case 2: MPicture.CurrentX = 0 MPicture.CurrentY = 0 MPicture.FillStyle = Item Mod 8 MPicture.FillColor = RGB(0, 0, 192) MPicture.ForeColor = RGB(0, 0, 192) MPicture.Line -Step(MPicture.ScaleWidth, MPicture.ScaleHeight), , BF Case Else IMListPaint_PaintColumn = False End Select End Function