private void mouse_Right_Down(object sender, EventArgs e) { Border eventedR = (Border)sender; if (press == onPress.nonePressed) { //Image img = new Image(); //img.Source = new BitmapImage(new Uri("pack://application:,,,/Images/flag.png"),new RequestCachePolicy(RequestCacheLevel.Default)); // img.Margin = new Thickness(7, 2, 2, 2); eventedR.Child = flag; press = onPress.pressedOnce; vCell.MouseLeftButtonDown -= mouse_down; } else if (press == onPress.pressedOnce) { press = onPress.pressedTwice; //Image img = new Image(); //img.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Question.png"), new RequestCachePolicy(RequestCacheLevel.Default)); //img.Margin = new Thickness(4, 2, 2, 2); eventedR.Child = question; } else if (press == onPress.pressedTwice) { press = onPress.nonePressed; eventedR.Child = null; vCell.MouseLeftButtonDown += mouse_down; } }
public Button(Vector2 position, Vector2 size, string text, onPress funct) : base(position, size) { this.text = text; textSize = font.MeasureString(text); textPos = new Vector2(center.X-(textSize.X/2), center.Y-(textSize.Y/2)); fun = funct; }
public VisualCell(double height, double width) { vCell = new Border(); vCell.Height = height; //inc heigh vCell.Width = width; //inc width flag = new Image(); flag.Source = new BitmapImage(new Uri("pack://application:,,,/Images/flag.png"), new RequestCachePolicy(RequestCacheLevel.Default)); flag.Margin = new Thickness(7, 2, 2, 2); question = new Image(); question.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Question.png"), new RequestCachePolicy(RequestCacheLevel.Default)); question.Margin = new Thickness(4, 2, 2, 2); vCell.BorderBrush = Brushes.Black; vCell.BorderThickness = new Thickness(2); vCell.Background = Brushes.Silver; vCell.MouseEnter += mouse_in; vCell.MouseLeave += mouse_leave; vCell.MouseLeftButtonDown += mouse_down; vCell.MouseRightButtonDown += mouse_Right_Down; press = onPress.nonePressed; }