I try To Fill RectangleShape with image but when I try to fill İmage than it is not fit into the Drawed Shape.
Code:Public Sub FillRectangle(ByVal g As Graphics, ByVal brush As Brush, ByVal x As Decimal, ByVal y As Decimal, ByVal width As Decimal, ByVal height As Decimal, ByVal radius As Decimal) Dim area As Rectangle = New Rectangle(x, y, width, height) Dim path As New Drawing2D.GraphicsPath 'Add the corners path.AddArc(area.Left, area.Top, radius * 2, radius * 2, 180, 90) 'Upper-Left path.AddArc(area.Right - (radius * 2), area.Top, radius * 2, radius * 2, 270, 90) 'Upper-Right path.AddArc(area.Right - (radius * 2), area.Bottom - (radius * 2), radius * 2, radius * 2, 0, 90) 'Lower-Right path.AddArc(area.Left, area.Bottom - (radius * 2), radius * 2, radius * 2, 90, 90) 'Lower-Left 'Fill the rounded rectangle g.FillPath(brush, path) End SubCode:Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage e.Graphics.PageUnit = GraphicsUnit.Millimeter e.Graphics.ResetTransform() PrintDocument2.OriginAtMargins = True Dim grpX As Graphics = e.Graphics Dim newImage As Image = Drawing.Image.FromFile("C:\Users\Yaman\Desktop\Frames\243.png") Dim brsh As New TextureBrush(newImage) FillRectangle(grpX, brsh, CDec(4.65), CDec(12.9), CDec(99.1), CDec(33.9), 5) End Sub




Reply With Quote
