Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-10-2009
Member
 
Join Date: Jun 2009
Posts: 59
How to display an image in a Userform on setting the path

In a userform I want to display an image (jpg). On the other hand, I have some pictures in a directory. Until no problems. For instant I display as follows:

If my test = "mountain"
I display the image (mountain)
Image1.Picture = LoadPicture ( "c:\images\mountain.jpg)

That is my concern:

Now according to a result (variable) tests, I would like to view the image. As I have quite a picture and then test to write. Is it possible to pass the filename as a parameter? Like:

Image1.Picture = LoadPicture("c:\images\MyImage.jpg")

MyImage is the parameter to load depending on the test result
Reply With Quote
  #2  
Old 26-10-2009
Member
 
Join Date: Nov 2008
Posts: 1,054
Re: How to display an image in a Userform on setting the path

Hello, anything goes as

Code:
Image1.Picture = LoadPicture("c:\images\" & MyImage &".jpg")
Reply With Quote
  #3  
Old 26-10-2009
Member
 
Join Date: Jun 2009
Posts: 59
Re: How to display an image in a Userform on setting the path

Thank you, it worked! I tried something in the genre but it lacked the separators " & xxxxxx & ". What is their role? Another question. How to adjust the size of a Userform to the size of the screen? Knowing that I like to use my applications on any PC.
Reply With Quote
  #4  
Old 26-10-2009
Member
 
Join Date: Nov 2008
Posts: 1,054
Re: How to display an image in a Userform on setting the path

"&" is the concatenation operator.

For the later refer vb-helper codes:

A form that covers the entire screen including the taskbar area:

Code:
Private Sub Form_Load()
Dim wid As Long
Dim hgt As Long

    ' Get the screen's size including the task bar area.
    wid = GetSystemMetrics(SM_CXSCREEN)
    hgt = GetSystemMetrics(SM_CYSCREEN)

    ' Make the form of this size.
    Move 0, 0, _
        ScaleX(wid, vbPixels, vbTwips), _
        ScaleY(hgt, vbPixels, vbTwips)
End Sub
Fill the screen with your form :

Quote:
set:

ControlBox = False
Caption = ""
WindowState = Maximized
BorderStyle = None
Code:
Private Sub Form_Resize()
    picCenter.BorderStyle = vbBSNone
    picCenter.Move _
        (ScaleWidth - picCenter.Width) / 2, _
        (ScaleHeight - picCenter.Height) / 2
End Sub
How to get the screen's current resolution

Code:
Private Sub Form_Load()
Dim wid As Integer
Dim hgt As Integer

    wid = Screen.Width \ Screen.TwipsPerPixelX
    hgt = Screen.Height \ Screen.TwipsPerPixelY

    Label1.Caption = Format$(wid) & " x " & Format$(hgt)
End Sub
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to display an image in a Userform on setting the path"
Thread Thread Starter Forum Replies Last Post
Showing grey image instead of the Google TV in full screen and not getting image while setting up my TV source in New Logitech Revue Diedrick Technology & Internet 7 15-02-2012 05:29 AM
Display setting for the Motorola Motoactv BaasimaP Portable Devices 4 14-11-2011 04:55 PM
Setting DMA and Display Settings in Windows FlashX Tips & Tweaks 2 25-03-2009 01:26 PM
Installing Java JDK and setting PATH Paramartha Software Development 4 25-02-2009 05:17 PM
Display Setting Changes in Mozilla. Ramchandra Technology & Internet 4 16-01-2009 11:36 AM


All times are GMT +5.5. The time now is 05:17 PM.