Anda di halaman 1dari 33

Search

Visual Basic 6 (VB6)

Home Tutorials

Working with images in all different ways

Level:

Sky Homes in Thane West


Book a Sky Home at just 1% in Rustomjee Urbania and avail
special flexi-payment offers

Written By TheVBProgramer.

The Image Control

You've already seen in the previous topic that with an Image control, you can set it's Picture property at design time by going
to Picture property, clicking the ellipsis (), and selecting a file from the Load Picture dialog box. Recall that the main types
of files that can be assigned to an Image control are .bmp, .jpg, .ico, and .wmf.

The Image control has a Stretch property, which is set to False by default. When the Stretch property is
False, the Image control will automatically resize itself to expand or contract to the size of the picture
that is assigned to it. If instead you want the image to fill the specific size that you make the Image
control, set the the Stretch property to True, which will cause the picture you assign to the Image control
to automatically expand or contract to conform to the size of the control. Depending on the type of
image, the image may or may not appear distorted when stretched this is something you need to
experiment with.

You can also set the Picture property of an image control in code by using the LoadPicture function, which loads a picture
from a file into the control at run-time. The LoadPicture function takes a file name as an argument. Sample syntax is:

imgMyPic.Picture = LoadPicture("C:\SomeDirectory\SomeSubDir\MyPic.bmp")

"Picture" is the default property of the image control, so the above statement could have been written as:

imgMyPic = LoadPicture("C:\SomeDirectory\SomeSubDir\MyPic.bmp")

(Note: In my earlier VB programming, I would typically omit the default property of controls; however, I
now advocate explicitly coding all properties so I recommend keeping the ".Picture" on there.)

Keep in mind the following general points about setting the Picture property of a control using
LoadPicture at run-time compared to selecting a file for the control's Picture property at design-time:
When you set the picture at design-time, that picture becomes embedded in your application (it is
stored in the .frx file of the form that is using it). Therefore, your program is bigger, but runs faster
because the picture is in memory when your program loads.
When you use LoadPicture, the program is smaller because the image is not embedded in the
application, but resides in a separate file. However, the image processing is slower because the
program must access it from disk.

To clear the picture from an image control, use the LoadPicture function with an empty set of parentheses:

imgMyPic.Picture = LoadPicture()

If you have more than one image control on a form, you can copy a picture from one image to another via an assignment
statement like this:

imgPic1.Picture = imgPic2.Picture
- or -
imgPic1 = imgPic2

A common technique to change an image on a form at various points in the program is to use a number
of image controls as a "repository". The images in the "repository" will all have their Visible property set
to False. At the desired time, the program will assign one of the images from the "repository" to the
image to be displayed. The following sample program demonstrates this technique.

The sample program displays a traffic light that alternates color from green to yellow to red every half of
a second. All images used are icons from the folder:
Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Traffic.

To build the sample program, use the figure below as a guide to place the indicated controls on the
default form and set the properties of the controls to the values indicated in the callouts.

The code for the program is as follows:

Option Explicit

Private mstrCurrColor As String


Private Sub Form_Load()
mstrCurrColor = "G"
imgLight.Picture = imgGreenLight.Picture
End Sub

Private Sub tmrChangeLight_Timer()

If mstrCurrColor = "G" Then


imgLight.Picture = imgYellowLight.Picture
mstrCurrColor = "Y"
ElseIf mstrCurrColor = "Y" Then
imgLight.Picture = imgRedLight.Picture
mstrCurrColor = "R"
Else
imgLight.Picture = imgGreenLight.Picture
mstrCurrColor = "G"
End If

End Sub

When the program runs, the traffic light will alternate in color between green, yellow, and red at intervals
of one half of a second:

Download the VB project code for the example above here.

The PictureBox Control

Like the Image control, the PictureBox control can be used to display images. However, the PictureBox can do much more.
Like the Frame control, the PictureBox is a "container" control, meaning that other controls can be placed inside it. In
addition, the PictureBox can be used to generate run-time graphics and to display text. As a general rule of thumb, if your
application requires the special capabilities of the "heavyweight" PictureBox, then use it; but if all you want to do is display an
image, then use the "lightweight" Image control.

Using Images with the Form

