hi,

I wonder if it is possible to make mouse cursor image transparent (using
alpha bending).

thanks.

Re: Mouse Cursor transparent image by Stoitcho

Stoitcho
Mon Aug 09 15:29:44 CDT 2004

Hi jjj
I'm not sure if cursor files (*.cur) support alpha blending. But they have
do have transparent color. Evidently, crusors have hollows and different
shapes.
Do you want translucent cursors?


--

Stoitcho Goutsev (100) [C# MVP]


"jjj" <nelsonac@hotmail.com> wrote in message
news:4117dbf2_2@news.tm.net.my...
> hi,
>
> I wonder if it is possible to make mouse cursor image transparent (using
> alpha bending).
>
> thanks.
>
>



Re: Mouse Cursor transparent image by jjj

jjj
Mon Aug 09 22:11:47 CDT 2004


"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:uCpLO9kfEHA.3944@tk2msftngp13.phx.gbl...
> Hi jjj
> I'm not sure if cursor files (*.cur) support alpha blending. But they have
> do have transparent color. Evidently, crusors have hollows and different
> shapes.
> Do you want translucent cursors?
>
>
> --
>
> Stoitcho Goutsev (100) [C# MVP]


Hi Stoitcho,

I'm trying to do grid column move(dragdrop), in which, image under cursor
can be done with unmanaged code.

Instead, I used cursor image (without using unmanaged code). The only thing
is that the cursor image is not translucent, hence blocking the grid header
detail.

I think, I have no choice other then using unmanaged code.

Thanks.






Re: Mouse Cursor transparent image by Stoitcho

Stoitcho
Tue Aug 10 09:06:35 CDT 2004

Hi jjj

What you see in the application giving feedback when drag something over
their windows is not the cursor itself. During D&D the cursor is controlled
by the source application and it is the same for all targets. Yhe target at
the other hand can drag an image along with the cursor to provide visual
feedback to the user. Drawing translucent image can be done in .NET and you
don't have to use nay unmanaged API for that.

Look at the Graphics.DrawImage overloads that take ImageAttribute parameter.
In this image attribute you can set ColorKey or you have a more powerful
option to set a color matrix.

Using color matrix you can draw translucent bitmaps on the screen.
Color matrices works on the same way as transformation matrices with the
difference that they apply on color vectors [RGBAw] where w = 1. I believe
docs say wrong that the vector is [ARGBw]
Anyways, You can draw a translucent image using the following code

ImageAttributes ia = new ImageAttributes();
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = 0.5F; //50% transparency
ia.SetColorMatrix(cm);

using( Graphics g = CreateGraphics())
{
using(Bitmap bmp = new Bitmap(@"path to some image file"))
{
g.Clear(this.BackColor);
g.DrawImage(bmp, this.ClientRectangle, 0, 0, bmp.Width, bmp.Height,
GraphicsUnit.Pixel, ia);
}



--
HTH
Stoitcho Goutsev (100) [C# MVP]


"jjj" <nelsonac@hotmail.com> wrote in message
news:41183cf7_1@news.tm.net.my...
>
> "Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
> news:uCpLO9kfEHA.3944@tk2msftngp13.phx.gbl...
> > Hi jjj
> > I'm not sure if cursor files (*.cur) support alpha blending. But they
have
> > do have transparent color. Evidently, crusors have hollows and different
> > shapes.
> > Do you want translucent cursors?
> >
> >
> > --
> >
> > Stoitcho Goutsev (100) [C# MVP]
>
>
> Hi Stoitcho,
>
> I'm trying to do grid column move(dragdrop), in which, image under cursor
> can be done with unmanaged code.
>
> Instead, I used cursor image (without using unmanaged code). The only
thing
> is that the cursor image is not translucent, hence blocking the grid
header
> detail.
>
> I think, I have no choice other then using unmanaged code.
>
> Thanks.
>
>
>
>
>



Re: Mouse Cursor transparent image by jjj

jjj
Tue Aug 10 12:03:37 CDT 2004

I did try colormatrix, but without any success. Maybe I'll try again.


Thanks.