home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / A_Deal_or_20275610292006.psc / Display_KF.ctl < prev   
Text File  |  2006-10-25  |  6KB  |  210 lines

  1. VERSION 5.00
  2. Begin VB.UserControl Display 
  3.    ClientHeight    =   870
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   4800
  7.    BeginProperty Font 
  8.       Name            =   "Verdana"
  9.       Size            =   24
  10.       Charset         =   0
  11.       Weight          =   700
  12.       Underline       =   0   'False
  13.       Italic          =   0   'False
  14.       Strikethrough   =   0   'False
  15.    EndProperty
  16.    ScaleHeight     =   870
  17.    ScaleWidth      =   4800
  18.    Begin VB.PictureBox Display 
  19.       AutoRedraw      =   -1  'True
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   400
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   600
  30.       Left            =   0
  31.       ScaleHeight     =   36
  32.       ScaleMode       =   3  'Pixel
  33.       ScaleWidth      =   307
  34.       TabIndex        =   0
  35.       Top             =   0
  36.       Width           =   4665
  37.    End
  38. End
  39. Attribute VB_Name = "Display"
  40. Attribute VB_GlobalNameSpace = False
  41. Attribute VB_Creatable = True
  42. Attribute VB_PredeclaredId = False
  43. Attribute VB_Exposed = False
  44. Option Explicit
  45.  
  46. Public Enum BorderStyles
  47. None = 0
  48. Fixed = 1
  49. End Enum
  50.  
  51. Const m_def_BackgroundColor = vbBlue
  52. Const m_def_TextColor = vbYellow
  53. Const m_def_GridColor = &HC00000
  54. Const m_def_Border = None
  55. Const m_def_FontBold = True
  56.  
  57. Dim m_BackgroundColor As OLE_COLOR
  58. Dim m_TextColor As OLE_COLOR
  59. Dim m_GridColor As OLE_COLOR
  60. Dim m_Text As String
  61. Dim m_Font As StdFont
  62. Dim m_Border As BorderStyles
  63. Dim m_FontBold As Boolean
  64.  
  65. Private Sub UserControl_Initialize()
  66.    Set Font = UserControl.Font
  67.    TextColor = m_def_TextColor
  68.    BackgroundColor = m_def_BackgroundColor
  69.    Border = Fixed
  70.    GridColor = m_def_GridColor
  71. End Sub
  72.  
  73. Private Sub UserControl_InitProperties()
  74.     m_Text = Extender.Name
  75.     m_FontBold = m_def_FontBold
  76.     m_Border = m_def_Border
  77.     m_BackgroundColor = m_def_BackgroundColor
  78.     m_GridColor = m_def_GridColor
  79. End Sub
  80.  
  81. Public Property Get BackgroundColor() As OLE_COLOR
  82.    BackgroundColor = m_BackgroundColor
  83. End Property
  84.  
  85. Public Property Let BackgroundColor(NewBackgroundColor As OLE_COLOR)
  86.    m_BackgroundColor = NewBackgroundColor
  87.    PropertyChanged "BackgroundColor"
  88.    Display.BackColor = m_BackgroundColor
  89.    Draw
  90. End Property
  91.  
  92. Public Property Get Border() As BorderStyles
  93.    Border = m_Border
  94. End Property
  95.  
  96. Public Property Let Border(NewBorder As BorderStyles)
  97.    m_Border = NewBorder
  98.    PropertyChanged "Border"
  99.    Display.BorderStyle = m_Border
  100.    Draw
  101. End Property
  102.  
  103. Public Property Get FontBold() As Boolean
  104.    FontBold = m_FontBold
  105. End Property
  106.  
  107. Public Property Let FontBold(NewFontBold As Boolean)
  108.    m_FontBold = NewFontBold
  109.    PropertyChanged "FontBold"
  110.     If FontBold = True Then
  111.       Font.Bold = True
  112.    Else
  113.       Font.Bold = False
  114.    End If
  115.    Draw
  116. End Property
  117. Public Property Get TextColor() As OLE_COLOR
  118.    TextColor = m_TextColor
  119. End Property
  120.  
  121. Public Property Let TextColor(NewTextColor As OLE_COLOR)
  122.    m_TextColor = NewTextColor
  123.    PropertyChanged "TextColor"
  124.    Draw
  125. End Property
  126.  
  127. Public Property Get GridColor() As OLE_COLOR
  128.    GridColor = m_GridColor
  129. End Property
  130.  
  131. Public Property Let GridColor(NewGridColor As OLE_COLOR)
  132.    m_GridColor = NewGridColor
  133.    PropertyChanged "GridColor"
  134.    Draw
  135. End Property
  136.  
  137. Public Property Get Text() As String
  138.    Text = m_Text
  139. End Property
  140.  
  141. Public Property Let Text(NewText As String)
  142.    m_Text = NewText
  143.    PropertyChanged "Text"
  144.    Draw
  145. End Property
  146.  
  147. Public Property Get Font() As StdFont
  148.    Set Font = m_Font
  149. End Property
  150.  
  151. Public Property Set Font(ByRef NewFont As StdFont)
  152.    Set m_Font = NewFont
  153.    PropertyChanged "Font"
  154.    Display.Font = NewFont
  155.    If Font.Bold = True Then
  156.       FontBold = True
  157.    Else
  158.       FontBold = False
  159.    End If
  160.    Draw
  161. End Property
  162.  
  163. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  164.    BackgroundColor = PropBag.ReadProperty("BackgroundColor", m_def_BackgroundColor)
  165.    Border = PropBag.ReadProperty("Border", m_def_Border)
  166.    TextColor = PropBag.ReadProperty("TextColor", m_def_TextColor)
  167.    GridColor = PropBag.ReadProperty("GridColor", m_def_GridColor)
  168.    Text = PropBag.ReadProperty("Text", Extender.Name)
  169.    Set Font = PropBag.ReadProperty("Font", UserControl.Font)
  170.    FontBold = PropBag.ReadProperty("FontBold", m_def_FontBold)
  171. End Sub
  172.  
  173. Private Sub UserControl_Resize()
  174.     Display.Width = UserControl.Width
  175.     Display.Height = UserControl.Height
  176.     Draw
  177. End Sub
  178.  
  179. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  180.    With PropBag
  181.    Call .WriteProperty("BackgroundColor", m_BackgroundColor, m_def_BackgroundColor)
  182.    Call .WriteProperty("Border", m_Border, m_def_Border)
  183.    Call .WriteProperty("TextColor", m_TextColor, m_def_TextColor)
  184.    Call .WriteProperty("GridColor", m_GridColor, m_def_GridColor)
  185.    Call .WriteProperty("Text", m_Text, Extender.Name)
  186.    Call .WriteProperty("Font", m_Font, UserControl.Font)
  187.    Call .WriteProperty("FontBold", m_FontBold, m_def_FontBold)
  188.    End With
  189. End Sub
  190.  
  191. Private Sub Draw()
  192. Dim x As Integer
  193. Dim y As Integer
  194.  
  195. Display.Cls                                                          ' clear for next text message
  196. Display.CurrentX = 2                                             ' positions where the text is displayed
  197. Display.CurrentY = -4
  198. Display.Font.Bold = Font.Bold
  199. Display.FontSize = Font.Size
  200. Display.ForeColor = TextColor                                ' display text color
  201. Display.Print Text
  202. ' Draw the grid lines
  203. For x = 0 To Display.Height Step 2
  204.    Display.FE    = 0 To T_Backgroueerid .Writ"
  205.  T_BackgrouStrit"
  206. Grid xStrit"
  207. t cologroueerid .Writ"
  208.  Tlhere the text is lSag As PropertyBag)
  209.    WCWeaoxt)
  210.    WCtri