Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > background image from ImageLocation?
 

background image from ImageLocation?

i currently have 2 pictureboxes, 1 textbox, 1 timer .
picturebox1 is at location 0,0, picturebox2 is at location 200,0..
by using the following code, i can paste a url from a image in the textbox and have it display properly in my picturebox1, set to zoom ..

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.BackgroundImageLayout = ImageLayout.Zoom
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        PictureBox2.ImageLocation = TextBox1.Text
        PictureBox1.BackgroundImage = PictureBox2.Image
    End Sub

End Class



the problem is..
on startup , if i do not resize the form to get picturebox2 out of view, the code works..
as soon as i resize the form on startup , where picturebox2 is not visible, and paste the url in textbox1, i get no image displayed in picturebox1 from picturebox2.
after resizing the form to where picturebox2 is visible, i get an image to display in picturebox1..
hope the above makes sense..

is there a way to set a picturebox's IMAGE (
not backgroundlayout ) layout to zoom? , so i will not have to use 2 pictureboxes..
or how can i hide picturebox2 to get it to have picturebox1 display an image?


i mostly need this for the zoom mode.
thanx.
�trujade.�/span>
â€?trujade.† 6 hours 19 minutes ago
is there a way to set a picturebox's IMAGE ( not backgroundlayout ) layout to zoom? , so i will not have to use 2 pictureboxes..
or how can i hide picturebox2 to get it to have picturebox1 display an image?


i mostly need this for the zoom mode.
thanx.
�trujade.�/span>

Trujade,

I'm sure I'm missing something here? If all you want to do is to set the PictureBox to the Zoom in code, it's nothing more than this:

PictureBox1.SizeMode = PictureBoxSizeMode.Zoom


That's not what you're looking for ... is it?
Frank L. Smith  5 hours 37 minutes ago
I THINK YOU ARE WRONG

I dont get any error Like you Say
www.shariqdon.media.officelive.com
ShariqDON  6 hours 10 minutes ago
shariq , i tried this in vs 2o1o professional as well as vb 2oo8. same result..
..
try this..
place picturebox 1 close to the left side of the form..
picturebox2 close to the right side of the form..
then start the app, resize the form to where picturebox2 is not visible on the form, just picturebox1 and textbox1 is..
and paste this url in the textbox.

http://vb.trujade.com/images/vb.net%20logo.gif

if the image does not display within a few sec's, or at least get that image showing that it is loading, resize the form to where picturebox2 is visible..

let me know the result.
�trujade.�/font>
â€?trujade.† 5 hours 56 minutes ago
That code would constantly load the image at each timer tick is that what you want ?
coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read .
bdbodger  5 hours 37 minutes ago
is there a way to set a picturebox's IMAGE ( not backgroundlayout ) layout to zoom? , so i will not have to use 2 pictureboxes..
or how can i hide picturebox2 to get it to have picturebox1 display an image?


i mostly need this for the zoom mode.
thanx.
�trujade.�/span>

Trujade,

I'm sure I'm missing something here? If all you want to do is to set the PictureBox to the Zoom in code, it's nothing more than this:

PictureBox1.SizeMode = PictureBoxSizeMode.Zoom


That's not what you're looking for ... is it?
Frank L. Smith  5 hours 37 minutes ago
Yes Picturebox2 is not in Zoom Mode .....
www.shariqdon.media.officelive.com
ShariqDON  5 hours 26 minutes ago
That code would constantly load the image at each timer tick is that what you want ?
coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read .
should not be a problem.. mostly for testing purposes, plus the form does not display for more than the user would need to edit some text..
i tried to have the timer start on textbox1_textchanged and have it stop when the _backgroundimagechanged, but it stops on that loading image, not on the url image..
do you know a way to bypass the first loading image, and have it stop on my url image??
thanx.

Trujade,

I'm sure I'm missing something here? If all you want to do is to set the PictureBox to the Zoom in code, it's nothing more than this:
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
That's not what you're looking for ... is it?

exactly what i was looking for .

i hope you guys know what it is like to get so caught up w/something, that even something as overlooking the sizemode property of a picturebox can cause a fire.. . roflmao.. i bow my head..

thanx frank . ;o)
�trujade.�/font>
â€?trujade.† 5 hours 18 minutes ago
That code would constantly load the image at each timer tick is that what you want ?
coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read .
should not be a problem.. mostly for testing purposes, plus the form does not display for more than the user would need to edit some text..
i tried to have the timer start on textbox1_textchanged and have it stop when the _backgroundimagechanged, but it stops on that loading image, not on the url image..
do you know a way to bypass the first loading image, and have it stop on my url image??
thanx.

Trujade,

I'm sure I'm missing something here? If all you want to do is to set the PictureBox to the Zoom in code, it's nothing more than this:
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
That's not what you're looking for ... is it?

exactly what i was looking for .

i hope you guys know what it is like to get so caught up w/something, that even something as overlooking the sizemode property of a picturebox can cause a fire.. . roflmao.. i bow my head..

thanx frank . ;o)
�trujade.�/span>

:)

...and I sure do understand that!
Frank L. Smith  5 hours 15 minutes ago
bdbodger , disregard my question of bypassing.
it works well w/the _textChanged and i completely got rid of the timer..
thanx. :o)
�trujade.�/span>
â€?trujade.† 5 hours 11 minutes ago

�trujade.�/font>
â€?trujade.† 5 hours 9 minutes ago
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        PictureBox1.SizeMode = PictureBoxSizeMode.Zoom

    End Sub


    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Try
            PictureBox1.ImageLocation = TextBox1.Text
        Catch ex As Exception

        End Try
    End Sub

coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read .
bdbodger  5 hours 5 minutes ago
thanx bdbodger ..
it seems to work w/out the try..catch, but i will add it as well, just for security reasons. ;o)

�trujade.�/span>
â€?trujade.† 5 hours 1 minutes ago
Your right I guess it isn't needed .
coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read .
bdbodger  4 hours 59 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• Data Base link
• Disabling a Proxy after closing the WebBrowser
• Merging console with windows form application
• mirroring Application
• How can I change the color of some words in the RichTextBox Text ?
• Inexplicable error message
• GUI programming in visual basic 2008 express edition
• Datagridview ComboBox Issue
• how to turn on context menu in RIch Text Box?
• How to replace text with a picture in Word with vb.net