Ok Version 2 nitaigonga kwa Java ngoja tumalizie na hii ya VB.NET halafu version 3 itakuwa C#yani ungepiga all this kwa java programming ngekupa bonge la like!!! VB haiko kwa moyo sana afu watu wachache sana wanaitumia hii language....
Ok Version 2 nitaigonga kwa Java ngoja tumalizie na hii ya VB.NET halafu version 3 itakuwa C#
Poa mtu wangu?
[COLOR=#0066ff][/COLOR][COLOR=#0066ff]Private [/COLOR]_Status As [COLOR=#669966]KeteStatus[/COLOR]
[COLOR=#0066ff]Private [/COLOR]_CurrentBox As [COLOR=#669966]Box[/COLOR]
[COLOR=#0066ff]Private [/COLOR]_NextBoxes [COLOR=#0066ff]As New[/COLOR] List([COLOR=#0066ff]Of [/COLOR][COLOR=#669966]Box[/COLOR])
[COLOR=#0066ff]Private [/COLOR]_Neighbors [COLOR=#0066ff]As New[/COLOR] List([COLOR=#0066ff]Of [/COLOR][COLOR=#669966]Kete[/COLOR])
[COLOR=#0066ff]Private [/COLOR]_Color [COLOR=#0066ff]As [/COLOR]System.Drawing.[COLOR=#669966]Color[/COLOR]
[COLOR=#0066ff]Private [/COLOR]_isAuto [COLOR=#0066ff]As [/COLOR][COLOR=#669966]Boolean[/COLOR]
[COLOR=#0066ff][/COLOR]
[COLOR=#0066ff]Public Property [/COLOR]Status As [COLOR=#669966]KeteStatus[/COLOR]
[COLOR=#0066ff] Get[/COLOR]
[COLOR=#0066ff]Return [/COLOR]_Status[COLOR=#a52a2a][/COLOR]
[COLOR=#0066ff] End Get[/COLOR]
[COLOR=#0066ff]Set[/COLOR](value As [COLOR=#669966]KeteStatus[/COLOR])
Me.BackgroundImageLayout = ImageLayout.Stretch
[COLOR=#0066ff]Select Case[/COLOR] value
[COLOR=#0066ff]Case [/COLOR]KeteStatus.Normal
Me.BackgroundImage = Me.NormalImage
[COLOR=#0066ff]Case [/COLOR]KeteStatus.Auto
Me.BackgroundImage = Me.AutoImage
[COLOR=#0066ff]Case [/COLOR]KeteStatus.KingAuto
Me.BackgroundImage = Me.KingAuto
[COLOR=#0066ff]Case [/COLOR]KeteStatus.KingNormal
Me.BackgroundImage = Me.KingNormal
[COLOR=#0066ff] End Select[/COLOR][COLOR=#669966][/COLOR]
Application.[COLOR=#a52a2a]DoEvents[/COLOR]()
[COLOR=#0066ff] End Set[/COLOR]
[COLOR=#0066ff] End Property[/COLOR]
[COLOR=#0066ff] Public Property[/COLOR] CurrentBox As Box
[COLOR=#0066ff] Get[/COLOR]
[COLOR=#0066ff] Return[/COLOR] _CurrentBox
[COLOR=#0066ff] End Get[/COLOR]
[COLOR=#0066ff]Set[/COLOR](value As Box)[COLOR=#0066ff][/COLOR]
_CurrentBox = value
[COLOR=#0066ff] End Set[/COLOR]
[COLOR=#0066ff] End Property[/COLOR]
[COLOR=#0066ff] Public Property[/COLOR] NextBoxes [COLOR=#0066ff]As List[/COLOR]([COLOR=#0066ff]Of [/COLOR]Box)
[COLOR=#0066ff] Get[/COLOR]
[COLOR=#0066ff]Return [/COLOR]_NextBoxes
[COLOR=#0066ff] End Get[/COLOR]
[COLOR=#0066ff]Set[/COLOR](value [COLOR=#0066ff]As Lis[/COLOR]t([COLOR=#0066ff]Of [/COLOR]Box))
_NextBoxes = value
[COLOR=#0066ff] End Set[/COLOR]
[COLOR=#0066ff] End Property[/COLOR]
[COLOR=#0066ff] Public Property[/COLOR] Neighbors [COLOR=#0066ff]As List[/COLOR]([COLOR=#0066ff]Of [/COLOR]Kete)
[COLOR=#0066ff] Get[/COLOR]
[COLOR=#0066ff]Return [/COLOR]_Neighbors
[COLOR=#0066ff] End Get[/COLOR]
[COLOR=#0066ff]Set[/COLOR](value [COLOR=#0066ff]As List[/COLOR](Of Kete))
_Neighbors = value
[COLOR=#0066ff] End Set[/COLOR]
[COLOR=#0066ff] End Property[/COLOR]
[COLOR=#0066ff] Public Property[/COLOR] isAuto As Boolean
[COLOR=#0066ff] Get[/COLOR]
[COLOR=#0066ff]Return [/COLOR]_isAuto
[COLOR=#0066ff] End Get[/COLOR]
[COLOR=#0066ff]Set[/COLOR](value [COLOR=#0066ff]As [/COLOR]Boolean)
_isAuto = value
[COLOR=#0066ff]If[/COLOR] value [COLOR=#0066ff]Then[/COLOR]
[COLOR=#0066ff]Me[/COLOR].Status = KeteStatus.Auto
[COLOR=#0066ff] Else[/COLOR]
[COLOR=#0066ff]Me[/COLOR].Status = KeteStatus.Normal
[COLOR=#0066ff] End If[/COLOR]
[COLOR=#0066ff] End Set[/COLOR]
[COLOR=#0066ff] End Property[/COLOR]
Public Class Kete
Private NormalImage As Bitmap
Private AutoImage As Bitmap
Private KingNormal As Bitmap
Private KingAuto As Bitmap
Private _Status As KeteStatus = KeteStatus.Normal
Private _CurrentBox As WindowsApplication3.Box
Private _NextBoxes As New List(Of WindowsApplication3.Box)
Private _Neighbors As New List(Of Kete)
Private _Color As System.Drawing.Color
Private _isAuto As Boolean
Public Sub New()
' This call is required by the designer.
InitializeComponent()
CreateImages()
' Add any initialization after the InitializeComponent() call.
End Sub
Public Property Status As KeteStatus
Get
Return _Status
End Get
Set(value As KeteStatus)
Me.BackgroundImageLayout = ImageLayout.Stretch
_Status = value
Select Case value
Case KeteStatus.Normal
Me.BackgroundImage = Me.NormalImage
Case KeteStatus.Auto
Me.BackgroundImage = Me.AutoImage
Case KeteStatus.KingAuto
Me.BackgroundImage = Me.KingAuto
Case KeteStatus.KingNormal
Me.BackgroundImage = Me.KingNormal
Case Else
Me.BackgroundImage = Me.NormalImage
End Select
Me.Invalidate()
End Set
End Property
Public Property CurrentBox As WindowsApplication3.Box
Get
Return _CurrentBox
End Get
Set(value As Box)
_CurrentBox = value
End Set
End Property
Public Property NextBoxes As List(Of WindowsApplication3.Box)
Get
Return _NextBoxes
End Get
Set(value As List(Of WindowsApplication3.Box))
_NextBoxes = value
End Set
End Property
Public Property Neighbors As List(Of Kete)
Get
Return _Neighbors
End Get
Set(value As List(Of Kete))
_Neighbors = value
End Set
End Property
Public Property isAuto As Boolean
Get
Return _isAuto
End Get
Set(value As Boolean)
_isAuto = value
If value Then
Me.Status = KeteStatus.Auto
Else
Me.Status = KeteStatus.Normal
End If
End Set
End Property
Private Sub CreateImages()
NormalImage = New Bitmap(150, 150)
AutoImage = New Bitmap(150, 150)
KingNormal = New Bitmap(150, 150)
KingAuto = New Bitmap(150, 150)
Dim NormalGraphics As Graphics = Graphics.FromImage(NormalImage)
Dim AutoGraphics As Graphics = Graphics.FromImage(AutoImage)
Dim KingNormalGraphics As Graphics = Graphics.FromImage(KingNormal)
Dim KingAutoGraphics As Graphics = Graphics.FromImage(KingAuto)
Dim objRectangle As New Rectangle(0, 0, 150, 150)
Dim NormalBrush As New System.Drawing.Drawing2D.LinearGradientBrush(objRectangle, Color.Gold, Color.CadetBlue, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
Dim AutoBrush As New System.Drawing.Drawing2D.LinearGradientBrush(objRectangle, Color.Pink, Color.Brown, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
Dim KingNormalBrush As New System.Drawing.Drawing2D.LinearGradientBrush(objRectangle, Color.Gold, Color.Gold, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
Dim KingAutoBrush As New System.Drawing.Drawing2D.LinearGradientBrush(objRectangle, Color.Brown, Color.Brown, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal)
NormalGraphics.FillEllipse(NormalBrush, objRectangle)
AutoGraphics.FillEllipse(AutoBrush, objRectangle)
KingNormalGraphics.FillEllipse(KingNormalBrush, objRectangle)
KingAutoGraphics.FillEllipse(KingAutoBrush, objRectangle)
End Sub
End Class
Public Enum KeteStatus
Normal = 1
Auto = 2
KingNormal = 3
KingAuto = 4
End Enum
Source code kwa pale tulipo fikia
Hizi hapa