private void SelectColor(int code) { ColorDialog dialog = new ColorDialog(); dialog.Color = TileBox.BackColor; if (dialog.ShowDialog() != DialogResult.OK) { return; } if (code == 1) { TileBox.Color1 = dialog.Color; } else if (code == 2) { TileBox.Color2 = dialog.Color; } else if (code == 3) { TileBox.Color3 = dialog.Color; } UpdateButtonColors(); TileBox.Refresh(); UpdateTilePreview(); }
public override AutoTile SaveWindowControls(StackPanel control, string name, Type type, object[] attributes) { int controlIndex = 0; controlIndex++; TileBox lbxValue = (TileBox)control.Children[controlIndex]; TileBoxViewModel mv = (TileBoxViewModel)lbxValue.DataContext; return(mv.Tile); }
private void MenuBackColor_Click(object sender, EventArgs e) { ColorDialog dialog = new ColorDialog(); dialog.Color = TileBox.BackColor; if (dialog.ShowDialog() != DialogResult.OK) { return; } TileBox.BackColor = dialog.Color; TileBox.Refresh(); UpdateTilePreview(); }
private void UpdateTileDisplay() { int count = Tileset.Count - 1; if (count < 0) { count = 0; } LblTileIndex.Text = TileIndex.ToString() + " / " + count.ToString(); if (TileIndex >= 0 && TileIndex < Tileset.Count) { TileBox.Tile = Tileset[TileIndex]; TileBox.Refresh(); UpdateTilePreview(); } }
public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, AutoTile member) { LoadLabelControl(control, name); TileBox cbxValue = new TileBox(); TileBoxViewModel mv = new TileBoxViewModel(); cbxValue.DataContext = mv; //add lambda expression for editing a single element mv.OnEditItem += (AutoTile element, TileBoxViewModel.EditElementOp op) => { TileEditForm frmData = new TileEditForm(); TileEditViewModel tmv = new TileEditViewModel(); frmData.DataContext = tmv; tmv.Name = name + "/" + type.Name; //load as if eyedropping tmv.TileBrowser.TileSize = GraphicsManager.TileSize; tmv.LoadTile(element); tmv.SelectedOKEvent += () => { element = tmv.GetTile(); op(element); frmData.Close(); }; tmv.SelectedCancelEvent += () => { frmData.Close(); }; control.GetOwningForm().RegisterChild(frmData); frmData.Show(); }; mv.LoadFromSource(member); control.Children.Add(cbxValue); }
private void BtnShiftDown_Click(object sender, EventArgs e) { TileBox.Tile.ShiftY(1); TileBox.Refresh(); UpdateTilePreview(); }
private void BtnFlipY_Click(object sender, EventArgs e) { TileBox.Tile.FlipY(); TileBox.Refresh(); UpdateTilePreview(); }
private void BtnRotate_Click(object sender, EventArgs e) { TileBox.Tile.Rotate(); TileBox.Refresh(); UpdateTilePreview(); }
private void BtnSwap_Click(object sender, EventArgs e) { TileBox.Tile.Swap(); TileBox.Refresh(); UpdateTilePreview(); }
private void BtnFill_Click(object sender, EventArgs e) { TileBox.Tile.Fill(TileBox.ColorCode); TileBox.Refresh(); UpdateTilePreview(); }
private void BtnClear_Click(object sender, EventArgs e) { TileBox.Tile.Clear(); TileBox.Refresh(); UpdateTilePreview(); }
private void MenuShowColorIndexes_Click(object sender, EventArgs e) { TileBox.ShowCodes = MenuShowColorIndexes.Checked; TileBox.Refresh(); UpdateTilePreview(); }
private void MenuShowGrid_Click(object sender, EventArgs e) { TileBox.ShowGrid = MenuShowGrid.Checked; TileBox.Refresh(); UpdateTilePreview(); }