Yin and yang: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Visual Basic .NET}}: Added implementation)
Line 428: Line 428:
yinyang .c 110 110 90
yinyang .c 110 110 90
yinyang .c 240 240 40</lang>
yinyang .c 240 240 40</lang>

=={{header|Visual Basic .NET}}==
[[File:YinYang-VBNet.png|thumb|Output of this VB.Net program]]
This version is based behind a Windows Form Application project in Visual Studio, single form with base values.
<lang vbnet>
Public Class Form1

Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim g As Graphics = e.Graphics
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

DrawTaijitu(g, New Point(50, 50), 200, True)
DrawTaijitu(g, New Point(10, 10), 60, True)
End Sub

Private Sub DrawTaijitu(ByVal g As Graphics, ByVal pt As Point, ByVal width As Integer, ByVal hasOutline As Boolean)
g.FillPie(Brushes.Black, pt.X, pt.Y, width, width, 90, 180)
g.FillPie(Brushes.White, pt.X, pt.Y, width, width, 270, 180)
g.FillEllipse(Brushes.Black, CSng(pt.X + (width * 0.25)), CSng(pt.Y), CSng(width * 0.5), CSng(width * 0.5))
g.FillEllipse(Brushes.White, CSng(pt.X + (width * 0.25)), CSng(pt.Y + (width * 0.5)), CSng(width * 0.5), CSng(width * 0.5))
g.FillEllipse(Brushes.White, CSng(pt.X + (width * 0.4375)), CSng(pt.Y + (width * 0.1875)), CSng(width * 0.125), CSng(width * 0.125))
g.FillEllipse(Brushes.Black, CSng(pt.X + (width * 0.4375)), CSng(pt.Y + (width * 0.6875)), CSng(width * 0.125), CSng(width * 0.125))
If hasOutline Then g.DrawEllipse(Pens.Black, pt.X, pt.Y, width, width)
End Sub

End Class
</lang>