Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Data Viewer - Globals.vb

Globals.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports System.Drawing.Drawing2D
  2. Imports System.Reflection
  3. Imports System.Text
  4. Module Globals
  5.     Public MustInherit Class GraphicItem
  6.         Public MustOverride Sub Draw(ByVal G As Graphics)
  7.     End Class
  8.  
  9.     Public MustInherit Class ExtendedItem
  10.         Inherits GraphicItem
  11.  
  12.         Private _Location As Point
  13.         Private _Size As Size
  14.         Private _Color As Color
  15.  
  16.         Public Property Location() As Point
  17.             Get
  18.                 Return _Location
  19.             End Get
  20.             Set(ByVal value As Point)
  21.                 _Location = value
  22.             End Set
  23.         End Property
  24.  
  25.         Public Property Size() As Size
  26.             Get
  27.                 Return _Size
  28.             End Get
  29.             Set(ByVal value As Size)
  30.                 _Size = value
  31.             End Set
  32.         End Property
  33.  
  34.         Public Property Color() As Color
  35.             Get
  36.                 Return _Color
  37.             End Get
  38.             Set(ByVal value As Color)
  39.                 _Color = value
  40.             End Set
  41.         End Property
  42.  
  43.         Sub New(ByVal P As Point, ByVal S As Size, ByVal C As Color)
  44.             Me.Location = P
  45.             Me.Size = S
  46.             Me.Color = C
  47.         End Sub
  48.  
  49.         Sub New()
  50.  
  51.         End Sub
  52.  
  53.         Public Overrides Sub Draw(ByVal G As Graphics)
  54.  
  55.         End Sub
  56.     End Class
  57.  
  58.     Public Class Header
  59.         Inherits ExtendedItem
  60.  
  61.         Public Overrides Sub Draw(ByVal G As System.Drawing.Graphics)
  62.             Dim Path As New GraphicsPath
  63.  
  64.             Path.AddArc(Me.Location.X, Me.Location.Y, 40, 40, 180, 90)
  65.             Path.AddLine(Me.Location.X + 40, Me.Location.Y, Me.Location.X + Me.Size.Width - 40, Me.Location.Y)
  66.             Path.AddArc(Me.Location.X + Me.Size.Width - 40, Me.Location.Y, 40, 40, 270, 90)
  67.             Path.AddLine(Me.Location.X + Me.Size.Width, Me.Location.Y + Me.Size.Height, Me.Location.X, Me.Location.Y + Me.Size.Height)
  68.             Path.AddLine(Me.Location.X, Me.Location.Y + Me.Size.Height, Me.Location.X, Me.Location.Y + Me.Size.Height)
  69.             'Path.AddLine(Me.Location.X, Me.Location.Y + Me.Size.Height, Me.Location.X, Me.Location.Y + Me.Size.Height - 40)
  70.             Path.CloseFigure()
  71.  
  72.             Dim LBrush As New Drawing2D.LinearGradientBrush( _
  73.                 New Point(Me.Location.X, Me.Location.Y + Me.Size.Height), _
  74.                 New Point(Me.Location.X, Me.Location.Y), Me.Color, Drawing.Color.Transparent)
  75.             Dim Blend As New Drawing2D.ColorBlend(2)
  76.  
  77.             Blend.Colors = New Color() {Me.Color, Drawing.Color.Transparent}
  78.             Blend.Positions = New Single() {0, 1}
  79.             LBrush.InterpolationColors = Blend
  80.  
  81.             G.FillPath(LBrush, Path)
  82.             G.DrawPath(New Pen(Me.Color), Path)
  83.         End Sub
  84.     End Class
  85.  
  86.     Public Class Footer
  87.         Inherits Header
  88.  
  89.         Public Overrides Sub Draw(ByVal G As System.Drawing.Graphics)
  90.             Dim Path As New GraphicsPath
  91.  
  92.             Path.AddLine(Me.Location.X + Me.Size.Width, Me.Location.Y, Me.Location.X + Me.Size.Width, Me.Location.Y + Me.Size.Height - 40)
  93.             Path.AddArc(Me.Location.X + Me.Size.Width - 40, Me.Location.Y + Me.Size.Height - 40, 40, 40, 0, 90)
  94.             Path.AddLine(Me.Location.X + Me.Size.Width - 40, Me.Location.Y + Me.Size.Height, Me.Location.X + 40, Me.Location.Y + Me.Size.Height)
  95.             Path.AddArc(Me.Location.X, Me.Location.Y + Me.Size.Height - 40, 40, 40, 90, 90)
  96.             Path.AddLine(Me.Location.X, Me.Location.Y + Me.Size.Height - 40, Me.Location.X, Me.Location.Y)
  97.  
  98.             Dim LBrush As New Drawing2D.LinearGradientBrush( _
  99.                 New Point(Me.Location.X, Me.Location.Y + Me.Size.Height), _
  100.                 New Point(Me.Location.X, Me.Location.Y), Drawing.Color.Transparent, Me.Color)
  101.             Dim Blend As New Drawing2D.ColorBlend(2)
  102.  
  103.             Blend.Colors = New Color() {Drawing.Color.Transparent, Me.Color}
  104.             Blend.Positions = New Single() {0, 1}
  105.             LBrush.InterpolationColors = Blend
  106.  
  107.             G.FillPath(LBrush, Path)
  108.             G.DrawPath(New Pen(Me.Color), Path)
  109.         End Sub
  110.     End Class
  111.  
  112.     Public Class Block
  113.         Inherits ExtendedItem
  114.  
  115.         Public Overrides Sub Draw(ByVal G As Graphics)
  116.             G.FillRectangle(New SolidBrush(Me.Color), Me.Location.X, Me.Location.Y, Me.Size.Width, Me.Size.Height)
  117.         End Sub
  118.     End Class
  119.  
  120.     Public Class MenuItem
  121.         Inherits ExtendedItem
  122.  
  123.         Public Overrides Sub Draw(ByVal G As Graphics)
  124.             Dim Path As New GraphicsPath
  125.             Dim H As Int32 = Me.Size.Height / 2
  126.  
  127.             Path.AddArc(Me.Location.X, Me.Location.Y, 10, 10, 180, 90)
  128.             Path.AddLine(Me.Location.X + 10, Me.Location.Y, Me.Location.X + Me.Size.Width - 10, Me.Location.Y)
  129.             Path.AddArc(Me.Location.X + Me.Size.Width - 10, Me.Location.Y, 10, 10, 270, 90)
  130.             Path.AddLine(Me.Location.X + Me.Size.Width, Me.Location.Y + 10, Me.Location.X + Me.Size.Width, Me.Location.Y + Me.Size.Height - 20)
  131.             Path.AddArc(Me.Location.X + Me.Size.Width - 10, Me.Location.Y + Me.Size.Height - 20, 10, 10, 0, 90)
  132.             Path.AddLine(Me.Location.X + Me.Size.Width - 10, Me.Location.Y + Me.Size.Height - 10, Me.Location.X + 10, Me.Location.Y + Me.Size.Height - 10)
  133.             Path.AddArc(Me.Location.X, Me.Location.Y + Me.Size.Height - 20, 10, 10, 90, 90)
  134.             Path.CloseFigure()
  135.  
  136.             Dim LBrush As New Drawing2D.LinearGradientBrush( _
  137.                 New Point(Me.Location.X, Me.Location.Y + Me.Size.Height), _
  138.                 New Point(Me.Location.X, Me.Location.Y), Me.Color, Drawing.Color.White)
  139.             Dim Blend As New Drawing2D.ColorBlend(3)
  140.  
  141.             Blend.Colors = New Color() {Me.Color, Drawing.Color.White, Me.Color}
  142.             Blend.Positions = New Single() {0, 0.5, 1}
  143.             LBrush.InterpolationColors = Blend
  144.  
  145.             G.FillPath(LBrush, Path)
  146.             G.DrawPath(New Pen(Drawing.Color.White), Path)
  147.         End Sub
  148.     End Class
  149.  
  150.     Public Class InheritanceRelation
  151.         Private _Base, _Derived As ClassBox
  152.         Private _Color As Color
  153.  
  154.         Public Property Color() As Color
  155.             Get
  156.                 Return _Color
  157.             End Get
  158.             Set(ByVal value As Color)
  159.                 _Color = value
  160.             End Set
  161.         End Property
  162.  
  163.         Public Property Base() As ClassBox
  164.             Get
  165.                 Return _Base
  166.             End Get
  167.             Set(ByVal value As ClassBox)
  168.                 _Base = value
  169.             End Set
  170.         End Property
  171.  
  172.         Public Property Derived() As ClassBox
  173.             Get
  174.                 Return _Derived
  175.             End Get
  176.             Set(ByVal value As ClassBox)
  177.                 _Derived = value
  178.             End Set
  179.         End Property
  180.  
  181.         Sub New(ByVal Base As ClassBox, ByVal Derived As ClassBox)
  182.             Me.Base = Base
  183.             Me.Derived = Derived
  184.         End Sub
  185.     End Class
  186. End Module