void HoverForm_MouseMove(object sender, MouseEventArgs e) { HOVERMOUSEPOSITION position = initExtraButtons(e.Location.X, e.Location.Y); Debug.WriteLine("position " + position); if (position != lastposition && position != HOVERMOUSEPOSITION.CENTER) { //if new area reached setExtraButtonPositon(position); lastposition = position; } }
private void setExtraButtonPositon(HOVERMOUSEPOSITION position) { System.Drawing.Drawing2D.GraphicsPath shape = (System.Drawing.Drawing2D.GraphicsPath)fieldButton1.getShape().Clone(); System.Drawing.Point tPoint = savedLocation; switch (position) { //first check cases with 1 additional button case HOVERMOUSEPOSITION.BOTTOM: this.Location = tPoint; shape.Transform(rotMatrix); //rotate fieldButton1.Location = new Point(0, 0); extraButtons.ElementAt(0).setShape(shape); extraButtons.ElementAt(0).Location = new Point(0, 87); break; case HOVERMOUSEPOSITION.TOP: tPoint.Offset(new Point(0, -87)); this.Location = tPoint; shape.Transform(rotMatrix); //rotate secondary shape fieldButton1.Location = new Point(0, 87); //shift mainbutton down extraButtons.ElementAt(0).setShape(shape); //set new shape for secondary button extraButtons.ElementAt(0).Location = new Point(0, 0); //set secondary button to top break; case HOVERMOUSEPOSITION.RIGHT: this.Location = tPoint; shape.Transform(rotMatrix); //rotate fieldButton1.Location = new Point(0, 0); extraButtons.ElementAt(0).setShape(shape); extraButtons.ElementAt(0).Location = new Point(50, 0); break; case HOVERMOUSEPOSITION.LEFT: tPoint.Offset(new Point(-50, 0)); this.Location = tPoint; shape.Transform(rotMatrix); //rotate fieldButton1.Location = new Point(50, 0); extraButtons.ElementAt(0).setShape(shape); extraButtons.ElementAt(0).Location = new Point(0, 0); break; case HOVERMOUSEPOSITION.DOWN: break; case HOVERMOUSEPOSITION.UP: break; case HOVERMOUSEPOSITION.CENTER: break; } Invalidate(); }