The Form has both a Picture property and an Icon property. The Form's Picture property is used to
display an image directly on the form; this can be suitable for displaying a background image. In the
screen shot below, the Form's Picture property was set to a file called "Santa Fe Stucco.bmp". The
image is displayed starting in the upper left-hand corner of the form and cannot be moved or resized. If
you want to display an image directly on the form like this, and you want the image to fill the entire
background of the form, you must make sure the image to be used is the same size or larger than the
size you want to make the form. (If the image you want for the background of the form is too small, use
an Image control that you set to be the same size as the form with its Stretch property set to True, as
was done in the previous topic's sample program with the "clouds.bmp" image.)

Note: To clear the Picture property at design-time, highlight the entry for the Picture property ("(Bitmap)"
in this case), and press the Delete key.
The Form's Icon property is used to set the icon that is displayed in the left-hand corner of the Form's
title bar. In the screen shot below, the Form's Icon property was set to the SUN.ICO icon from the
Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Elements folder.

When you compile a VB program, the icon used for the resulting EXE is determined by the setting of the
Icon property of the Form you specify on the "Make" tab of the project's properties sheet (accessed from
the IDE's Project menu item). As shown below, the icon that will be used for this application's EXE will
be the "sun" icon from "Form1". If the project had more than one form, then you could choose which
form's icon would be used for the EXE by selecting the appropriate form name from the "Icon:"
drop-down box:

The Picture Property of the Command Button

The Command Button control has a Style property, which, when set to 1Graphical, enables you to
display a picture on the button via the command button's Picture property. (Also when the Style is
set to 1-Graphical, you can change the BackColor of the button, which you cannot do when the Style is
set to 0-Standard.)

If the command button also has a non-blank value for its Caption property, the text of the caption will
appear below the picture. (Note: In VB6, you cannot specify the position (left, right, below) of the picture
relative to the caption on the command button: the picture will always appear above the caption. A
custom button control would be needed to display the picture to the left or right of the caption on the
button.)

The screen shot below shows two command buttons with images (the images shown are from a custom
icon set):

The command button also has a DisabledPicture property, which allows you to specify an alternative
image to be displayed on the button when the Enabled property is set to False:

If you don't use the DisabledPicture property, the system will "do its best" to render a disabled image
based on the original what it comes up with may or may not be acceptable to you:

Another technique used with "picture buttons" is to place only a picture on the button and leave the
Caption blank then use an adjacent Label control to describe the function of the button, as shown in
the "switchboard" type screen below:
Using Images with Other Controls

Images can be used with many with other controls. In later topics, a set of controls called the Windows
Common Controls will be explored. This set of controls comprises the ToolBar, TreeView, ListView,
TabStrip, StatusBar, and several others. These controls are used in conjunction with an ImageList
control, which serves as a repository for images to be used for items within the controls (i.e. icons for the
Toolbar buttons, TreeView nodes, ListView list items, etc.) The screen shot below shows a portion of a
screen used by an application that uses a ToolBar, TreeView, and ListView.

Finding Images to Use with Your Applications


Probably the most challenging aspect of incorporating images (particularly icons) into your application is
not the actual programming, but simply the search for the "right" icon or image to represent the function
or concept to be worked with in your application's user interface.

As mentioned previously, Visual Studio 6/Visual Basic 6 comes with a set of over 900 graphic files (over
500 of which are icons). When Visual Studio 6 or VB 6 is installed, the Graphics folder is NOT installed
by default (whoever is installing it must explicitly check the "Graphics" option during the appropriate step
of the installation). Assuming that the Graphics are installed, by default they will be placed in the
directory structure shown below:

The Icons folder contains 13 subfolders. As a reference, and for convenience, screen shots of the
contents of the icon folders are shown below:
Even with all of the icons and other graphic files included with VB, you may not find images that you
deem suitable for your application. Not all "categories" of icons that you might expect are present in the
included collections, and those that are included would be regarded by some as "dated" (the offering of
included icons has not changed since VB 3.0 back in 1995). Fortunately, there are numerous resources
on the Internet for icon collections (ranging in price from free to several hundred dollars) as well as
resources for working with icons (creating your own and/or modifying existing icons).
Post to Facebook

