|
-
May 7th, 2020, 04:48 PM
#1
Thread Starter
Lively Member
Why FillPath is Different Result in PictureBox and PrintDocument ?
Last edited by Nicomendox; May 16th, 2020 at 07:58 PM.
-
May 7th, 2020, 06:22 PM
#2
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...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 06:25 PM
#3
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
I stand by what i said...
BTW... CDec(10) is equal to 10D
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 06:43 PM
#4
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
 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 ?
-
May 7th, 2020, 06:43 PM
#5
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Last edited by Nicomendox; May 7th, 2020 at 06:47 PM.
Reason: Doublicated my Reply...
-
May 7th, 2020, 07:00 PM
#6
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 07:03 PM
#7
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 08:18 PM
#8
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Last edited by Nicomendox; May 16th, 2020 at 08:04 PM.
-
May 7th, 2020, 08:24 PM
#9
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
What is the size of the picturebox?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 08:27 PM
#10
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?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 08:39 PM
#11
Thread Starter
Lively Member
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.
-
May 7th, 2020, 08:40 PM
#12
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
So what size is the picturebox???
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 08:43 PM
#13
Thread Starter
Lively Member
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...
-
May 7th, 2020, 08:51 PM
#14
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 08:55 PM
#15
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 09:05 PM
#16
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Last edited by Nicomendox; May 16th, 2020 at 08:00 PM.
-
May 7th, 2020, 09:07 PM
#17
Thread Starter
Lively Member
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 ?
-
May 7th, 2020, 09:12 PM
#18
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)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 09:13 PM
#19
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
 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...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 09:23 PM
#20
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
Last edited by Nicomendox; May 16th, 2020 at 08:03 PM.
-
May 7th, 2020, 09:28 PM
#21
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
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 7th, 2020, 09:28 PM
#22
Thread Starter
Lively Member
Re: Why FillPath is Different Result in PictureBox and PrintDocument ?
So Sorry. and thanks a lot. God Bless you.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|