Solved

changing mousepointer over command buttons

Posted on 2000-03-31
8
322 Views
Last Modified: 2012-06-21
Hi
  How do I make the mousepointer change to a finger when the mouse moves over a command button in VB?  I need to be able to do this for buttons that I currently have on forms and buttons that will be created and loaded during the application's runtime.
Thanks for your help,
DoughBoy
0
Comment
Question by:DoughBoy
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 2675446
Create a Cursor in the shape you like then store it in a Resource file.  Assign it to the button like this:

Private Sub Form_Load()
    Command1.MousePointer = 99 'custom
    'Create a custom cursor and save it in a resource file
    'The ID of the cursor is the first arg to LoadResPicture
    Command1.MouseIcon = LoadResPicture(101, vbResCursor)
End Sub
0
 
LVL 3

Expert Comment

by:Foyal
ID: 2675583
You can set the MouseIcon property of the command button to the picture you want at design time and that's all you have to do. The cursor will be saved in the form's resource file (.frx)automatically.

Erick37- Does this method use more resources?
0
 

Expert Comment

by:AshokKumar
ID: 2675715
Here it goes my friend.

First create a control array. Set these at designtime for the 0 th index object as:

MouseIcon = vbHand (Choose from cursors)
MousePointer=99

Then in form load code this

For i = 1 To command1.Count - 1
    Command1(i).MouseIcon = Command1(0).MouseIcon
    Command1(i).MousePointer = Command1(0).MousePointer
Next

If u add any other control also set the same again to that control. Now it should work fine. <Smile> Get back to me


0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Accepted Solution

by:
AshokKumar earned 100 total points
ID: 2675722
Oops. i clicked comment instead of answer. The above code is your solution friend. <Smile>
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2676025
>>>MouseIcon = vbHand ?

What is this?  Shoudn't this point to an ico file?

If you store a custom cursor in the form (frx), then it will take more resources than by using a resource file if you have more than one form with custom cursors.  It is good practice to use resource files to store cursors, icons and strings.
0
 
LVL 3

Expert Comment

by:Foyal
ID: 2676171
Erick37 - Thanks, I was wondering about that.

See 'ya,
Foyal
0
 

Author Comment

by:DoughBoy
ID: 2678740
Thanks very much!
It works very well.
Best Regards

:)

DoughBoy
0
 

Expert Comment

by:AshokKumar
ID: 2678765
Erick37
MouseIcon=VbHand  In the brackets i ahve mentioned to select from available cursors or icons. I thought it would be simpler if i say like that. Sorry if i am not clear.

DoughBoy
Thanks guy. <Smile and Wink>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 55
Microsoft Access combo box help 2 47
fso.FolderExists("\\server\HiddenFolder$") 4 66
RUNRMTCMD from AS/400 12 47
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question