Hi,
Make a new standard project.
Tools | Options ... [Editor] , check [x] the line Require Variable
Declaration
(not required for this problem, I think, but that helps anyhow).
In the form, create two image controls and a button.
Assign, for the first image control, the bitmap Microsoft Visual
Studio\Common\Graphics\Icons\Traffic\TRFFC10A.ICO
Assign, for the second control, the bitmap Microsoft Visual
Studio\Common\Graphics\Icons\Traffic\TRFF14.ICO
Add the code, under the form:
=====================================
Option Explicit
Private Sub Command1_Click()
Set Me.Image1.Picture = Me.Image2.Picture
End Sub
=====================================
Leave anything else unchanged (ok, you can also change the Stretch
properties to True, if you want)
Run the project.
Click the button, that will change the picture displayed on the first
image control.
Move another window over the first picture, then move it away.
Do you see the "green light" or the "stop" icon in the first image? You
should see the STOP control.
If it does, what do you do differently with your actual project? or in
what aspect this demo does not illustrates, incorporates the specifics
relative to what you do?
Vanderghast, Access MVP
giannis said:
When must i use the Me.Refresh ?????
I dont know when another window cover
my application !!!!!
When another window of Windows cover
and uncover my application's Form the Form
repainted from the beggining !!!
When I use PictureBox instead of Image control
there is not any sutch problem (but the picture
control dont support the streching of the image).
Why i dont have problem with PictureBox?
I found in internet a module that strech the
image of PictureBox and when i use this with
a PictureBox i dont have any problem.
But why this problem with the Image control?
I sended at the news the test with Image control
and nobody (except me) have any sutch problem !!!
Hi,
Ok, if I understand you correctly, the control are nice only if
you
force a repaint through something else covering then moving out of
the
way
of your form? If so, at the moment you make the change and wish to
see
it,
add the following line of code:
Me.Refresh
assuming your code is behind the form, Me, to be repainted, or
Me.ControlName.Refresh
Hoping it may help,
Vanderghast, Access MVP
I have the latest driver for my video card (ASUS 7100)
When I run this test all of the controls at the covered form
repainted !!! (images,buttons ...)
In Access i havnt any problem !!
Hi,
It can be a problem of DRIVERS. Be sure (well, that is hard
to
be)
that
your client use the latest DRIVERS available for the video card
at
the
manufacturer site (such as
http://www.atitech.ca/support/driver.html).
Access would not necessary use the same calls, in the same
order,
than
in
VB, and so, a difference in drivers MAY be an explanation.
Vanderghast, Access MVP
My problem is that i gave to other people this test
but they say that dont see the repainting (in VB)that
I see !!!
What is the problem ? (If my problem was a wrong
video card i will had the same problem in Access.)
Hi,
You may get better assistance in a dedicated classical VB
newsgroup,
but
it seems you did not asked to VB to handle the repaint for
you.
In
VB,
there
is a onPaint event (thing we do not have with Access, it is good
and
it
is
bad) which fires when the OS ask your program to repaint its user
interface.
Most control "know" how to redraw themselves, like buttons,
scrollbars,
but
some may not, like a picture box. I said "may" because they
have
a
property,
AutoRedraw, set to false by default. Set it to true and VB will
remember
any
drawing command you have done on the control (note that by
default,
the
form
Autoredraw is set to true, but for a picture box, it is set to
false).
Use
the Cls method to clear and start over.
Note that a Paint event occurs if your window was
partially
or
totally
under another one that moves out of the way, but also at loading
time,
and
at resize-enlarge (not if you resize-shrunk). You can also
wish
to
skipout
of the Paint event if your WindowState is minimized, testing for
that
state
early in the event subroutine.
Hoping it may help,
Vanderghast, Access MVP
I have the Access 2000 and the VB6.
I have made a test application with these two products:
I have made a form with an Image control that have an
stretched big image (a .jpg file 50 Kb).
I have put in this form a command button that opens
another empty form that cover the first form.
When I uncover the Form1 i see :
1) in VB the image and the button repainted again (!!!)
That is in the beggining i cant see nothing.
2) in Access the image and button dont repainted.
When i put 5-6 images on the form, then the repainting
hold for about 2 seconds(!!!!) in the VB Form but in
the Access nothing repainted and i dont need wait to see
all the initial form.
I will send two photos that indicate the before and
after covering result in the VB forms.
I need say to me what is the wrong of this problem with VB.
I have VB SP-5 and Access 2000 and Windows 98.
I dont believe that is may occur because of my video card,
because i dont have any other problem in Windows and
with 3D games.
(sorry for my English but i am fron Greece)