Post to Twitter

Add to LinkedIn

Similar links
Learn howto use the Visual Basic DateDi function

Understanding VB6's DateAdd function

Creating PDF les in Visual Basic

Pravljenje PDF fajlova u Visual Basic-u

Visual Basic Power Pack

Simple Windows API Example

From VB6 to VB.NET with the Microsoft.VisualBasic Namespace

SQL Databases Create, Update, and Query

Calling Windows APIs

DateTime Functions

If you enjoyed this post, subscribe for updates (it's free)


Email Address... Subscribe

vb 6.0 Mon, 01/27/2014 - 11:51 tauheed (not veried)

can any buddy help me?


my problem is that .....i want to load an image in image control .....i used
image1.image=loadpicture("d:\MyPic.jpg")....yeah it has worked well..
but instead of this i want to use variable in the place of le name..............can any one help me plzzz?

help me Sat, 10/27/2012 - 08:13 rajaa

l needs code for extraction image ngerprint pore please

Dim sec As Integer Dim min As Wed, 03/07/2012 - 00:18 Maani (not veried)

Dim sec As Integer


Dim min As Integer
Dim hou As Integer
Dim t1 As String
Dim t2 As String
Dim t3 As String

timer code
sec = sec + 1
ProgressBar1.Value = sec
If ProgressBar1.Value = 59 Then
ProgressBar1.Value = 1
End If
If sec = 59 Then
t1 = "0"
sec = 0
min = min + 1
End If
If min = 59 Then
t2 = "0"
min = 0
hou = hou + 1
End If
If sec >= 10 Then
t1 = ""
End If
If min >= 10 Then
t2 = ""
End If
If hou >= 10 Then
t3 = ""
End If
Time.Text = t3 & hou & ":" & t2 & min & ":" & t1 & sec
form load event

sec = 0
min = 0
hou = 0
t1 = "0"
t2 = "0"
t3 = "0"

it is not working please help me...!!!

Reply to comment (VB6) Sat, 09/29/2012 - 22:02 gure drawing skills (not veried)

When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a
comment is added I get four emails with the same comment.
Is there any way you can remove people from that service?
Many thanks!

problem relating option button Wed, 02/01/2012 - 23:16 Anonymous (not veried)

i want set image for option button without changing its style property to graphical..plz someone help me....
FirstComeFirstServed Tue, 01/10/2012 - 18:02 Leo Grande (not veried)

can you send me the design and program of the FirstComeFirstServed?using vb=2008

FirstComeFirstServed Tue, 01/10/2012 - 17:59 Leo Grande (not veried)

can you send me the design and program of the FirstComeFirstServed?

How to store images in Sun, 09/25/2011 - 06:04 Anonymous (not veried)

How to store images in database using raw or blob????


please dont use load picture () .It will not work if i run my application on dierent PC.

Problem Using Icons!!! Tue, 08/30/2011 - 08:38 Anonymous (not veried)

hi I have Downloaded many icons from the internet. The format of icons is correct, (16x16,32x32,64x64; .ICO, .PNG) But
when i used it in VB6, it says, "Invalid Picture"! Please tell Me Any solution or Suggest any site where i can nd icons
which compatible with VB6.

working with toolbars Thu, 08/18/2011 - 12:31 Vicente (not veried)

I'm working with objects and ListImage toolbar but I sent the error 5, as if he had lled a limit of objects, where do I can
extend this limit?

add my code with the problem Thu, 08/18/2011 - 12:37 Vicente (not veried)

Set imgX = ImageList1.ListImages.Add(, "search", LoadPicture(App.Path & "\zoom.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "nsearch", LoadPicture(App.Path & "\document.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "markCaf", LoadPicture(App.Path & "\document_edit.gif", vbLPSmallShell, ,
10, 10))
Set imgX = ImageList1.ListImages.Add(, "undoCaf", LoadPicture(App.Path & "\interact.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "addAcc", LoadPicture(App.Path & "\user_add.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "adjust", LoadPicture(App.Path & "\other.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "other", LoadPicture(App.Path & "\mark.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "locks", LoadPicture(App.Path & "\lock.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "Send", LoadPicture(App.Path & "\excel2_app.ico", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "chgName", LoadPicture(App.Path & "\user_black.gif", vbLPSmallShell, , 10,
10))
Set imgX = ImageList1.ListImages.Add(, "close", LoadPicture(App.Path & "\close.gif", vbLPSmallShell, , 10, 10))
-->Set imgX = ImageList1.ListImages.Add(, "Empty", LoadPicture(App.Path & "\folder_open.gif", vbLPSmallShell, 10,
10))
Set imgX = ImageList1.ListImages.Add(, "Download", LoadPicture(App.Path & "\down.gif", vbLPSmallShell, 10, 10))

image list control Sun, 08/07/2011 - 22:51 Royce (not veried)

is possible that you can upload image or pictures by using a command button rather than going to imagelist properties
and then insert pictures?
i mean instead of using insert pictures to properties is there possible that my command button do it for me?? please send
me some codes thanks:D

I have problem on how to load a picture on registration Form Sun, 07/10/2011 - 01:34 Abdirizak (not veried)

Please help I have problem araising from my database. I have made database about my institution in the registration form
I want to add all required information grathering from the students I hit the problem of picture while I am using visual
basic 6.0 on the form of registry I want to add student's photos when is registering I have no Idea about it nor code and
how to store in SQL the type of sring i choosing.
please if you know that help

I have problem on how to load a picture on registration Form Sun, 07/10/2011 - 01:33 Abdirizak (not veried)

Please help me I have problem araising from my database. I have made database about my institution in the registration
form I want to add all required information grathering from the students I hit the problem of picture while I am using visual
basic 6.0 on the form of registry I want to add student's photos when is registering I have no Idea about it nor code and
how to store in SQL the type of sring i choosing.
please if you know that help

limit the file size of photos to be uploaded Thu, 04/21/2011 - 15:33 Hendri Alrasim (not veried)

how the writing is right when we want to make the image upload facility in VB6 using the common dialog and limit the le
size of photos to be uploaded?

please help me!

database Tue, 04/12/2011 - 09:50 sampelit (not veried)

am using stringless connection but i can't move next, or previous rather it is moving rst and last. and i don't know how i
can load picture into datareport so that when i move next the picture will change to the next person's picture. thanks in
anticipation

VB 6 IMAGE CONTROL Thu, 03/31/2011 - 03:48 Anonymous (not veried)

how to get picture from common dialog control to chose any picture and load into the access database

camera Sat, 02/12/2011 - 04:57 Anonymous (not veried)

please help..... how to apply my laptop camera in the form to capture and saving a pictures...thanks

camera Wed, 02/09/2011 - 04:27 Anonymous (not veried)

hi can you help me plz how to put my camera on the form, what VB tool i use an
d what is the code...plzz.......

VB image loading Tue, 01/18/2011 - 01:33 Anonymous-- (not veried)

please...help!!! I need a VB code for loading images, interpret and detect image from the scanner...
Please...help!!I need this badly...

how to insert image in visual basic Thu, 12/30/2010 - 06:01 Anonymous (not veried)

how to insert image in VB .after make the form the image is invisiable .after click that is visiable.plz send me coding of
that program
I can't conceive how to do Mon, 03/05/2012 - 02:28 Orlando Seo (not veried)

I can't conceive how to do this and get animated images. Could give give brief comments and a couple of lines of
code to get me started.

help with saving command using data enviroment Wed, 12/08/2010 - 03:35 Anonymous (not veried)

hi all,
i have a project to do and am using dataenviroment but i cant save the les to my database
please help

Project Guide Sat, 10/02/2010 - 12:40 Mugees Ahmad

Sir/Mam
Iwant to know how to start Vb project what Procedure?
Mugees Ahmad

Loading an image in VB using Vc++. Mon, 08/23/2010 - 00:10 Asma (not veried)

Please help????? Urgent!!!!

HOW CAN I ADD THE ANIMATED FILE INTO IMAGE Wed, 08/18/2010 - 08:40 Anonymous (not veried)
BOX
Hello... anyone can tell me how to add the animated graphics les into my vb form and how can i run it...

Animation Wed, 10/13/2010 - 03:18 Anonymous (not veried)

if you want to add animation, use .gif les in loading pictures.. or just use Flash animations..
Animation wrong info Tue, 08/02/2011 - 22:00 Anonymous (not veried)

animated .gif doesnt work with Default Picture components. You need to ip it with looping

Animation Sun, 09/11/2011 - 09:35 John Smyth (not veried)

re animaion looping of picturebox. I can't conceive how to do this and get animated images. Could give give
brief comments and a couple of lines of code to get me started.

Thanks, John Smyth

Image Thu, 07/08/2010 - 21:51 elango

Dear Sir

I Want to know "how to insert image at run time?"

Elango.K
+91-9842604398

image control Thu, 06/03/2010 - 03:25 Neet (not veried)

sir,
i want to keep some image paths in an excel sheet column. can i use
variablename=selection.value
Image1.Picture = LoadPicture(variable name insted of path)

Load Image at Run Time Sat, 05/15/2010 - 08:41 Karthick VR (not veried)

Hi, Can anyone help me how to create a program to ask for the user to load image at run time and display it?

e.g. Uploading pictures in social networking proles.

Show image at runtime Mon, 12/13/2010 - 04:58 Anonymous (not veried)


''''add a cmd button
''''add a picture box
''''add a image contorol and set its property : strectch to true:
Private Sub command1_click()
Dim imgpath As String
imgpath = InputBox("Please enter image path", "image oath", "C:\Documents and Settings\All
Users\Documents\My Pictures\Sample Pictures\Sunset.jpg")
Picture1.Picture = LoadPicture(imgpath)
Image1.Picture = LoadPicture(imgpath)
'''note the dierence image1 ts well where as picture box '
''' does not , this coz of the property strectch
End Sub

Load Image at run time. Tue, 11/30/2010 - 19:25 Don (not veried)

First and foremost,


this codes snippet really isn't mine.
but here it is.

Private Sub Pic1_Click()


Dim l As String

On Error GoTo ErrorHandler


With objCD
.CancelError = True
.DialogTitle = "Open Image"
.Filter = "Images|*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.raw;*.rle|All Files|*.*"
.ShowOpen

' Loading picture on the rst picture box


Pic1.Picture = LoadPicture(.FileName)

' Writing image properties


lblPath.Caption = "Reference Image: " & .FileName
lblSize.Caption = "Image Size: " & Pic1.ScaleWidth & " x " & Pic1.ScaleHeight
lblPic1.Caption = "File Name: " & .FileName

End With

ErrorHandler:
End Sub

please take note that


pic1 is a picture box

hope i've help


P.S
You need to check the Microsoft Common Dialog Control 6(SP3) on the components(CTRL+T).
then draw the common dialog box on your form.
in here, I named it obj.

Thanks all Works fine for me. Sun, 10/23/2011 - 16:14 Anonymous (not veried)

Thanks all
Works ne for me. Now I can load my pictures.

Sizing a webcam picture for thumbnail Tue, 03/09/2010 - 02:40 PhilipSA (not veried)

Hi. We have web cam pics as .jpg's, but when I load the pic in VB6, I want the pic sized to t a thumbnail size, but all I can
actually see is the top corner of the actual pic.
Then I tried using an image, which shows the whole pic, but the control has now been resized at run time to be the size of
the pic which is way too big. I want a standard thumbnail size!

Any suggestions?

vb6 image from access Sat, 02/20/2010 - 20:10 ian fuentes (not veried)

hi there.. i just want to create a program in vb6 that is using ms access as its database, i use adodc to connect them.. i
already bind those with the textboxes but the problem is i dont know how to bind the images in order to view them on vb6
along with their corresponding names and information. can you please help..
heres my email..
ians_acess@yahoo.com

re: vb6 image from access Sat, 08/14/2010 - 23:22 t13b (not veried)

I was able to accomplish this by using a dataSet. With the DataSet, I changed the Image column type to 'image'
before dragging the dataset onto the form.

Now, just to gure out how to upload images from the application to the database. I hope this helps you some
though---if not too little too late :)

Depending on the type of Thu, 02/16/2012 - 03:25 Michael Jackson Lyrics (not veried)

Depending on the type of image, the image may or may not appear distorted when stretched this is
something you need to experiment with.

how can i bind picture to vb6 using ms access Tue, 02/16/2010 - 16:53 ian fuentes (not veried)

hi im just a 1st yr collegestudent, i just want to ask ahm i used adodc connection in vb and access, im trying to build a
program in vb. data are from access but adodc cconnection only show text,can i also bind a picture on it along with their
corresponding details from access,,, pls help

use this code to bind images Sun, 06/13/2010 - 05:29 Mr.P (not veried)

use this code to bind images with picture boxes Mr.p


1.Make 4 picture boxes with corresponding images of your info.
2.Make another pic box named "PictureShow"
3.make a timer >set interval to your choice
4.make a textbox which reads the primary key no.
follow the code
Private Sub Timer1_Timer()
If Text1.Text = "1" Then
PictureShow.picture = Picture1.picture
ElseIf Text1.Text = "2" Then
PictureShow.picture = Picture2.picture
ElseIf Text1.Text = "3" Then
PictureShow.picture = Picture3.picture
ElseIf Text1.Text = "4" Then
PictureShow.picture = Picture4.picture
End If
End sub

Now when you change the item selection then


the corresponding picture will appear

'If the code doesn't work then call "Help MR.P"


then i'll come up with aonther code

vb Fri, 02/12/2010 - 18:40 nhAzEr (not veried)

hi, However how can you give me the code on how I am going to save the picture in the database or in the ms access?.
Answer : how to bind images with pictureboxes Mr.p Sun, 06/13/2010 - 05:28 Anonymous (not veried)

use this code to bind images with picture boxes Mr.p


1.Make 4 picture boxes with corresponding images of your info.
2.Make another pic box named "PictureShow"
3.make a timer >set interval to your choice
4.make a textbox which reads the primary key no.
follow the code
Private Sub Timer1_Timer()
If Text1.Text = "1" Then
PictureShow.picture = Picture1.picture
ElseIf Text1.Text = "2" Then
PictureShow.picture = Picture2.picture
ElseIf Text1.Text = "3" Then
PictureShow.picture = Picture3.picture
ElseIf Text1.Text = "4" Then
PictureShow.picture = Picture4.picture
End If
End sub

Now when you change the item selection then


the corresponding picture will appear

Or

you can create a column in MS acess with the locations of your picture corresponding to the information
and in your form do this:-
1.create a text box text1 which reads your picture location
Private Sub Timer1_Timer()
If Text1.Text = "" Then
else
pictureshow.picture = text1.text
End If
End Sub

'If the code doesn't work then call "Help MR.P"


then i'll come up with aonther code

Answer : how to bind images with pictureboxes Sun, 06/13/2010 - 05:03 Anonymous (not veried)

Use this code to bind images with picture boxes


Method 1-
----------------------------------------------------------------------
For four items
1. make 4 pictureboxes which contain your images.
2.make a id number in ms access le make a text box which reads from the
now follow the code
Private Sub Timer1_Timer()
End Sub

image box Thu, 01/07/2010 - 04:55 Anonymous

i didnt get it....so confused...

Watch Accessories Thu, 11/26/2009 - 02:23 Watch Accessories (not veried)

Watch Accessories Watch Batteries Watch Battery

about image and tables with calculation problem Sat, 10/03/2009 - 01:36 jatin (not veried)

Dear Sir
Sir i have some problem. i m creating a project in visual basic. but i have some problem in this as given below:-
1. i want to that how we can insert a picture on a form in a passport size. and i want when we open the any record of
person then his photo also show. please give me a source code for this.
2. i want to when we open a person record his details also show like, total amount due of his etc. and also a print

help about ICO files Sat, 09/19/2009 - 08:32 Pleasure (not veried)

what type of les can i use in command buttons? i downloaded a winrar le with ico pictures and when i loaded it in
properties of command button it returns an error msg: invalid picture. what picture is VALID for command buttons? is
there a pixel limit?

VB6 Doesn't Support... Tue, 05/25/2010 - 11:52 NebezB

You can't load a 32-bit truecolor/alpha transparency .ico le.


Using IcoFX (google it, it's free), load your icon and save it as a 24-bit true-color icon, as that's the most that Vb6 can
support.
As for icon size, I'm pretty sure it can support 256x256 no problem, but I'm just guessing since I've taken it up to
48x48 without any errors.
VB6 doesn't supports icon Wed, 04/28/2010 - 05:07 Anonymous (not veried)

VB6 doesn't supports icon les with modern characteristics i.e. 256x256 or true color+alpha etc. In this case you can
use a free Icon tool like the IconFX (http://icofx.ro) to actually "strip down" the unsupported Images from the ICO le. I
really don't remember which properties are supported actually, but I believe it must be something like 8 bit color with
a maximum of 16x16 pixels. But i 'm not sure start to strip down save and try. Trial and Error my friend...

VisualBasic Sat, 10/31/2009 - 06:22 Kripanithi (not veried)

u can use .ico les for command buttons. Extract the downloaded winrar of .ico les and store to a particular location
and then open it or specify the path correctly. u will be able to insert the .ico image perfectly.

loading picture from file in Visual Basic Thu, 04/30/2009 - 19:17 JIGer (not veried)

Can someone gives me an explanation and sample code if possible:?

I make an inquiry program in database with over 100 employees and id like to put a picture in the program
with the corresponding person i've searched ?

Thanks a lot BRO!!

image from web browser Tue, 04/14/2009 - 22:24 mizkhyz (not veried)

can you help me?

i need to get an image from web browser that i putted to my vb form.


the image to be loaded is to be place on the imagebox in my vb form.

thank you in advance.


Adding a New Image via VB Mon, 03/23/2009 - 01:04 Anonymous (not veried)

hey Guys, I have a little problem here.


i have to create a software where an image of a design needs to be added along with the Design ID as its name in a folder
which can be used later to preview the design.
I know how to preview the design. But I don't know how to add them using Common Dialog Control

How Can I? Please..... Thu, 03/19/2009 - 05:10 Pogi Rodriguez (not veried)

I am working on my thesis and i am just a beginner using vb. I need codes for my program that will upload picture
together with other text data of the picture. I also need to edit what I uploaded after wards. I don't know how to control
the database. thanks. I hope somebody can help me with this.

begginer needs help Tue, 03/17/2009 - 03:27 Anonymous (not veried)

hello

i am currently learning to use visual basic at my school during my computers class and am still a begginer.

as a little home project, i want to create a countdown timer that counts down from 20 seconds when open, using images
(eg. image of number 20, number 19 etc.) and when this timer reaches 1 (1.bmp) i want it to run a le (i can make the
program run a le, just not when it reaches 1), though i am unsure of what sytax to use to do this.

i was thinking:

if picbox1.image = ("1.bmp") then

OR

if picbox1.image Is ("1.bmp") then

or something along thoes lines, this may be fairly jumbled and hard to understand but please help.

Reply for Image List Mon, 03/23/2009 - 00:59 Anonymous (not veried)

One solution would be to rstly rename your les as 1, 2, 3, 4, ....20, save all of them in a particular folder and then
use the following timer code:
rstly create a variable as int A and set its value to 20. This will be used to refer to your image

Private Sub T1_Timer()


t1.Interval = 50
picbox1.Image = & "\" & A & "<.jpg> or <.bmp>"
t1.Enabled = True
If A =1 Then

Else
A = A-1
End If
End Sub

try and do let us know

Remote accessing Mon, 01/12/2009 - 03:25 Anonymous (not veried)

Hi all,
I have a requirement where I have to access the image les at the server from a remote machine located and connected
thru internet. I am able to do the same in loval machine. But, how to access the les in remote server or machine. can any
one please send me the code snippet of the same to shankarravi18@redimail.com. its damn urgent......Thanx
Ravishankar

capturing picture Wed, 12/17/2008 - 04:08 khaboy (not veried)

help me..... please!!!!!!


i wish to know to make a program that will capture the image of the user everytime they log in and save it automatically
in t5he database(ms access)....

i hope you answer my question. i need it on my project..


Thanks in advance!!

gr8 Mon, 11/17/2008 - 23:18 Anonymous (not veried)

Solved my prob...... simple and helpful article.........

I got it Thu, 10/16/2008 - 07:09 Anonymous (not veried)

The 2 comments below this comment is posted by me.


I GOT the ans to my Problem.
Help Please Thu, 10/16/2008 - 00:49 Anonymous (not veried)

This is my code
------------------------------------------
Option Explicit
Public Function LoadPicture(MyPic As Image)
imgMyPic.Picture = LaodPicture("f:\MyPic.jpg ")
End Function

Private Sub Form_Load()


LoadPicture
End Sub

-------------------------------------------

I am still getting error please help I am stuck

check spelling, loadPicture Thu, 07/15/2010 - 11:37 Anonymous (not veried)

check spelling, loadPicture

Try this Option Fri, 04/03/2009 - 04:30 Thangavelu (not veried)

Try this

Option Explicit
Public Function LoadPicture(MyPic As Image)
imgMyPic.Picture = LaodPicture(MyPic)
End Function

Private Sub Form_Load()


LoadPicture("f:\MyPic.jpg ")
End Sub

You spelt load wrong Fri, 03/06/2009 - 02:44 Anonymous (not veried)

Im not sure whether you just copied it wrong here but you spelt load wrong (laod insted of load) try changing that
then it should work
Help with Image problem Fri, 10/24/2008 - 11:04 Kercyn

You can try this:

Private Sub Form_Load()


imbMyPic.Picture = LoadPicture("F:\MyPic.jpg")
End Sub

I hope this will work :)

Problem Thu, 10/16/2008 - 00:31 Anonymous (not veried)

The rst program in this tutorial did not work.


I get an error variable not dened .
Please help

Image problem I need help with! Sat, 06/28/2008 - 09:01 Anonymous (not veried)

This could be long, so bare with me.


I want to be able to load a picture into a database. I can already do this by knowing the exact name of the le, but I would
rather have a way of browsing the computers les, like in lots of programs for uploading images, and the just click the le
that I want and save it.
Is this possible in VB6?

VB to save pictures from computer Wed, 08/27/2008 - 09:07 Anonymous (not veried)

1. Place the Common Dialoug Control (name- CommonDialog1) on your form


2. then add and Image control(name- Image1)
3. create a command button (name- Open)

write the following code

CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
lblRegistrationCard = CommonDialog1.FileName

From this common dialoug control you can access any picture from your computer
rock Sat, 02/18/2012 - 03:23 play a ash game (not veried)

using LoadPicture at run-time compared to selecting a le for the control's Picture property at d

Load Picture Wed, 06/10/2009 - 21:33 Krezent (not veried)

Thanks a lot.. I 've been looking this kind of code for very long time.. However how can you give me the code on
how I am going to save this in my database.

image control Wed, 06/25/2008 - 00:02 badarinarayan (not veried)

I am having lots of scanned objects in .jpg format and the scanned objects are bigger than the monitor screen size and
hence i am facing problem in displaying the scanned object within the image box control. If someone could tell me how to
enable the user to navigate the whole scanned object using the scroll bars of the image control.

Stretch property missing... Sun, 01/06/2008 - 15:47 Anonymous

I've updated my Visual Basic 6 with SP6 and there is no longer stretch property of the PictureBox. Can someone tell me
how to make an image stretch using the new features? Or is there some bug or a problem? 10x in advance

Re: Stretch property missing... Thu, 02/14/2008 - 11:08 Anonymous

The PictureBox control does NOT have a Stretch property! Only the Image control has a Stretch property.

This has got nothing to do with your using SP6. There's no kind of bug in your Visual Studio/Basic 6.0.

The PictureBox control does have an AutoSize property, but it doesn't really do the same thing as Stretch. You can
give AutoSize a try, but I suggest you use the Image control instead.

:-)
- SDR

Math Tue, 07/24/2007 - 00:33 Anonymous

Wow! its realy for beginners..it could help a lot for a neophite like me
>< Thu, 04/19/2007 - 01:54 Roda

I didnt have the graphics folder so i couldn't do these >>

Me too ! Sat, 01/16/2010 - 03:10 perce95

Me too !

Unless otherwise noted, all content on this site and in the source samples is Copyrighted 2011 by the owner of vb6.us.
All rights reserved - Contact Information

Anda mungkin juga menyukai