I’m trying to create an Icon in code to load into a 4 Button SegmentedControl that is showing up empty. I’m thinking I have to use the DrawInto Method but that is for a RectControl or do I have to make PBuffer a Graphic FileType. How do I with the code I got below.
Dim iW, iH As Integer
Dim PBuffer As Picture
Dim IconColor, BorderColor As Color
PBuffer = NewPicture(Width, Height, 32)
For i As Integer = 0 To 3
Select Case i
Case 0
iW = 23
iH = 18
PBuffer.Graphics.ForeColor = IconColor
PBuffer.Graphics.FillOval(0,0, iW, iH)
PBuffer.Graphics.PenHeight = 0
PBuffer.Graphics.PenWidth = 0
PBuffer.Graphics.ForeColor = DarkTingeColor
PBuffer.Graphics.DrawOval(0, 0, iW, iH-1)
Case 1
iW = 27
iH = 22
PBuffer.Graphics.ForeColor = IconColor
PBuffer.Graphics.FillRect(0, 0, iW, iH)
PBuffer.Graphics.ForeColor = DarkTingeColor
PBuffer.Graphics.DrawRect(0, 0, iW, iH-1)
Case 2
iW = 23
iH = 18
PBuffer.Graphics.PenHeight = 4
PBuffer.Graphics.PenWidth = 4
PBuffer.Graphics.ForeColor = BorderColor
PBuffer.Graphics.DrawOval(0,0, iW, iH)
PBuffer.Graphics.ForeColor = IconColor
PBuffer.Graphics.FillOval(0,0, iW, iH)
Case 3
iW = 27
iH = 22
PBuffer.Graphics.PenHeight = 4
PBuffer.Graphics.PenWidth = 4
PBuffer.Graphics.ForeColor = BorderColor
PBuffer.Graphics.DrawRect(0, 0, iW, iH)
PBuffer.Graphics.ForeColor = IconColor
PBuffer.Graphics.FillRect(0, 0, iW, iH)
End Select
Dim s As SegmentedControlitem = SegmentedControl1.Items(i)
s.Icon = PBuffer
Next