private void SubMouseMove() { if (leftmouse) { Window parentWindow = Window.GetWindow(this); Point RCT1position = RCT_gradient.PointToScreen(new Point(0d, 0d)); Point Eposition = E_cursor.PointToScreen(new Point(0d, 0d)); Point mouse = new Point { X = MousePosition().X - (RCT1position.X - parentWindow.Left - 8), Y = MousePosition().Y - (RCT1position.Y - parentWindow.Top - 31) }; Point calcMouse = new Point { X = mouse.X / (RCT_gradient.Width / 255) / 255, Y = mouse.Y / (RCT_gradient.Height / 255) / 255 }; E_cursor.Margin = new Thickness(mouse.X - (Eposition.X - E_cursor.Margin.Left - parentWindow.Left) + (RCT1position.X - parentWindow.Left) - (E_cursor.Width / 2), mouse.Y - (Eposition.Y - E_cursor.Margin.Top - parentWindow.Top) + (RCT1position.Y - parentWindow.Top) - (E_cursor.Height / 2), 0, 0); //if mouse is in bounds.. should be but if it glitches, it doesn't crash if ((mouse.X <= RCT_gradient.Width && mouse.X >= 0) && (mouse.Y >= 0 && mouse.Y <= RCT_gradient.Height)) { SolidColorBrush newColor = CalculateColor(calcMouse, superColor); SetColor(newColor.Color.R, newColor.Color.G, newColor.Color.B); } } }
private void SubMouseLeftButtonDown() { Window parentWindow = Window.GetWindow(this); Point position = RCT_gradient.PointToScreen(new Point(0d, 0d)); System.Windows.Forms.Cursor.Clip = new System.Drawing.Rectangle(new System.Drawing.Point() { X = Convert.ToInt32(position.X), Y = Convert.ToInt32(position.Y) }, new System.Drawing.Size(Convert.ToInt32(RCT_gradient.Width + 1), Convert.ToInt32(RCT_gradient.Height + 1))); leftmouse = true; SubMouseMove(); }