Advertisement
kon9wa88

gr2

Apr 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  4.         Dim x, y, h, l, hf As Single : x = 50 : y = 100 : h = 80
  5.         Dim x1, y1, h1 As Single : x1 = 50 : y1 = 500 : h1 = 20
  6.         Dim i, n, n1 As Integer
  7.         l = Me.Width
  8.         hf = Me.Height
  9.         nebo(hf)
  10.         zem(hf)
  11.         n = Val(InputBox("kol-vo der"))
  12.         n1 = Val(InputBox("kol-vo gribov"))
  13.         h = l / n
  14.         For i = 1 To n
  15.  
  16.             der(x, y, h, l, hf)
  17.             x = x + 200
  18.         Next
  19.  
  20.         For i = 1 To n1
  21.             gr(x1, y1, h1, l, hf)
  22.             x1 = x1 + 200
  23.         Next
  24.  
  25.     End Sub
  26. End Class
  27. --------------------------------------------------------------------
  28. Imports System.Drawing
  29. Module Module1
  30.     Dim g As Graphics
  31.     Dim b1 As New SolidBrush(Color.Green) 'trava
  32.    Dim b2 As New SolidBrush(Color.Aqua) ' nebo
  33.    Dim b3 As New SolidBrush(Color.SaddleBrown) 'stvol
  34.    Dim b4 As New SolidBrush(Color.GreenYellow) 'list
  35.    Dim b5 As New SolidBrush(Color.SandyBrown) 'nozki
  36.    Dim b6 As New SolidBrush(Color.RosyBrown) 'shlyapa
  37.  
  38.     Public Sub nebo(ByVal h As Single)
  39.         g = Form1.CreateGraphics
  40.         g.FillRectangle(b2, 0, 0, h * 150, h * 150)
  41.     End Sub
  42.  
  43.     Public Sub zem(ByVal h As Single)
  44.         g = Form1.CreateGraphics
  45.         g.FillRectangle(b1, 0, h / 3, h * 150, h * 150)
  46.     End Sub
  47.  
  48.     Public Sub der(ByVal x As Single, ByVal y As Single, ByVal h As Single, ByVal l As Single, ByVal hf As Single)
  49.         g = Form1.CreateGraphics
  50.         g.FillRectangle(b3, x + h / 3, y + h / 2, h / 3, 2 * h)
  51.         g.FillEllipse(b4, x, y, h, h)
  52.     End Sub
  53.  
  54.     Public Sub gr(ByVal x1 As Single, ByVal y1 As Single, ByVal h1 As Single, ByVal l As Single, ByVal hf As Single)
  55.         g = Form1.CreateGraphics
  56.         g.FillRectangle(b6, x1, y1, h1, 2 * h1)
  57.         g.FillPie(b5, x1 - h1, y1 - 2 * h1, 3 * h1, 4 * h1, 180, 180)
  58.     End Sub
  59. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement