GDI+ does have some functions to translate/transform points. Specifically, these may be useful/applicable: GdipTranslateWorldTransform, GdipTransformPoints, GdipCreateMatrix2
But I think it is a bit easier (less code) to build the transformation yourself...
Code:
' form-level variables
Private m_TranslateX As Single
Private m_TranslateY As Single
Private m_ScaleX As Single
Private m_ScaleY As Single
' example of setting it up
With Me.Picture1
m_TranslateX = ScaleX(.ScaleWidth, .ScaleMode, vbPixels) ' width in pixels
m_TranslateY = ScaleY(.ScaleHeight, .ScaleMode, vbPixels) ' height in pixels
m_ScaleX = m_TranslateX / 50 ' 50 = .ScaleWidth
m_ScaleY = m_TranslateY / -50 ' -50 = .ScaleHeight
m_TranslateX = m_TranslateX / 2 ' horizontal offset to 0,0 centered
m_TranslateY = m_TranslateY / 2 ' vertical offset to 0,0 centered
.ScaleWidth = 50
.ScaleHeight = -50
.ScaleLeft = -.ScaleWidth \ 2
.ScaleTop = Abs(.ScaleHeight \ 2)
End With
' sample using the translation/transformation
DrawGradientLine Picture1.Hdc, (x1 * m_ScaleX + m_TranslateX), (y1 * m_ScaleY + m_TranslateY), _
(x2 * m_ScaleX + m_TranslateX), (y2 * m_ScaleY + m_TranslateY), _
&HFF0D0080, &HFFC8C9DD, 2, FillModeWinding, True
Edited: Tip. If using a pen size larger than 1.5 & FillModeAlternate, use that code's DrawGradientLine not the DrawGradientLineI routine else rounding errors can result in unexpected line lengths with angled lines