drawimage with imagelout.center
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
10 posts
Page 1 of 1
Hello,
yep another problem :lol:
just hope this will be solved.
it seems we can't paint a image with imagelayout.center (this is because as default the backgroundimagelayout = center)
so we need to use that part to resize the backgroundimage with paint
i made a custom picturebox
and i want to use 2 images
1 at background with imagelayout center
and 1 image
the image works fine
but i still need to make this background to work
our code:
see image
no image has been showed only the image i added
but no backgroundimage :(
anyone?
thanks
yep another problem :lol:
just hope this will be solved.
it seems we can't paint a image with imagelayout.center (this is because as default the backgroundimagelayout = center)
so we need to use that part to resize the backgroundimage with paint
i made a custom picturebox
and i want to use 2 images
1 at background with imagelayout center
and 1 image
the image works fine
but i still need to make this background to work
our code:
Code: Select all
result: Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim G As Graphics = e.Graphics
G.Clear(Color.White)
MyBase.OnPaint(e)
G.DrawImage(Me.BackgroundImage, 0, 0, ImageLayout.Zoom, ImageLayout.Zoom)
End Sub
see image
no image has been showed only the image i added
but no backgroundimage :(
anyone?
thanks
You do not have the required permissions to view the files attached to this post.
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
When you override the System Paint always delete this
Code: Select all
That's just the default paint message, but since you're doing the drawing yourself, you don't need it.MyBase.OnPaint(e)
You can find me on Facebook or on Skype mihai_92b
#XTechVB,
i removed it but now i don't get any image :?
i removed it but now i don't get any image :?
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
Dummy1912 wrote:#XTechVB,You are inheriting the PictureBox base class aren't you? :lol:
i removed it but now i don't get any image :?
I don't really understand what you are trying to do, can you be more specific? :?
You can find me on Facebook or on Skype mihai_92b
well not really
because when i paint the image with
and i want to use the default backgroundimagelayout = zoom
to set the size.
i can't explain it in any other way if you still don't get it :?
Code: Select all
i want to paint the backgroundimage with the settings backgroundimagelayout = zoom Inherits PictureBox
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim G As Graphics = e.Graphics
G.Clear(Color.White)
'MyBase.OnPaint(e)
G.DrawImage(Me.BackgroundImage, 0, 0, ImageLayout.Zoom, ImageLayout.Zoom)
End Sub
because when i paint the image with
Code: Select all
if fills out the complete backgroundG.DrawImage(Me.BackgroundImage, 0, 0, width, height)
and i want to use the default backgroundimagelayout = zoom
to set the size.
i can't explain it in any other way if you still don't get it :?
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
My idea is that: i think that the backgroundimage cannot be seen because there's an image above it which is the image that you see.
try to empty the image for the main time just to see if the background image
is there. :(
try to empty the image for the main time just to see if the background image
is there. :(
yes #noypikami
when i remove the image no background image has been showed.
only it will be showed when i use:
when i remove the image no background image has been showed.
only it will be showed when i use:
Code: Select all
instead of
G.DrawImage(Me.BackgroundImage, 0, 0, width, height)
Code: Select all
but i want to set the size automatic with the picturebox backgroundimagelayout.zoom G.DrawImage(Me.BackgroundImage, 0, 0, ImageLayout.Zoom, ImageLayout.Zoom)
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
When BackgroundImage Property is set then the PictureBox draws the selected image automatically, why are you drawing it again manually?
But i think you'll be better off using a custom control, that way you have control over everything.
Inheriting and modifying existing controls is always a bad idea.
Code: Select all
If you want to draw two images in one PictureBox, then use two custom Image type properties, that way you have full control over what is drawn and how, without any interference from the PictureBox. G.DrawImage(Me.BackgroundImage, 0, 0, ImageLayout.Zoom, ImageLayout.Zoom)
But i think you'll be better off using a custom control, that way you have control over everything.
Inheriting and modifying existing controls is always a bad idea.
You can find me on Facebook or on Skype mihai_92b
seems it has no point of asking
because we don't get far :lol:
i just want my own picturebox with some round corners as you can see on the image
but i can't set the backgroundimage with the same backgroundimagelayout
and i want this so it fits the image as ZOOM with drawimage
because we don't get far :lol:
i just want my own picturebox with some round corners as you can see on the image
but i can't set the backgroundimage with the same backgroundimagelayout
and i want this so it fits the image as ZOOM with drawimage
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
nvm got it sloved.
thanks anyway for the help #XTechVB ;)
Code: Select all
its a nice result G.DrawImage(me.BackgroundImage, 0, 15, 188, 188)
thanks anyway for the help #XTechVB ;)
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
10 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023