VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   12315
   ClientLeft      =   225
   ClientTop       =   555
   ClientWidth     =   17760
   LinkTopic       =   "Form1"
   ScaleHeight     =   12315
   ScaleWidth      =   17760
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox a 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   810
      Index           =   16
      Left            =   9240
      Picture         =   "Koder.frx":0000
      ScaleHeight     =   810
      ScaleWidth      =   825
      TabIndex        =   26
      Top             =   6840
      Width           =   820
   End
   Begin VB.PictureBox a 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2260
      Index           =   14
      Left            =   7080
      Picture         =   "Koder.frx":043C
      ScaleHeight     =   2265
      ScaleWidth      =   855
      TabIndex        =   24
      Top             =   4320
      Width           =   855
   End
   Begin VB.CommandButton copys 
      Caption         =   "Kopírovat"
      Height          =   315
      Left            =   3480
      TabIndex        =   9
      Top             =   4440
      Width           =   1215
   End
   Begin VB.Frame Frame2 
      Caption         =   "Sedmisegment"
      Height          =   9375
      Left            =   120
      TabIndex        =   1
      Top             =   0
      Width           =   4695
      Begin VB.OptionButton alfanum 
         Caption         =   "Sedmisegment"
         Height          =   375
         Left            =   2640
         TabIndex        =   28
         Top             =   2040
         Value           =   -1  'True
         Width           =   1455
      End
      Begin VB.OptionButton o1 
         Caption         =   "Sedmisegment"
         Height          =   375
         Left            =   2640
         TabIndex        =   27
         Top             =   1560
         Width           =   1455
      End
      Begin VB.Timer tims 
         Interval        =   200
         Left            =   3120
         Top             =   3360
      End
      Begin VB.TextBox datas 
         Height          =   4365
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   8
         Top             =   4920
         Width           =   4335
      End
      Begin VB.CommandButton pridats 
         Caption         =   "Přidat"
         Height          =   315
         Left            =   720
         TabIndex        =   7
         Top             =   4440
         Width           =   1095
      End
      Begin VB.TextBox znaks 
         Height          =   285
         Left            =   120
         TabIndex        =   6
         Top             =   4440
         Width           =   495
      End
      Begin VB.PictureBox sedmipoz 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   4095
         Left            =   120
         ScaleHeight     =   4095
         ScaleWidth      =   2175
         TabIndex        =   4
         Top             =   240
         Width           =   2175
         Begin VB.PictureBox sedmi 
            BackColor       =   &H00000000&
            BorderStyle     =   0  'None
            Height          =   375
            Index           =   0
            Left            =   0
            ScaleHeight     =   375
            ScaleWidth      =   375
            TabIndex        =   5
            Top             =   0
            Visible         =   0   'False
            Width           =   375
         End
      End
      Begin VB.CommandButton Command1 
         Caption         =   "Vymazat"
         Height          =   315
         Left            =   1920
         TabIndex        =   2
         Top             =   4440
         Width           =   1335
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Alfanumerický"
      Height          =   9615
      Left            =   5040
      TabIndex        =   0
      Top             =   0
      Width           =   6255
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2260
         Index           =   15
         Left            =   1200
         Picture         =   "Koder.frx":0AB3
         ScaleHeight     =   2265
         ScaleWidth      =   855
         TabIndex        =   23
         Top             =   4320
         Width           =   855
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2240
         Index           =   10
         Left            =   1800
         Picture         =   "Koder.frx":11EF
         ScaleHeight     =   2235
         ScaleWidth      =   795
         TabIndex        =   21
         Top             =   1080
         Width           =   800
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2260
         Index           =   11
         Left            =   2640
         Picture         =   "Koder.frx":18B7
         ScaleHeight     =   2265
         ScaleWidth      =   855
         TabIndex        =   20
         Top             =   1080
         Width           =   855
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   565
         Index           =   9
         Left            =   2760
         Picture         =   "Koder.frx":1F2E
         ScaleHeight     =   570
         ScaleWidth      =   1455
         TabIndex        =   19
         Top             =   3480
         Width           =   1455
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   580
         Index           =   8
         Left            =   1320
         Picture         =   "Koder.frx":2403
         ScaleHeight     =   585
         ScaleWidth      =   1575
         TabIndex        =   18
         Top             =   3480
         Width           =   1575
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   3000
         Index           =   6
         Left            =   360
         Picture         =   "Koder.frx":28DD
         ScaleHeight     =   3000
         ScaleWidth      =   915
         TabIndex        =   16
         Top             =   3720
         Width           =   920
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   600
         Index           =   5
         Left            =   2040
         Picture         =   "Koder.frx":30CE
         ScaleHeight     =   600
         ScaleWidth      =   1575
         TabIndex        =   15
         Top             =   6720
         Width           =   1575
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   715
         Index           =   4
         Left            =   480
         Picture         =   "Koder.frx":35B8
         ScaleHeight     =   720
         ScaleWidth      =   1575
         TabIndex        =   14
         Top             =   6600
         Width           =   1575
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   548
         Index           =   1
         Left            =   3240
         Picture         =   "Koder.frx":3ABF
         ScaleHeight     =   555
         ScaleWidth      =   1575
         TabIndex        =   11
         Top             =   360
         Width           =   1575
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   565
         Index           =   0
         Left            =   1680
         Picture         =   "Koder.frx":3F7F
         ScaleHeight     =   570
         ScaleWidth      =   1575
         TabIndex        =   10
         Top             =   360
         Width           =   1575
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Vymazat"
         Height          =   375
         Left            =   1320
         TabIndex        =   3
         Top             =   8880
         Width           =   1335
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2970
         Index           =   2
         Left            =   4080
         Picture         =   "Koder.frx":4432
         ScaleHeight     =   2970
         ScaleWidth      =   915
         TabIndex        =   12
         Top             =   600
         Width           =   920
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   3000
         Index           =   7
         Left            =   840
         Picture         =   "Koder.frx":4C1D
         ScaleHeight     =   3000
         ScaleWidth      =   915
         TabIndex        =   17
         Top             =   600
         Width           =   920
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   3000
         Index           =   3
         Left            =   3600
         Picture         =   "Koder.frx":53FF
         ScaleHeight     =   3000
         ScaleWidth      =   915
         TabIndex        =   13
         Top             =   3960
         Width           =   920
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2260
         Index           =   12
         Left            =   3360
         Picture         =   "Koder.frx":5BEB
         ScaleHeight     =   2265
         ScaleWidth      =   975
         TabIndex        =   22
         Top             =   1080
         Width           =   975
      End
      Begin VB.PictureBox a 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   2220
         Index           =   13
         Left            =   2880
         Picture         =   "Koder.frx":636E
         ScaleHeight     =   2220
         ScaleWidth      =   855
         TabIndex        =   25
         Top             =   4320
         Width           =   855
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sirka As Integer
Dim vyska As Integer
Dim mezera As Integer

Dim sedmis(1 To 8) As Integer
Dim alfa(1 To 17) As Integer

Private Sub a_Click(Index As Integer)
    If alfa(Index + 1) = 0 Then
        alfa(Index + 1) = 1
        a(Index).BackColor = vbRed
    Else
        alfa(Index + 1) = 0
        a(Index).BackColor = RGB(0, 0, 0)
    End If
End Sub

Private Sub Command1_Click()
    Dim i As Integer
    For i = 1 To 8
        sedmis(i) = 1
        sedmi_Click (i)
    Next
End Sub

Private Sub Command2_Click()
    Dim i As Integer
    For i = 1 To 17
        alfa(i) = 1
        a_Click i - 1
    Next
End Sub

Private Sub copys_Click()
    Clipboard.Clear
    Clipboard.SetText datas.Text
End Sub

Private Sub Form_Load()
    Show
    sirka = 12
    vyska = 40
    mezera = 4
    
    sirka = sirka * Screen.TwipsPerPixelX
    vyska = vyska * Screen.TwipsPerPixelX
    mezera = mezera * Screen.TwipsPerPixelX
    
    vytvorSedmi
    
    'alfa
    Dim i As Integer
    
    For i = 1 To 17
        alfa(i) = 1
        a_Click i - 1
    Next
        
End Sub

Private Sub vytvorSedmi()
    Dim i As Integer
    
    For i = 1 To 8
        sedmis(i) = 0
        Load sedmi(i)
        sedmi(i).Visible = True
        sedmi(i).Move 0, 0, sirka, sirka
    Next
    
    sedmi(1).Width = vyska
    sedmi(4).Width = vyska
    sedmi(7).Width = vyska
    
    sedmi(2).Height = vyska
    sedmi(3).Height = vyska
    
    sedmi(5).Height = vyska
    sedmi(6).Height = vyska
    '
    sedmi(1).Left = sirka + mezera
    sedmi(4).Left = sedmi(1).Left
    sedmi(7).Left = sedmi(1).Left
    
    sedmi(2).Left = vyska + 2 * mezera + sirka
    sedmi(3).Left = sedmi(2).Left
    '
    sedmi(2).Top = sirka
    sedmi(6).Top = sedmi(2).Top
    '
    sedmi(3).Top = vyska + mezera + sirka
    sedmi(5).Top = sedmi(3).Top
    sedmi(7).Top = sedmi(3).Top - sirka / 2
    '
    sedmi(4).Top = 2 * vyska + mezera + sirka
    '
    sedmi(8).Top = sedmi(4).Top
    sedmi(8).Left = sedmi(2).Left + sirka + mezera
    '
    sedmipoz.Width = sedmi(8).Left + sirka
    sedmipoz.Height = sedmi(8).Top + sirka
End Sub

Private Sub pridats_Click()
    Dim s As String
    Dim i As Integer
    
    If o1.Value = True Then
        s = "#define led7" + znaks.Text + " B"
                
        For i = 1 To 8
            s = s & sedmis(i)
        Next
        
    Else
        s = "#define alfa16" + znaks.Text + " "
        Dim q As Long
        q = 0
                
        For i = 1 To 17
            q = q * 2 + alfa(i)
        Next
        s = s & q & "L"
    
    End If
    datas = datas & s & vbCrLf
End Sub

Private Sub sedmi_Click(Index As Integer)
    
    If sedmis(Index) = 0 Then
        sedmis(Index) = 1
        sedmi(Index).BackColor = vbRed
    Else
        sedmis(Index) = 0
        sedmi(Index).BackColor = RGB(0, 0, 0)
    End If
    
End Sub

Private Sub tims_Timer()
    tims.Enabled = False
    znaks.SetFocus
End Sub

Private Sub znaks_GotFocus()
    On Error Resume Next
    znaks.SelStart = 0
    znaks.SelLength = 1
End Sub

Private Sub znaks_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then pridats_Click
    
    znaks_GotFocus
End Sub

Private Sub znaks_LostFocus()
    tims.Enabled = True
End Sub
