locked
LoadPicture

    Question

  • Before using Visual Basic 2005 it was possible to write:

    LoadPicture ( “Path of File” )

    or

    LoadPicture (SelectedFile)


    There is any way to do same thing without picturebox and without e.graphics?


    I would like to use path of file to load bitmap so, I think I should have something similar to

    “Dim MyBitmap As Bitmap” and later call file with image. It is possible?

    Sunday, July 15, 2007 10:32 AM

Answers

  • Public Class Form1

     

    Dim pic As Bitmap

     

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    pic = New Bitmap("c:\picture.extension")

    Me.PictureBox1.Image = pic

    End Sub

     

    End Class

     

    You don't have to use the picture box but it will show you that it loaded the picture

    Sunday, July 15, 2007 5:05 PM

All replies

  • Yep!  Bitmap is a class with constructors.  Look at them!
    Sunday, July 15, 2007 11:38 AM
  • Public Class Form1

     

    Dim pic As Bitmap

     

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    pic = New Bitmap("c:\picture.extension")

    Me.PictureBox1.Image = pic

    End Sub

     

    End Class

     

    You don't have to use the picture box but it will show you that it loaded the picture

    Sunday, July 15, 2007 5:05 PM
  • Following code (when placed inside my button_click event) allows me to see image without PictureBox:

     

    Me.BackgroundImage = System.Drawing.Image.FromFile("c:\picture.extension")

     

    My problem is I don't need image in all my Form!!!

     

    It is possible "inform" my program to my image be visible only in a partial place of my Form?

    Monday, July 16, 2007 9:55 PM