<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FCursor</id>
		<title>Csharp/C Sharp/GUI Windows Form/Cursor - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FC_Sharp%2FGUI_Windows_Form%2FCursor"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Cursor&amp;action=history"/>
		<updated>2026-04-29T15:18:09Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Cursor&amp;diff=92&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Cursor&amp;diff=92&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Cursor&amp;diff=93&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/C_Sharp/GUI_Windows_Form/Cursor&amp;diff=93&amp;oldid=prev"/>
				<updated>2010-05-26T11:33:04Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==All Mouse Cursors==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class MouseCursors: Form&lt;br /&gt;
{&lt;br /&gt;
     Cursor[] acursor = &lt;br /&gt;
     { &lt;br /&gt;
          Cursors.AppStarting, Cursors.Arrow,       Cursors.Cross,       &lt;br /&gt;
          Cursors.Default,     Cursors.Hand,        Cursors.Help,     &lt;br /&gt;
          Cursors.HSplit,      Cursors.IBeam,       Cursors.No,          &lt;br /&gt;
          Cursors.NoMove2D,    Cursors.NoMoveHoriz, Cursors.NoMoveVert,&lt;br /&gt;
          Cursors.PanEast,     Cursors.PanNE,       Cursors.PanNorth,    &lt;br /&gt;
          Cursors.PanNW,       Cursors.PanSE,       Cursors.PanSouth,&lt;br /&gt;
          Cursors.PanSW,       Cursors.PanWest,     Cursors.SizeAll,     &lt;br /&gt;
          Cursors.SizeNESW,    Cursors.SizeNS,      Cursors.SizeNWSE,&lt;br /&gt;
          Cursors.SizeWE,      Cursors.UpArrow,     Cursors.VSplit,      &lt;br /&gt;
          Cursors.WaitCursor&lt;br /&gt;
     };&lt;br /&gt;
     string[] astrCursor = &lt;br /&gt;
     { &lt;br /&gt;
          &amp;quot;AppStarting&amp;quot;,       &amp;quot;Arrow&amp;quot;,             &amp;quot;Cross&amp;quot;,       &lt;br /&gt;
          &amp;quot;Default&amp;quot;,           &amp;quot;Hand&amp;quot;,              &amp;quot;Help&amp;quot;,     &lt;br /&gt;
          &amp;quot;HSplit&amp;quot;,            &amp;quot;IBeam&amp;quot;,             &amp;quot;No&amp;quot;,          &lt;br /&gt;
          &amp;quot;NoMove2D&amp;quot;,          &amp;quot;NoMoveHoriz&amp;quot;,       &amp;quot;NoMoveVert&amp;quot;,&lt;br /&gt;
          &amp;quot;PanEast&amp;quot;,           &amp;quot;PanNE&amp;quot;,             &amp;quot;PanNorth&amp;quot;,    &lt;br /&gt;
          &amp;quot;PanNW&amp;quot;,             &amp;quot;PanSE&amp;quot;,             &amp;quot;PanSouth&amp;quot;,&lt;br /&gt;
          &amp;quot;PanSW&amp;quot;,             &amp;quot;PanWest&amp;quot;,           &amp;quot;SizeAll&amp;quot;,     &lt;br /&gt;
          &amp;quot;SizeNESW&amp;quot;,          &amp;quot;SizeNS&amp;quot;,            &amp;quot;SizeNWSE&amp;quot;,&lt;br /&gt;
          &amp;quot;SizeWE&amp;quot;,            &amp;quot;UpArrow&amp;quot;,           &amp;quot;VSplit&amp;quot;,      &lt;br /&gt;
          &amp;quot;WaitCursor&amp;quot; &lt;br /&gt;
     };&lt;br /&gt;
   &lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Application.Run(new MouseCursors());&lt;br /&gt;
     }&lt;br /&gt;
     public MouseCursors()&lt;br /&gt;
     {&lt;br /&gt;
          Text = &amp;quot;Mouse Cursors&amp;quot;;&lt;br /&gt;
          ResizeRedraw = true;&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnMouseMove(MouseEventArgs mea)&lt;br /&gt;
     {&lt;br /&gt;
          int x = Math.Max(0, Math.Min(3, mea.X / (ClientSize.Width  / 4)));&lt;br /&gt;
          int y = Math.Max(0, Math.Min(6, mea.Y / (ClientSize.Height / 7)));&lt;br /&gt;
   &lt;br /&gt;
          Cursor.Current = acursor[4 * y + x];&lt;br /&gt;
     }&lt;br /&gt;
     protected override void OnPaint(PaintEventArgs pea)&lt;br /&gt;
     {&lt;br /&gt;
          Graphics     grfx   = pea.Graphics;&lt;br /&gt;
          Brush        brush  = new SolidBrush(ForeColor);&lt;br /&gt;
          Pen          pen    = new Pen(ForeColor);&lt;br /&gt;
          StringFormat strfmt = new StringFormat();&lt;br /&gt;
   &lt;br /&gt;
          strfmt.LineAlignment = strfmt.Alignment = StringAlignment.Center;&lt;br /&gt;
   &lt;br /&gt;
          for (int y = 0; y &amp;lt; 7; y++){&lt;br /&gt;
              for (int x = 0; x &amp;lt; 4; x++)&lt;br /&gt;
              {&lt;br /&gt;
                   Rectangle rect = Rectangle.FromLTRB(&lt;br /&gt;
                                             x      * ClientSize.Width  / 4,&lt;br /&gt;
                                             y      * ClientSize.Height / 7,&lt;br /&gt;
                                            (x + 1) * ClientSize.Width  / 4,&lt;br /&gt;
                                            (y + 1) * ClientSize.Height / 7);&lt;br /&gt;
       &lt;br /&gt;
                   grfx.DrawRectangle(pen, rect);&lt;br /&gt;
                   grfx.DrawString(astrCursor[4 * y + x], &lt;br /&gt;
                                   Font, brush, rect, strfmt);&lt;br /&gt;
              }&lt;br /&gt;
          }    &lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hand Cursor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
   &lt;br /&gt;
class FormProperties&lt;br /&gt;
{&lt;br /&gt;
     public static void Main()&lt;br /&gt;
     {&lt;br /&gt;
          Form form = new Form();&lt;br /&gt;
   &lt;br /&gt;
          form.Text            = &amp;quot;Form Properties&amp;quot;;&lt;br /&gt;
          form.Cursor          = Cursors.Hand;&lt;br /&gt;
   &lt;br /&gt;
          Application.Run(form);&lt;br /&gt;
     }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Load animated cursor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.IO;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
  public Form1() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
    try&lt;br /&gt;
    {&lt;br /&gt;
      this.Cursor = AdvancedCursors.Create(Path.rubine(Application.StartupPath, &amp;quot;blob.ani&amp;quot;));&lt;br /&gt;
    }&lt;br /&gt;
    catch (Exception err)&lt;br /&gt;
    {&lt;br /&gt;
      MessageBox.Show(err.Message);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
    this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.EnableVisualStyles();&lt;br /&gt;
    Application.Run(new Form1());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
public class AdvancedCursors&lt;br /&gt;
{&lt;br /&gt;
  [DllImport(&amp;quot;User32.dll&amp;quot;)]&lt;br /&gt;
  private static extern IntPtr LoadCursorFromFile(String str);&lt;br /&gt;
  public static Cursor Create(string filename)&lt;br /&gt;
  {&lt;br /&gt;
    IntPtr hCursor = LoadCursorFromFile(filename);&lt;br /&gt;
    &lt;br /&gt;
    if (!IntPtr.Zero.Equals(hCursor))&lt;br /&gt;
    {&lt;br /&gt;
      return new Cursor(hCursor);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
      throw new ApplicationException(&amp;quot;Could not create cursor from file &amp;quot; + filename);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Load cursor file(*.cur)==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt; &lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
&lt;br /&gt;
public class Form1 : Form {&lt;br /&gt;
    public Form1() {&lt;br /&gt;
        this.SuspendLayout();&lt;br /&gt;
        this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);&lt;br /&gt;
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
        this.ClientSize = new System.Drawing.Size(292, 268);&lt;br /&gt;
        this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);&lt;br /&gt;
        this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);&lt;br /&gt;
        this.ResumeLayout(false);&lt;br /&gt;
    }&lt;br /&gt;
    private void Form1_MouseMove(object sender, MouseEventArgs e) {&lt;br /&gt;
        Point p = new Point(e.X, e.Y);&lt;br /&gt;
        Rectangle r;&lt;br /&gt;
        if (new Rectangle(0, 0, 100, 100).Contains(p))&lt;br /&gt;
            this.Cursor = new Cursor(&amp;quot;MyCursor.cur&amp;quot;);&lt;br /&gt;
        else if (new Rectangle(100, 0, 100, 100).Contains(p))&lt;br /&gt;
            this.Cursor = Cursors.Hand;&lt;br /&gt;
        else if (new Rectangle(0, 100, 100, 100).Contains(p))&lt;br /&gt;
            this.Cursor = Cursors.VSplit;&lt;br /&gt;
        else if (new Rectangle(100, 100, 100, 100).Contains(p))&lt;br /&gt;
            this.Cursor = Cursors.UpArrow;&lt;br /&gt;
        else&lt;br /&gt;
            this.Cursor = Cursors.Default;&lt;br /&gt;
    }&lt;br /&gt;
    private void Form1_Paint(object sender, PaintEventArgs e) {&lt;br /&gt;
        Graphics g = e.Graphics;&lt;br /&gt;
        g.FillRectangle(Brushes.Blue, 0, 0, 100, 100);&lt;br /&gt;
        g.FillRectangle(Brushes.Red, 100, 0, 100, 100);&lt;br /&gt;
        g.FillRectangle(Brushes.Yellow, 0, 100, 100, 100);&lt;br /&gt;
        g.FillRectangle(Brushes.Green, 100, 100, 100, 100);&lt;br /&gt;
    }&lt;br /&gt;
    static void Main() {&lt;br /&gt;
        Application.EnableVisualStyles();&lt;br /&gt;
        Application.Run(new Form1());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set form window cursor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ruponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.IO;&lt;br /&gt;
public class Form1 : Form&lt;br /&gt;
{&lt;br /&gt;
  public Form1() {&lt;br /&gt;
        InitializeComponent();&lt;br /&gt;
    try&lt;br /&gt;
    {&lt;br /&gt;
      this.Cursor = AdvancedCursors.Create(Path.rubine(Application.StartupPath, &amp;quot;blob.ani&amp;quot;));&lt;br /&gt;
    }&lt;br /&gt;
    catch (Exception err)&lt;br /&gt;
    {&lt;br /&gt;
      MessageBox.Show(err.Message);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  private void InitializeComponent()&lt;br /&gt;
  {&lt;br /&gt;
    this.SuspendLayout();&lt;br /&gt;
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);&lt;br /&gt;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;&lt;br /&gt;
    this.ClientSize = new System.Drawing.Size(292, 266);&lt;br /&gt;
    this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    this.ResumeLayout(false);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  [STAThread]&lt;br /&gt;
  static void Main()&lt;br /&gt;
  {&lt;br /&gt;
    Application.EnableVisualStyles();&lt;br /&gt;
    Application.Run(new Form1());&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
public class AdvancedCursors&lt;br /&gt;
{&lt;br /&gt;
  [DllImport(&amp;quot;User32.dll&amp;quot;)]&lt;br /&gt;
  private static extern IntPtr LoadCursorFromFile(String str);&lt;br /&gt;
  public static Cursor Create(string filename)&lt;br /&gt;
  {&lt;br /&gt;
    IntPtr hCursor = LoadCursorFromFile(filename);&lt;br /&gt;
    &lt;br /&gt;
    if (!IntPtr.Zero.Equals(hCursor))&lt;br /&gt;
    {&lt;br /&gt;
      return new Cursor(hCursor);&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
      throw new ApplicationException(&amp;quot;Could not create cursor from file &amp;quot; + filename);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Set Form window cursor to wait cursor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
  using System;&lt;br /&gt;
  using System.Drawing;&lt;br /&gt;
  using System.Collections;&lt;br /&gt;
  using System.ruponentModel;&lt;br /&gt;
  using System.Windows.Forms;&lt;br /&gt;
  using System.Data;&lt;br /&gt;
  public class MainForm : System.Windows.Forms.Form&lt;br /&gt;
  {&lt;br /&gt;
    private System.ruponentModel.Container components;&lt;br /&gt;
    public MainForm()&lt;br /&gt;
    {&lt;br /&gt;
      InitializeComponent();&lt;br /&gt;
      BackColor = Color.Tomato;&lt;br /&gt;
      Opacity = 0.5d;&lt;br /&gt;
      Text = &amp;quot;www.nfex.ru&amp;quot;;&lt;br /&gt;
      Cursor = Cursors.WaitCursor;&lt;br /&gt;
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);&lt;br /&gt;
    }&lt;br /&gt;
    protected override void Dispose( bool disposing )&lt;br /&gt;
    {&lt;br /&gt;
      if( disposing )&lt;br /&gt;
      {&lt;br /&gt;
        if (components != null) &lt;br /&gt;
        {&lt;br /&gt;
          components.Dispose();&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      base.Dispose( disposing );&lt;br /&gt;
    }&lt;br /&gt;
    private void InitializeComponent()&lt;br /&gt;
    {&lt;br /&gt;
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);&lt;br /&gt;
      this.ClientSize = new System.Drawing.Size(292, 273);&lt;br /&gt;
      this.Text = &amp;quot;Form1&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    [STAThread]&lt;br /&gt;
    static void Main() &lt;br /&gt;
    {&lt;br /&gt;
      Application.Run(new MainForm());&lt;br /&gt;
    }&lt;br /&gt;
    private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)&lt;br /&gt;
    {&lt;br /&gt;
      Graphics g = e.Graphics;&lt;br /&gt;
      g.DrawString(&amp;quot;www.nfex.ru&amp;quot;, &lt;br /&gt;
        new Font(&amp;quot;Times New Roman&amp;quot;, 20), &lt;br /&gt;
        new SolidBrush(Color.Black), 40, 10);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>