473,387 Members | 1,348 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,387 software developers and data experts.

Cursor from BitMap

Can I create a cusor in vb.net code from a bitmap?
--
Dennis in Houston
Nov 21 '05 #1
6 6971
"Dennis" <De****@discussions.microsoft.com> schrieb:
Can I create a cusor in vb.net code from a bitmap?


See (complete thread):

<URL:http://www.google.de/groups?theadm=Pstdd.92876%24ct3.2218732%40wagner.v ideotron.net>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Does Herfried support a link that interest me, does it not work.

:-)

Cor
Nov 21 '05 #3
Hi,

You can create a bitmap then create the cursor from the bitmap.
Dim bmCur As New Bitmap(60, 60)

Dim g As Graphics = Graphics.FromImage(bmCur)

g.FillRectangle(Brushes.Transparent, 0, 0, 60, 60)

g.DrawEllipse(Pens.Red, 10, 10, 40, 40)

g.DrawEllipse(Pens.Red, 0, 0, 60, 60)

g.DrawEllipse(Pens.Red, 30, 30, 1, 1)

g.DrawEllipse(Pens.Red, 25, 25, 10, 10)

Dim ptrCur As IntPtr = bmCur.GetHicon

Dim cur As Cursor

cur = New Cursor(ptrCur)

Me.Cursor = cur

Ken

-----------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Can I create a cusor in vb.net code from a bitmap?
--
Dennis in Houston
Nov 21 '05 #4
"Cor Ligthert" <no************@planet.nl> schrieb:
Does Herfried support a link that interest me, does it not work.


I made a typo ("theadm" instead of "threadm"):

<URL:http://www.google.de/groups?threadm=Pstdd.92876%24ct3.2218732%40wagner. videotron.net>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
Herfried,

Sorry I remembered me this one again it is from Ken I took it already in my
HKW brainconnector replacer.

:-)

Cor
Nov 21 '05 #6
That works great. Thanks a lot.

"Ken Tucker [MVP]" wrote:
Hi,

You can create a bitmap then create the cursor from the bitmap.
Dim bmCur As New Bitmap(60, 60)

Dim g As Graphics = Graphics.FromImage(bmCur)

g.FillRectangle(Brushes.Transparent, 0, 0, 60, 60)

g.DrawEllipse(Pens.Red, 10, 10, 40, 40)

g.DrawEllipse(Pens.Red, 0, 0, 60, 60)

g.DrawEllipse(Pens.Red, 30, 30, 1, 1)

g.DrawEllipse(Pens.Red, 25, 25, 10, 10)

Dim ptrCur As IntPtr = bmCur.GetHicon

Dim cur As Cursor

cur = New Cursor(ptrCur)

Me.Cursor = cur

Ken

-----------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:73**********************************@microsof t.com...
Can I create a cusor in vb.net code from a bitmap?
--
Dennis in Houston

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim | last post by:
Hi, I would like to create a custom mouse cursor for my print preview page. I want to use a bitmap of a magnifiying glass with a plus in it. Pretty standard stuff. How do I change the cursor?...
0
by: Sam | last post by:
Hello all Could anyone please tell me if I can attach a transparent bit map to positions of the cursor without actually replacing the cursor? The bitmap would move with cursor. For example if I...
2
by: Peteroid | last post by:
This seems like it should be an easy task, but I just can't find the info on it. MSDN2 shows an example where the cursor is changed to the system default Cursors::Hand, but not how to make a custom...
0
by: Richard Lewis Haggard | last post by:
In an attempt to get around a resource leak issue, I tried to serialize a Cursor to a MemoryStream but the serialization fails with "Stock cursors cannot be serialized." This is puzzling since the...
2
by: Wilfried Mestdagh | last post by:
Hi, I create a new cursor like this: Bitmap bmp = new Bitmap(fileName); panel1.Cursor = new Cursor(bmp.GetHicon()); But now I want to embed the image in the executable. I have already add...
2
by: Tom C | last post by:
I see a lot of posts about creating a cursor from an image but is it possible to do the opposite? We have added code to allow a text box on a statusbar to be dragged to allow dropping an open...
1
by: pbernasc | last post by:
Does anyone know how to successfully load a custom color (32 bits) cursor in C# (under XP..NET 2.0 - or NET3.0 eventually)? All I could do using C# .Net support was loading a color cursor but ending...
2
by: swetha | last post by:
Hi, I am loading one bitmap file.I can able to find out the mouse cursor position values on that image.But after zooming also the values should not change.Is there any sollution for that. Hope...
2
by: ACS | last post by:
I have a C# application where I've grabbed a control's cursor handle using the WINAPI function GetCursor(). This returned an IntPtr and I want to check what type of cursor this is (arrow, sizing,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.