Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am develeoping a magnifier on Mouse move control application in c#.net . I need to replace the cursor with the magnifier control(magnifier control is a picturebox). So is there anyway to accomplish this .

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
359 views
Welcome To Ask or Share your Answers For Others

1 Answer

The example code below shows how to set a Cursor on windows form. The same approach can be used to set a Cursor for a Control too.

public class Form_With_A_Cursor_Example {
    public void Shows_A_Form_With_A_Cursor_Loaded_From_A_pictureBox() {         
        Form frm = new Form();
        PictureBox pb = new PictureBox() { Image = Image.FromFile( @"C:UsersxxxPicturessomeImage.bmp" ) };

        frm.Cursor = new Cursor( ( (Bitmap)pb.Image ).GetHicon() );

        frm.ShowDialog();
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...