Hi
Here is one possibility. This is a simplistic version with only two control properties explicitly dealt with - border or no border and text (long name). Minimal testing as I was out for a few hours.
Form1 code
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MyControl1.BorderStyle = BorderStyle.None
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MyControl1.Txt = Trim(TextBox1.Text)
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
With MyControl1
Dim bs As BorderStyle = .BorderStyle
Select Case bs
Case BorderStyle.FixedSingle
.BorderStyle = BorderStyle.None
Case Else
.BorderStyle = BorderStyle.FixedSingle
End Select
End With
End Sub
End Class
MyControl Class code
Imports System.ComponentModel
Public Class MyControl
Inherits Panel
Private longnamefont As New Font(Font.FontFamily, 20)
Private initialfont As New Font(Font.FontFamily, 23, FontStyle.Bold)
Private longnamecolor As New SolidBrush(Color.Black)
Private circlefillcolor As New SolidBrush(Color.Green)
Private initialcolor As New SolidBrush(Color.White)
Private Shared ReadOnly penWidth As Single = 3.0F
Public Sub New()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
Dim sz As Integer = ClientRectangle.Height
e.Graphics.FillEllipse(circlefillcolor, 5, 5, sz - 10, sz - 10)
Dim w1 As Size = TextRenderer.MeasureText(Txt, longnamefont)
e.Graphics.DrawString(Txt, longnamefont, longnamecolor, New PointF(sz, sz \ 2 - w1.Height \ 2))
Dim init() As String = Split(Txt.ToUpper, " "c)
Dim ct As String = Nothing
For Each s As String In init
ct &= s(0)
Next
Dim w2 As Size = TextRenderer.MeasureText(ct, initialfont)
e.Graphics.DrawString(ct, initialfont, initialcolor, New PointF(5 + sz \ 2 - w2.Width \ 2, sz \ 2 - w2.Height \ 2))
End Sub
Private _text As String = "My Control 1"
<Browsable(True)>
Public Property Txt As String
Get
Return _text
End Get
Set(Value As String)
_text = Value
Invalidate()
End Set
End Property
End Class