You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a cross-platform (Windows and Linux) WinForms application. Cursor.Hide() and Cursor.Show() works correctly natively on Windows, but on Linux/Ubuntu using Mono, it does not. PrjApc - 2024-03-06.zip
The attached zip file contains a very small test program that demonstrates the problem (Hide Cursor and Unhide Cursor). This test program demostrates other mono issues - Japanese character issue https://github.com/mono/mono/issues/21697 and the Mult-line Button issue https://github.com/mono/mono/issues/21696. Pressing the Hide Cursor button does not hide the cursor on Linux/Ubuntu.
Thank you for your help with this! Mono is an awesome software package. I hope it will remain available and supported for quite some time for Ubuntu and Yocto! The Linux version is Ubuntu 22.04.2 LTS. Mono JIT compiler version 6.12.0.199 (tarball Tue 27 Feb 2024 02:34:00 PM UTC).
Though source code is not greatly required for this issue, the main source code is:
`
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Apc
{
#region Class FormMain
public class FormMain : System.Windows.Forms.Form
{
private Button ExitButton;
private Button ToggleLangButton;
private Button ToggleCursorButton;
private Font DefaultProgramFont;
private string JapaneseStr = "日本語";
private string EnglishStr = "Toggle Language";
private string HideCursorStr = "Hide Cursor";
private string UnhideCursorStr = "Unhide Cursor";
static void Main()
{
Application.Run(new FormMain());
}
public FormMain()
{
// Component initialization - required for Windows Form Designer
// support
InitializeComponent();
int Width = (8 + 80) * 3 + 8;
int Height = 120;
this.Size = new Size(Width, Height);
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MinimizeBox = true;
this.Font = new Font("Microsoft Sans Serif", 8.25F,
FontStyle.Regular);
DefaultProgramFont = this.Font;
ExitButton = new Button();
ExitButton.Size = new Size(80, 32);
ExitButton.BackColor = SystemColors.Control;
ExitButton.ForeColor = Color.Black;
ExitButton.Font = this.Font;
ExitButton.Text = "Exit the Program";
ExitButton.Location = new Point(Width - ExitButton.Width - 8,
Height - ExitButton.Height - 8);
ExitButton.Click += new System.EventHandler(this.ExitButton_Click);
Controls.Add(ExitButton);
ToggleLangButton = new Button();
ToggleLangButton.Size = new Size(80, 32);
ToggleLangButton.BackColor = SystemColors.Control;
ToggleLangButton.ForeColor = Color.Black;
ToggleLangButton.Font = this.Font;
ToggleLangButton.Text = EnglishStr;
ToggleLangButton.Location = new Point(8,
Height - ToggleLangButton.Height - 8);
ToggleLangButton.Click += new System.EventHandler(
this.ToggleLangButton_Click);
Controls.Add(ToggleLangButton);
ToggleCursorButton = new Button();
ToggleCursorButton.Size = new Size(80, 32);
ToggleCursorButton.BackColor = SystemColors.Control;
ToggleCursorButton.ForeColor = Color.Black;
ToggleCursorButton.Font = this.Font;
ToggleCursorButton.Text = HideCursorStr;
ToggleCursorButton.Location = new Point(
(Width / 2) - (ToggleCursorButton.Width / 2),
Height - ToggleCursorButton.Height - 8);
ToggleCursorButton.Click += new System.EventHandler(
this.ToggleCursorButton_Click);
Controls.Add(ToggleCursorButton);
}
private void FormMain_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// Draw the strings
Graphics FormGraphicsRef = this.CreateGraphics();
Brush StrBrush = new SolidBrush(Color.Black);
Font StrFont = new Font("MS Gothic", 12, FontStyle.Regular);
string Str = "\u91CD\u91CF\u8A08";
FormGraphicsRef.DrawString(Str, StrFont, StrBrush, 16, 16);
Console.WriteLine(Str);
Str = "\u91CD\u91CF\u8A08\u91CD\u91CF";
FormGraphicsRef.DrawString(Str, StrFont, StrBrush, 16, 40);
Console.WriteLine(Str);
}
private void ToggleLangButton_Click(object sender, System.EventArgs e)
{
if (ToggleLangButton.Text != JapaneseStr)
{
ToggleLangButton.Font = new Font("MS Gothic", 9, FontStyle.Regular);
ToggleLangButton.Text = JapaneseStr;
}
else
{
ToggleLangButton.Font = DefaultProgramFont;
ToggleLangButton.Text = EnglishStr;
}
}
private void ToggleCursorButton_Click(object sender, System.EventArgs e)
{
if (ToggleCursorButton.Text == HideCursorStr)
{
ToggleCursorButton.Text = UnhideCursorStr;
Cursor.Hide();
}
else
{
ToggleCursorButton.Text = HideCursorStr;
Cursor.Show();
}
}
private void ExitButton_Click(object sender, System.EventArgs e)
{
Close();
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
//
// FormMain
//
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(640, 480);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = true;
this.MinimizeBox = true;
this.Text = "Test Program";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.FormMain_Paint);
}
#endregion
}
#endregion
}
`
The text was updated successfully, but these errors were encountered:
I have a cross-platform (Windows and Linux) WinForms application. Cursor.Hide() and Cursor.Show() works correctly natively on Windows, but on Linux/Ubuntu using Mono, it does not.
PrjApc - 2024-03-06.zip
The attached zip file contains a very small test program that demonstrates the problem (Hide Cursor and Unhide Cursor). This test program demostrates other mono issues - Japanese character issue https://github.com/mono/mono/issues/21697 and the Mult-line Button issue https://github.com/mono/mono/issues/21696. Pressing the Hide Cursor button does not hide the cursor on Linux/Ubuntu.
Thank you for your help with this! Mono is an awesome software package. I hope it will remain available and supported for quite some time for Ubuntu and Yocto! The Linux version is Ubuntu 22.04.2 LTS. Mono JIT compiler version 6.12.0.199 (tarball Tue 27 Feb 2024 02:34:00 PM UTC).
Though source code is not greatly required for this issue, the main source code is:
`
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Apc
{
#region Class FormMain
public class FormMain : System.Windows.Forms.Form
{
private Button ExitButton;
private Button ToggleLangButton;
private Button ToggleCursorButton;
private Font DefaultProgramFont;
}
`
The text was updated successfully, but these errors were encountered: