简体   繁体   中英

What to import to customize cursor in asp.net?

just wanted to ask how to customise the cursor in asp.net using c#. Currently i tried this code out but it's not working...

this.Cursor = new Cursor(Application.StartupPath +  "\\Cursor1.cur"); 

and I got this error: 错误

I wonder if I need to include more stuff here:

using System;
using System.Web.UI;

I searched a lot and I can't see others having this kind of problems...

Can you help me?

EDIT:

Actually I wanted to create a web application based in aspx and including a whiteboard in my web page. So I wanted to make it such that when i press the 'pencil' icon, the cursor will change to a pencil. Is it possible?

You can't use Windows cursor files (.cur) in a web application. For one thing, what will non-Windows devices do with it. The technique you're using is for Windows Forms (desktop) applications.

The way to change the cursor on the web is via CSS properties.

So for instance if you want the cursor to change when the user hovers over a certain image, you could define it like this:

HTML:

<img id="Image1" src="myimagefile.jpg"/>

CSS:

#Image1:hover
{
  cursor:pointer;
}

For a full list of cursor types you can use, see http://www.w3schools.com/cssref/pr_class_cursor.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM