In my program, I'm using the WndProc override to stop my form being resized. Thing is, the cursor is still there when you move the pointer to the edge of the form.
Is there any way to hide this cursor?
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.
Why not set the FormBorderStyle
property appropriately instead? Then you don't need to use WndProc
either.
Here's some sample code to demonstrate - click the button to toggle whether or not the form can be resized:
using System;
using System.Windows.Forms;
using System.Drawing;
class Test
{
[STAThread]
static void Main(string[] args)
{
Button button = new Button
{
Text = "Toggle border",
AutoSize = true,
Location = new Point(20, 20)
};
Form form = new Form
{
Size = new Size (200, 200),
Controls = { button },
FormBorderStyle = FormBorderStyle.Fixed3D
};
button.Click += ToggleBorder;
Application.Run(form);
}
static void ToggleBorder(object sender, EventArgs e)
{
Form form = ((Control)sender).FindForm();
form.FormBorderStyle = form.FormBorderStyle == FormBorderStyle.Fixed3D
? FormBorderStyle.Sizable : FormBorderStyle.Fixed3D;
}
}
I have found a way using WndProc thanks to the link Lasse sent me. Thanks for your reply Jon but it wasn't exactly what I wanted. For those who want to know how I did it, I used this:
protected override void WndProc(ref Message m)
{
const int WM_NCHITTEST = 0x0084;
switch (m.Msg)
{
case WM_NCHITTEST:
return;
}
base.WndProc(ref m);
}
I haven't tested it thoroughly so don't know if there are any side-effects but it works fine for me at the moment :).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With