Окно со шторами - VB

Формулировка задачи:

Используя элемент управления изобразить окно со шторами, цвет которых пользователь выбирает из списка. Шторы розсуваються и сдвигаются с помощью командной кнопки. Очень надо. СПАСИБО!!!

Код к задаче: «Окно со шторами - VB»

textual
Const dt = 2
Dim tr As Boolean
 
 
Private Sub Timer1_Timer()
Call Tim(Timer1, 40 + dt, -1, 40, 40, Picture1.Width - 40)
End Sub
Private Sub Timer2_Timer()
Call Tim(Timer2, Picture1.Width / 2, 1, Picture1.Width / 2, Picture1.Width / 2 + dt, Picture1.Width / 2 - dt)
End Sub
 
Private Sub Combo1_Click()
Call stor(Picture2.ScaleWidth, Picture2)
Call stor(0, Picture3)
End Sub
 
 
 
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call r
End Sub
 
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call r
End Sub
 
Private Sub Command2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Timer1.Enabled = True Then
Timer1.Enabled = False
tr = Not (tr)
End If
If Timer2.Enabled = True Then
Timer2.Enabled = False
tr = Not (tr)
End If
End Sub
 
Private Sub Form_Load()
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Picture2.ScaleMode = 3
Picture3.ScaleMode = 3
Picture2.Width = Picture1.Width / 2
Picture3.Width = Picture1.Width / 2
Picture2.Left = 0
Picture3.Left = Picture1.Width / 2
 
Combo1.AddItem "çåëåГ*ûé"
Combo1.AddItem "æåëòûé"
Combo1.AddItem "ôèîëåòîâûé"
Combo1.AddItem "Г±ГЁГ*ГЁГ©"
Combo1.AddItem "îðГ*Г*æåâûé"
Combo1.AddItem "ГЄГ°Г*Г±Г*ûé"
Combo1.ListIndex = 0
Call stor(Picture2.ScaleWidth, Picture2)
Call stor(0, Picture3)
End Sub
 
Private Sub r()
tr = Not (tr)
If tr Then
Timer2.Enabled = False
Timer1.Enabled = True
Else
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Tim(tr As Timer, lim%, napr%, w2%, w3%, l3%)
If Picture2.Width * napr <= lim * napr Then
Picture2.Width = Picture2.Width + dt * napr
Picture3.Left = Picture3.Left - dt * napr
Picture3.Width = Picture3.Width + dt * napr
Else
Picture2.Width = w2
Picture3.Width = w3
Picture3.Left = l3
Timer2.Enabled = False
End If
Call stor(Picture2.ScaleWidth, Picture2)
Call stor(0, Picture3)
End Sub
Private Sub stor(b As Integer, pic As PictureBox)
  For i = 1 To pic.ScaleWidth + dt
    For j = 1 To 2 * pic.ScaleHeight Step pic.ScaleHeight
   c = Abs((b - i) / pic.ScaleWidth) * 255
 Select Case Combo1.ListIndex
  Case 0
  c = RGB(0, c, 0)
   Case 1
    c = RGB(c, c, 0)
   Case 2
   c = RGB(125, c, 255)
   Case 3
   c = RGB(0, c, 255)
   Case 4
  c = RGB(255, c, 0)
 End Select
   pic.Line (i, 0 + Cos(i))-(i, j), 10 * c
  Next
    Next
End Sub

14   голосов, оценка 3.714 из 5


СОХРАНИТЬ ССЫЛКУ