The problem is that when converting image size from pixels for centering the image and for finding label offset, you need only its size in millimeters, without considering the scale applied on the graphics, while the code above also applies the scale transform. Try this version instead:
Public Overrides Sub Draw(ByVal graphics As IGraphics, ByVal options As RenderOptions)
Dim iconSizePixels As Rectangle = New Rectangle(0, 0, imgIcon.Width, imgIcon.Height)
' convert to millimeters without considering scale
Dim g As GdiGraphics
g = Parent.CreateMeasureGraphics()
g.ResetTransform()
Dim imageSize As RectangleF = Utilities.DeviceToDoc(g, iconSizePixels)
g.Dispose()
' Draw the icon center at the top
Dim lPoint As System.Drawing.PointF
lPoint.X = Bounds.X + Bounds.Width / 2 - imageSize.Width / 2
lPoint.Y = Bounds.Y
Dim r As RectangleF
r = New RectangleF( _
Form1.diagView.ClientToDoc(Form1.diagView.DocToClient(lPoint)), imageSize.Size)
graphics.DrawImage(imgIcon, r)
'Draw the label at the bottom
Dim labelSize = Parent.MeasureString( _
title, EffectiveFont, Integer.MaxValue, format)
Dim labelBounds As RectangleF = New RectangleF( _
Bounds.X, Bounds.Y + imageSize.Height, labelSize.Width, labelSize.Height)
labelBounds.Inflate(5, 5)
graphics.DrawString(title, _
Font, New System.Drawing.SolidBrush(ColorTranslator.FromHtml(tcolor)), labelBounds, format)
End Sub
With the size only converted to millimeters, you also don't need a separate case for Svg and PdfGraphics:
![custom_draw.png custom_draw.png](http://mindfusion.eu/_samples/custom_draw.png)
I hope that helps,
Stoyan