Skip to content

Commit 435fa4d

Browse files
committed
Center image when not stretching
1 parent 623adc7 commit 435fa4d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/AlphaBlendImage.ctl

+2-4
Original file line numberDiff line numberDiff line change
@@ -555,15 +555,13 @@ Private Function pvPrepareBitmap(hBitmap As Long) As Boolean
555555
If GdipScaleWorldTransform(hGraphics, sngZoom, sngZoom, MatrixOrderAppend) <> 0 Then
556556
GoTo QH
557557
End If
558+
lLeft = lLeft - lWidth / 2
559+
lTop = lTop - lHeight / 2
558560
If m_bStretch Then
559-
lLeft = lLeft - lWidth / 2
560-
lTop = lTop - lHeight / 2
561561
If GdipDrawImageRectRect(hGraphics, m_hPictureBitmap, lLeft, lTop, lWidth, lHeight, 0, 0, sngPicWidth, sngPicHeight, , m_hPictureAttributes) <> 0 Then
562562
GoTo QH
563563
End If
564564
Else
565-
lLeft = lLeft - sngZoom * sngPicWidth / 2
566-
lTop = lTop - sngZoom * sngPicHeight / 2
567565
If GdipDrawImageRectRect(hGraphics, m_hPictureBitmap, lLeft + (lWidth - sngPicWidth) / 2, lTop + (lHeight - sngPicHeight) / 2, sngPicWidth, sngPicHeight, 0, 0, sngPicWidth, sngPicHeight, , m_hPictureAttributes) <> 0 Then
568566
GoTo QH
569567
End If

0 commit comments

Comments
 (0)