Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27531

Struggling with Cursor

$
0
0
Hi, I'm trying to sort the wheat from the chaff with so many examples of 'How to load custom Cursor Images' into a project. I am trying to import 8 new, sequentially numbered, cursors into my project. I would like to add and allocate them, one each to a Label in a TableLayoutPanel, using a loop, but can't discover how to enter even one.

When I've done something similar with Images for PictureBoxes, I've used:

vb.net Code:
  1. Dim Pcx As New PictureBox           'Create new picturebox
  2.             '  other stuff
  3.             Pcx.Image = My.Resources.NS60
And had no trouble with Line 3, however when I try:

vb.net Code:
  1. Dim Cur As Cursor
  2.            
  3.             Cur = My.Resources.Cursor0
Whilst I'm typing Line 3, "Cur = My.Resources." , as I type the '.' after Resources I'm presented with a drop-down menu of choices... amongst which are all my custom cursors from Cursor0 to Cursor7, in this case I selected Cursor0, and it's accepted it as you can see...

However, having 'entered' the line, that red 'squiggly' error under-line appears. Hovering the cursor over it I get the message: "Value of type 'System.Drawing.Bitmap' cannot be converted to 'System.Windows.Form.Cursor'."

So I changed it to:
vb.net Code:
  1. Dim Curs As New Cursor  =  cursor.My.Resources.cursor0
And got another red Squiggle, this time is says : "End of statement expected." but I can't find what it's asking for.



So I tried:
vb.net Code:
  1. Dim Cur As Object
  2.            
  3.             Cur = My.Resources.Cursor0
Which is accepted, but now I can't find how to get from 'Object' to 'Cursor'.


There are loads of examples of how to do something similar, usually with only one or two cursors, and I've not yet found one which specifically allocates them to a control, I've tried each one as I've found it but I'm getting nowhere...



Poppa.

Win.7 Pro. 64bit
8 Gig RAM
Quad core processor.

Viewing all articles
Browse latest Browse all 27531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>