|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
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 |
#2
| |||
| |||
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") |
#3
| |||
| |||
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. |
#4
| |||
| |||
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 Quote:
Code: Private Sub Form_Resize() picCenter.BorderStyle = vbBSNone picCenter.Move _ (ScaleWidth - picCenter.Width) / 2, _ (ScaleHeight - picCenter.Height) / 2 End Sub 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 |
![]() |
|
Tags: image display, userform, visual basic |
Thread Tools | Search this Thread |
|
![]() | ||||
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 |