这是我的自定义WebBrowser control。
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;
public class RunescapeClient : WebBrowser
{
private const string RUNESCAPE_CLIENT_URL = "http://oldschool33.runescape.com/j1";
public RunescapeClient()
{
ScrollBarsEnabled = false;
ScriptErrorsSuppressed = true;
IsWebBrowserContextMenuEnabled = false;
AllowWebBrowserDrop = false;
Navigate(RUNESCAPE_CLIENT_URL);
}
protected override void OnDocumentCompleted(WebBrowserDocumentCompletedEventArgs e)
{
if (Document != null && ValidClientUrl(e.Url.ToString()))
{
HtmlElement tableElement = Document.GetElementsByTagName("table")[1];
tableElement.InnerText = string.Empty;
}
}
private static bool ValidClientUrl(string url)
{
return Regex.IsMatch(url, @"http://oldschool\d{1,2}.runescape.com/j1");
}
}如何将此control的cursor更改为我的embedded .ico。我用谷歌搜索了一下,找不到任何关于custom controls的信息。
谢谢。
发布于 2013-04-25 14:41:22
光标始终由Cursor属性更改。如果您有一个自定义控件,这并不重要。
试试这个:
Icon ico = new Icon(@"C:\temp\someIcon.ico");
this.Cursor = new Cursor(ico.Handle);静态类System.Windows.Forms.Cursors包含所有系统游标。
要切换回默认系统光标,请使用以下命令:
this.Cursor = System.Windows.Forms.Cursors.Default;https://stackoverflow.com/questions/16207252
复制相似问题