madmare
asked on
Mouse border in C#
Hii,
How do i set a border to upear near the mouse pointer on my form, when i move the mouse pointer, the border move with it
thank you
How do i set a border to upear near the mouse pointer on my form, when i move the mouse pointer, the border move with it
thank you
ASKER
i wanted to move a Rectangel when the mouse pointer is moveed, the Rectangle i wanted to be an aqua color thats mean it has a border but filled with NO color
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what is this "moveRect" ?
moveRect is a boolean which can be either true or false. If it's false, the rectangle wont resize with the border when the form size is changed, if it's true the rectangle will resize with the border when the form size is changed. So it's only added to control the resizing from the rectangle.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace MouseTest
{
public class MainForm : System.Windows.Forms.Form
{
public MainForm()
{
InitializeComponent();
}
[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
private void InitializeComponent() {
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(320, 285);
this.Name = "MainForm";
this.Text = "MainForm";
this.MouseMove += new System.Windows.Forms.Mouse
}
#endregion
void MainFormMouseMove(object sender, System.Windows.Forms.Mouse
{
this.Width = Cursor.Position.X;
this.Height = Cursor.Position.Y;
}
}
}