Curseur - Point Chaud

Résolu
bucherb Messages postés 412 Date d'inscription lundi 26 mai 2003 Statut Membre Dernière intervention 13 août 2007 - 17 janv. 2005 à 10:35
bucherb Messages postés 412 Date d'inscription lundi 26 mai 2003 Statut Membre Dernière intervention 13 août 2007 - 20 janv. 2005 à 11:09
Hello!


Est-ce que qqun saurait comment faire pour définir le point chaud (hot spot) d'un curseur qu'on crée soit-même dans le code..... Par défaut il est au centre...

-------------------------
Trambert le vert

3 réponses

cs_coq Messages postés 6349 Date d'inscription samedi 1 juin 2002 Statut Membre Dernière intervention 2 août 2014 101
17 janv. 2005 à 12:22
Voilà :
Dans une réponse au message Set cursor hotspot in cursor created from bitmap : http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.gdi/2004-09/0183.html


<HR>


> I'm trying to create cursors "on the fly" as it were, by creating an
> in-memory bitmap, painting on a graphics object derived from the bitmap, and
> obtaining an Icon handle from the bitmap which is then used to create the
> cursor.
<code snipped>
> This gives me a 32x32 pixel cursor showing a blue box with a nice shadow.
> The problem is that I haven't been able to set the hotspot on the cursor in
> any way.
>
> So if anybody knows how to set the hotspot on a cursor, I'd be good to go.
> Just keep in mind that I need to create the cursor images on the fly...

I don't see anything in the Cursor class information in the MSDN about how to set the hotspot of a cursor, so here's the GDI method:
1) Call GetIconInfo() on the cursor handle (h) to fill an ICONINFO structure
2) Set the xHotspot and yHotspot members of this structure
3) Call CreateIconIndirect() passing back in the ICONINFO structure
4) Call DeleteObject() on the original cursor handle to clean up the GDI resources.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://www.mvps.org/EDais/
<!-- body="end" -->


<HR>

Cocoricoooooooo !!!!
coq
MVP Visual C#
3
cs_coq Messages postés 6349 Date d'inscription samedi 1 juin 2002 Statut Membre Dernière intervention 2 août 2014 101
17 janv. 2005 à 12:16
Tu vas devoir passer par les API et recréer un curseur à partir du tiens je crois.
J'avais vu une explication il n'y a pas très longtemps, je la recherche.

Cocoricoooooooo !!!!
coq
MVP Visual C#
0
bucherb Messages postés 412 Date d'inscription lundi 26 mai 2003 Statut Membre Dernière intervention 13 août 2007
20 janv. 2005 à 11:09
Yes merci bien.

-------------------------
Trambert le vert
0
Rejoignez-nous