Can You Replicate This...

vis781

Well-known member
Joined
Aug 30, 2005
Messages
2,016
Location
Cambridge, UK
Programming Experience
5-10
Hi all. This isn't so much of a problem i need answering, in the sense that it's was just a bit of fun,
but now it's bugging me a bit. There is a picture below that i know was drawn using GDI+.
But no matter what i do i can't seem to replicate it. So i thought i'd post it here
and see if anyone can get somwhere. Below is code with where i've got to so far.
Believe me when i say, i'm way off. Good luck if you fancy a go at it.

Here's the picture i'm trying to replicate...

original.aspx


Here's the code i've got so far.....

VB.NET:
Private Sub DrawButton(ByVal e As Graphics, ByVal boundingrectangle As Rectangle)
Dim gp As New GraphicsPath(FillMode.Alternate)
gp.AddEllipse(boundingrectangle)
Dim path As New PathGradientBrush(gp)
path.CenterColor = Color.White
path.CenterPoint = New PointF(Me.Width / 2, Me.Height / 2 + 40)
path.SurroundColors = New Color() {Color.FromArgb(255, _
ControlPaint.Dark(Color.Blue, 0.05))}
e.FillPath(path, gp)
 
Dim jh As New GraphicsPath
jh.AddEllipse(boundingrectangle.X + 12, boundingrectangle.Y + 7, _
boundingrectangle.Width - 24, boundingrectangle.Height - 14)
Dim jpoo As New PathGradientBrush(jh)
jpoo.CenterColor = Color.FromArgb(220, Color.White)
jpoo.SetBlendTriangularShape(0.999)
jpoo.SurroundColors = New Color() {Color.FromArgb(220, _
ControlPaint.Dark(Color.Blue, 0.05))}
e.FillPath(jpoo, jh)
 
Dim halfmoon As New GraphicsPath
Dim Sectionmoon As New GraphicsPath
Dim rect As Rectangle = boundingrectangle
rect.Inflate(-5, 0)
rect.Offset(0, Me.Height / 3)
Sectionmoon.AddEllipse(boundingrectangle)
halfmoon.AddEllipse(rect)
Dim lo As New SolidBrush(Color.FromArgb(50, Color.White))
Dim myreg As New Region(halfmoon)
myreg.Complement(Sectionmoon)
e.FillRegion(lo, myreg)
Dim TopBit As New GraphicsPath(FillMode.Winding)
TopBit.AddEllipse(CInt(boundingrectangle.Width / 5), boundingrectangle.Y + 5, _
CInt(boundingrectangle.Width / 1.7), boundingrectangle.Y + 30)
Dim k As New LinearGradientBrush(TopBit.GetBounds, Color.FromArgb(170, Color.White), _
Color.FromArgb(0), LinearGradientMode.Vertical)
e.FillPath(k, TopBit)
 
Back
Top