473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Need an images to act like a button

I need an images to act like a button ,
In the button's properties , you have the option to set an downpicture , so
If you push the button , there appears an image .
BUT when you hold the mouse down and move the cursor away from the button , it returns to it's origional state .

And if you do it with an image and mousedown option , it stays in that state .

So , is there an solution for the images ?
So it would change back again .
Or could you change the style of the button so it wouldn't look like a button no more .and it would appear to be an image .

(PS. how do I change the exe style to WS_EX_STATICEDGE )
Sep 17 '07 #1
12 2167
kadghar
1,295 Expert 1GB
I need an images to act like a button ,
In the button's properties , you have the option to set an downpicture , so
If you push the button , there appears an image .
BUT when you hold the mouse down and move the cursor away from the button , it returns to it's origional state .

And if you do it with an image and mousedown option , it stays in that state .

So , is there an solution for the images ?
So it would change back again .
Or could you change the style of the button so it wouldn't look like a button no more .and it would appear to be an image .

(PS. how do I change the exe style to WS_EX_STATICEDGE )
I've been playing around with what you said and this seemed to work just fine:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  2. Image1.BackColor = vbBlue
  3. End Sub
  4.  
  5. Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  6. If Button = 1 Then
  7.     If X < 0 Or X > Image1.Width Or Y < 0 Or Y > Image1.Height Then
  8.         Image1.BackColor = vbWhite
  9.     Else
  10.         Image1.BackColor = vbBlue
  11.     End If
  12. Else
  13.     Image1.BackColor = vbWhite
  14. End If
  15. End Sub
  16.  
  17. Private Sub Image1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  18. Image1.BackColor = vbWhite
  19. End Sub
HTH
Sep 17 '07 #2
Image. background?

=>works just fine for buttons , but not for images ...

No , I'm talking about something like this :
Attached Files
File Type: zip buttons problem.zip (6.3 KB, 93 views)
Sep 17 '07 #3
kadghar
1,295 Expert 1GB
Image. background?

=>works just fine for buttons , but not for images ...

No , I'm talking about something like this :
use that code, but instead of changing the background color change the image in it.

instead of writing image1.backcolor, use image1.picture
Sep 17 '07 #4
Well , I used a down picture for the button
(it's an option in properties , doesn't work for images )
Only in the button's properties
Sep 18 '07 #5
kadghar
1,295 Expert 1GB
Well , I used a down picture for the button
(it's an option in properties , doesn't work for images )
Only in the button's properties
Create a couple of dummy images, set them visible=false. One will be called dummy1, the other will be dummy2. Dummy1 will have in it the up picture, Dummy2 will have the down picture.

Change:
image1.Backcolor=vbBlue for image1.Picture = dummy2.Picture and,
image1.Backcolor=vbWhite for image1.Picture=dummy1.Picture

That's an easy way to assign images.
Sep 18 '07 #6
Could you attach a file that works, because nothing works here ...
Sep 18 '07 #7
kadghar
1,295 Expert 1GB
Could you attach a file that works, because nothing works here ...
I see what you mean, I tried that code with images but they didn't change every time, only when they wanted to.

I'll check it out.
Sep 18 '07 #8
Killer42
8,435 Expert 8TB
Here's one I've just created in VB6. It works, as far as I can tell.

Sorry, I was in a rush so there aren't a lot of comments, and I just grabbed two stock images that came with VB, so they don't look so good. But you can easily fix that.
Attached Files
File Type: zip Form1.zip (1.4 KB, 119 views)
Sep 18 '07 #9
Very good ! ,
but can you do it to with mouseover ?
not working here ...
Sep 19 '07 #10
Killer42
8,435 Expert 8TB
Very good ! ,
but can you do it to with mouseover ?
not working here ...
Not sure what you mean. That code was designed to make the image act like a button, as requested. And it worked on my PC.
Sep 20 '07 #11
hi i have used the code that u have given but got an error as
i am using it in the activex control
"Procedure declaration does not match description of event or procedure having the same error"
please help the solution as soon as possible
thanks
Sep 20 '07 #12
Killer42
8,435 Expert 8TB
"Procedure declaration does not match description of event or procedure having the same error"
Hm... I'm going to take a stab in the dark and say that you probably used the code for a control which is part of an array, so the procedure declaration (the Sub statement) needs an Index parameter.
Sep 20 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same...
0
by: Frenchie | last post by:
Hi, I have created a very neet menu from an example found on the MSDN library at: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.menuitembinding.imageurlfield.aspx My...
7
by: petr pilsl | last post by:
sorry - no idea where to post my question, so I crossposted to a linux and a html-authoring-group. Both groups might be familiar with wget. wget -p http://www.goldfisch.at does not load the...
2
by: chaos | last post by:
Hi all, i need help in this forgot password page, as the error message is show in another page cause the arrangement of the design in a mess. As i want to show the error message on the forgot...
1
by: ttamilvanan81 | last post by:
Hai everyone, i am new to javascript. Now i have doing one Image gallary application. In that application i have upload two images, one for Befor image and another one for after image. All...
7
by: Dave | last post by:
Hello All, These one may be a bit tricky, and what I'd like to do may not even be possible. I would love to hear any ideas you guys have for solving this. Here is the situation: I have a form...
3
by: tesa | last post by:
Thanks for the help early this morning! The one problem I can not figure out still is how to swap the images. I have the images in an array. is the image to start with.... then as the player...
0
by: JRough | last post by:
Hi, I have a page with a form that is included into a php page. It has some php variables which are headers based on the user choices. In the form I will send some mysql data columns but right...
1
rahulephp
by: rahulephp | last post by:
Hi there, Kindly have a look on below CSS property. What i want to ask is: when i'll click on a button, it should be look active. I mean it would have to get property of .sidebar_menu:active But...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.