Well, I'm doing a program where I need a floating form that comes with the mouse cursor while it is inside a button, so I have this:
private void portaSwitchUpLink_MouseEnter(object sender, EventArgs e, string idPorta)
{
DataSet ds = _db.consulta("portaSwitchUpLink", "select s.id from equipamentos_rede.switchs_switchs ss inner join equipamentos_rede.portas_switch ps on ss.final_porta_id = ps.id inner join equipamentos_rede.switchs s on ps.switchs_id=s.id where ss.inicial_porta_id='" + idPorta + "' and ss.eliminado!=true");
DataTable dt = ds.Tables[0];
string idSwitch = dt.Rows[0][0].ToString();
try
{
frmSwitchs = new desenhaSwitchs(_db, idSwitch,idPorta);
frmSwitchs.FormBorderStyle = FormBorderStyle.None;
frmSwitchs.Visible = true;
}
catch (Exception){}
}
private void portaSwitchUpLink_MouseMove(object sender, MouseEventArgs e)
{
if (frmSwitchs != null)
if (frmSwitchs.Visible)
frmSwitchs.Location = new Point(Cursor.Position.X + 1, Cursor.Position.Y + 1);
}
private void portaSwitchUpLink_MouseLeave(object sender, EventArgs e)
{
if (frmSwitchs != null)
frmSwitchs.Visible = false;
}
However, when I move to the bottom right corner, the cursor enters the form and conflicts, I thought about changing the position of the form, but it would not look so good. Anyone have an idea?