Windows Develop Bookmark and Share   
 index > Windows Forms General > Inheriting a form's cursor property
 

Inheriting a form's cursor property

PROJECT REQUIREMENT
The user selects a tickmark from a list of bitmap images (i.e. checkmarks,
pluses, and other various symbols) populating a grid.  When the user clicks
on a row, the mouse changes to the selected image.  With the new mouse
cursor, the user moves to and clicks on one of any various other controls
populating the form (textboxes, comboboxes, datetimepickers and
numericupdowns--each control has an invisible picturebox to its right).
When the user clicks on one of the four "valid" controls, the picturebox is
populated with the cursor's equivalent bitmap image and the cursor returns
to the default arrow.

ISSUE
Since every control has a cursor property, can all controls (including
groupboxes, panels etc) inherit just the cursor property of the form?  If
so, how?  Then I can just write code to manipulate the form's cursor.  I can
make the above functionality work the "hard and dirty way" by iterating through all
the controls on the click events but am trying to improve my .Net skills and
find a more elegant approach.  I would appreciate any advice on this matter.

--Charles W.
MigrationUser 1  Thursday, January 30, 2003 4:05 AM
Right now, there is no way to do this more elegantly.  We're addressing the making the Cursor property ambient in a future relase.  Your current method of iterating through the controls and setting their cursor will work fine (and it is likely how we'll end up implementing this feature in the framework)

 - mike
MigrationUser 1  Thursday, January 30, 2003 4:50 PM
Thanks for the quick response Mike!  I guess I will stick with interating through the controls.

IMAGE FILES
Just in case anyone needs to know how to save and retrieve image files stored on SQL Server when working with VB.Net, the following is a good reference: http://support.microsoft.com/default.aspx?scid=kb;EN-US;308042e

FOLLOW-UP QUESTION
In working on this cursor-bitmap issue, I have discovered that it does not appear possible to use colored cursors.  (VB.Net only allows the creation of cursors in monochrome and any cursors I create using MS Paint are rendered black and white when used in my application.  Does the cursor class support custom-created cursors created outside the VS.Net?  i.e. can I create and use colored cursors?  If so, how?
MigrationUser 1  Friday, January 31, 2003 9:35 PM
Colored and animated cursors are, unfortunately, not supported by Windows Forms.  We use oleaut32 to load cursor files and this limits us to black and white, static cursors.

 - mike
MigrationUser 1  Friday, January 31, 2003 10:27 PM

You can use google to search for other answers

Custom Search

More Threads

• Need help with textbox
• Preservation of contents of the form in a database
• How can I find the parent form of a TreeNode?
• how to open MdiChild from another MdiChild
• How to surpass maximum form size limits?
• DragDrop file into RichTextBox *without* icon?
• RTF jpegblip and jpeg image are not displayed in RichTextBox
• ListView DrawColumnHeader how to draw hottracking
• Dotfuscator and localized forms
• Slow performace when setting this.Text