-
Why FillPath is Different Result in PictureBox and PrintDocument ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
I haven’t yet had a good look at your code, but I can guess the problem. The printed page has margins which limit the area you can draw in. I’ll have another look on my workstation now...
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
I stand by what i said...
BTW... CDec(10) is equal to 10D
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Quote:
Originally Posted by
.paul.
I haven’t yet had a good look at your code, but I can guess the problem. The printed page has margins which limit the area you can draw in. I’ll have another look on my workstation now...
Did You Try To Test My code in a Form ? or you talk only about Codes in my Question ?
Put a Picturebox and 2 Button and a PrintDocument and PrintPreviewDialog into a FORM...
Then copy paste my code
With Button1 Call Printdocument PrintPage.
then dont you see anything when Debug codes ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Try this...
Code:
Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage
Dim newImage As Image = Drawing.Image.FromFile("C:\Users\Yaman\Desktop\Frames\384.jpg")
Dim imaj As Bitmap = New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg")
Dim grpX As Graphics = e.Graphics
Dim rectX As Rectangle = New Rectangle(e.MarginBounds.Left + 10, e.MarginBounds.Top + 10, 200, 100)
Dim tg As Graphics = Graphics.FromImage(imaj)
tg.SmoothingMode = SmoothingMode.AntiAlias
grpX.SmoothingMode = SmoothingMode.AntiAlias
tg.DrawImage(newImage, 10, 10, 200, 100)
Dim TBrush As New TextureBrush(imaj)
Dim gp As New GraphicsPath
gp = createRoundRect(rectX, 12)
grpX.FillPath(TBrush, gp)
End Sub
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
tg.DrawImage(newImage, 10, 10, 200, 100)
That should probably be 0, 0, 200, 100
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
What is the size of the picturebox?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
And the 2 images you’re loading. What size are they?
What is your picturebox SizeMode?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
384.Jpg size is 1024x697
I don't change any size mode. Keep as default.
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
So what size is the picturebox???
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Picturebox size is not important. But size is 600x600
I just onlt try to fillPath as I could do in Picturebox
Even PictureBox Size 700x400 or 500x300 or any size Same Result. I just wonder why code is working in PictureBox but not work in Printdocument...
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Code:
Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage
Dim newImage As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg", 200, 100)
Dim imaj As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg", 200, 100)
Dim grpX As Graphics = e.Graphics
Dim rectX As Rectangle = New Rectangle(e.MarginBounds.Left + 10, e.MarginBounds.Top + 10, 200, 100)
Dim tg As Graphics = Graphics.FromImage(imaj)
tg.SmoothingMode = SmoothingMode.AntiAlias
grpX.SmoothingMode = SmoothingMode.AntiAlias
tg.DrawImage(newImage, 10, 10, 200, 100)
Dim TBrush As New TextureBrush(imaj)
Dim gp As New GraphicsPath
gp = createRoundRect(rectX, 12)
grpX.FillPath(TBrush, gp)
End Sub
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
BTW picturebox size is important - more than you think. particularly if you have SizeMode set to stretch
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Paul thank you for your effort to find Solution.
Did you tried to code with any image in your computer ?
if problem is in my Computer ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Code:
Dim newImage As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg", 200, 100)
Dim imaj As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg", 200, 100)
Change those to...
Code:
Dim newImage As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg")
newImage = New Bitmap(newImage, 200, 100)
Dim imaj As New Bitmap("C:\Users\Yaman\Desktop\Frames\384.jpg")
imaj = New Bitmap(imaj, 200, 100)
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Quote:
Originally Posted by
Nicomendox
Paul thank you for your effort to find Solution.
Did you tried to code with any image in your computer ?
if problem is in my Computer ?
I’m typing this freehand on my iPhone. It should work better now...
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Not sure of the cause of that. Getting some sleep now... it’s 03:30am
-
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
So Sorry. and thanks a lot. God Bless you.