Big Cursors

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

José  Hernandis sent me an email a few weeks ago asking for advice on using cursors larger than the standard 32 x 32 bit.   It seems that Windows and/or PC  hardware  does not support larger cursors, at least not that I could track down.   I developed a model using sprite processing concepts to move a bitmap image around on the screen and which José successfully adapted for his application.   


Here is how it works:

bulletInitialization: 
bulletMake a copy of the form in a bitmap, FormImage
bulletMake a 2nd copy of the form in another form sized bitmap named WorkImage
bulletLoad a cursor bitmap with transparency features activated. 
bulletWhen we want to start showing the large cursor: 
bulletTurn off the form's cursor (set Cursor := crNone;)
bulletDraw the cursor bitmap on the form with it's top left corner at the mouse Cursorpos field. 
bulletSave the rectangle coordinates of the cursor image in  Oldrect 
bulletAn  OnMouseMove exit is where the magic happens:  
bulletCopy an area the size of and located at the cursor from FormImage to Workimage - this will erase the old cursor. 
bulletChange the location of the cursor image to the new mouse coordinates and save new image coordinates in Newrect.
bulletDraw cursor image  on WorkImage.
bullet.Copy an area the size of the overlapped old and new cursor rectangles from  WorkImage to the form canvas.  The Windows API function UnionRect is a convenient way to make this  rectangle.
bulletMove Newrect  to Oldrect to set up for the next mouse move. 

That's the bulk of it.  José's  128 x 128 cursor image was much better than my test cursor so I'm using it in this demo.  He says the "B" stands for "Ballantines", an English whiskey, and he is using it in a computerized board game to be played at discos and pubs.  

Since form painting precedes drawing controls, the cursor disappears behind buttons and other TWinControl descendants.  Activating the OnMouseMove exits for the controls  will keep the cursor positioned accurately.   For some reason the big cursor will appear on top of TGraphicControl  controls (e.g.  TLabels and TImages)  - I haven't figured that one out yet.  For the other controls, the big cursor reverts to the small cursor while over the control, which might be an acceptable way to handle the situation.    

 

Download source

 

Created: July 29, 2017

Modified: July 29, 2017

 

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2017, Gary Darby    All rights reserved.