private void zoneDeTéléportationToolStripMenuItem_Click(object sender, EventArgs e) { System.Drawing.Point laCase = new System.Drawing.Point(ContextTile[0].X, ContextTile[1].Y); Map laMap; MapNavigator dlg = new MapNavigator(Project.Dir, MapBatch); dlg.ShowDialog(); if (dlg.OpenedFile) { Application.DoEvents(); laMap = dlg.SelectedMap; SelectTeleportationForm browser = new SelectTeleportationForm(laMap, laCase, CurrentLayer, CurrentMap, MapBatch); browser.ShowDialog(); if (browser.ajouté) { DrawMap(); // TODO: Little flaw here: the pEvent icon is not drawn until you scroll the panel // How the f**k can we handle this? // What has been tried so far: - Scroll vertical += 10 then -= 10 // - Refresh() instead of DrawMap() (makes it worse; the panel is grey until you scroll) // - DrawMap() twice // - Refresh() then DrawMap() } } RefreshDevice(); }
private void Open() { MapNavigator dlg = new MapNavigator(Project.Dir, MapBatch); dlg.ShowDialog(); using (XNAUtils utils = new XNAUtils()) if (dlg.OpenedFile) { // Pour éviter les anormalités de positions de carte PN_Map.Focus(); Clear(BackColor.ToXnaColor()); Present(); StartWaiting(); Application.DoEvents(); CurrentMap = dlg.SelectedMap; tabControlPanel1.AddTab(CurrentMap); PN_Tileset.BackgroundImage = utils.ConvertToImage(CurrentMap.TileSet); TileSetImage = CurrentMap.TileSet; if (PN_Tileset.BackgroundImage != null) PN_Tileset.Size = new System.Drawing.Size(256, PN_Tileset.BackgroundImage.Height + 2); MapSize = CurrentMap.MapSize; PN_Map.Dock = DockStyle.None; PN_Map.Location = new System.Drawing.Point(0, 0); PN_Map.Size = new System.Drawing.Size(CurrentMap.MapSize.Width * Prefs.Map.TileSize.Width + 1, CurrentMap.MapSize.Height * Prefs.Map.TileSize.Width + 1); PN_Map.BackgroundImage = null; LastOpenedMapFile = dlg.DirPath; Text = "Pixel Lion - " + CurrentMap.Name; // Enable History History.Clear(); History.PushHistory(new MapState(CurrentMap.CloneTiles())); // Enable History History.Clear(); History.PushHistory(new MapState(CurrentMap.CloneTiles())); EnableMapEditing(); StopWaiting(); RefreshDevice(); DrawMap(); } else RefreshDevice(); }