public BottomPanel() { mapTile = null; font = new Font("Arial", 8); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); selected = XCMapTile.MapQuadrant.Ground; //tileView = TileView.Instance; /* btnCut = new Button(); btnPaste = new Button(); btnCopy = new Button(); btnUp = new Button(); btnDown = new Button(); Assembly a = Assembly.GetExecutingAssembly(); btnCut.Image = Bitmap.FromStream(a.GetManifestResourceStream("MapView._Embedded.cut.gif")); btnPaste.Image = Bitmap.FromStream(a.GetManifestResourceStream("MapView._Embedded.paste.gif")); btnCopy.Image = Bitmap.FromStream(a.GetManifestResourceStream("MapView._Embedded.copy.gif")); btnUp.Image = Bitmap.FromStream(a.GetManifestResourceStream("MapView._Embedded.up.gif")); btnDown.Image = Bitmap.FromStream(a.GetManifestResourceStream("MapView._Embedded.down.gif")); btnCut.Left = 200; btnCut.Anchor = AnchorStyles.Top | AnchorStyles.Left; btnCut.Size = new Size(25, 25); btnCut.Click += new EventHandler(MapViewPanel.Instance.Cut_click); btnCopy.Left = btnCut.Right; btnCopy.Anchor = btnCut.Anchor; btnCopy.Size = btnCut.Size; btnCopy.Click += new EventHandler(MapViewPanel.Instance.Copy_click); btnPaste.Left = btnCopy.Right; btnPaste.Anchor = btnCopy.Anchor; btnPaste.Size = btnCopy.Size; btnPaste.Click += new EventHandler(MapViewPanel.Instance.Paste_click); btnUp.Left = btnPaste.Right; btnUp.Anchor = btnPaste.Anchor; btnUp.Size = btnPaste.Size; btnUp.Click += new EventHandler(Down_click); btnDown.Left = btnUp.Right; btnDown.Anchor = btnUp.Anchor; btnDown.Size = btnUp.Size; btnDown.Click += new EventHandler(Up_click);*/ Globals.LoadExtras(); //Controls.AddRange(new Control[] { btnCut, btnCopy, btnPaste, btnUp, btnDown }); }
protected override void OnMouseDown(MouseEventArgs e) { SelectedQuadrant = (XCMapTile.MapQuadrant)((e.X - BottomPanelDrawService.startX) / BottomPanelDrawService.TOTAL_QUADRAN_SPACE); SetSelected(e.Button, e.Clicks); if (PanelClicked != null) { PanelClicked(this, new EventArgs()); } Refresh(); }
protected override void OnMouseDown(MouseEventArgs e) { selected = (XCMapTile.MapQuadrant)((e.X - startX) / (tileWidth + 2 * space)); SetSelected(e.Button, e.Clicks); if (PanelClicked != null) PanelClicked(this, new EventArgs()); Refresh(); }
public void Draw( Graphics g, XCMapTile mapTile, XCMapTile.MapQuadrant selectedQuadrant) { // Draw selection if (selectedQuadrant == XCMapTile.MapQuadrant.Ground) { g.FillRectangle( Brush, startX, startY, tileWidth + 1, tileHeight + 2); } else if (selectedQuadrant == XCMapTile.MapQuadrant.West) { g.FillRectangle( Brush, startX + (TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } else if (selectedQuadrant == XCMapTile.MapQuadrant.North) { g.FillRectangle( Brush, startX + (2 * TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } else if (selectedQuadrant == XCMapTile.MapQuadrant.Content) { g.FillRectangle( Brush, startX + (3 * TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } var topView = MainWindowsManager.TopView.TopViewControl; // Ground not visible if (!topView.GroundVisible) { g.FillRectangle( System.Drawing.Brushes.DarkGray, startX, startY, tileWidth + 1, tileHeight + 2); } if (mapTile != null && mapTile.Ground != null) { g.DrawImage( mapTile.Ground[MapViewPanel.Current].Image, startX, startY - mapTile.Ground.Info.TileOffset); if (mapTile.Ground.Info.HumanDoor || mapTile.Ground.Info.UFODoor) { g.DrawString( "Door", Font, System.Drawing.Brushes.Black, startX, startY + PckImage.Height - Font.Height); } } else { g.DrawImage( Globals.ExtraTiles[3].Image, startX, startY); } if (!topView.WestVisible) { g.FillRectangle( System.Drawing.Brushes.DarkGray, startX + (TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } if (mapTile != null && mapTile.West != null) { g.DrawImage( mapTile.West[MapViewPanel.Current].Image, startX + (TOTAL_QUADRAN_SPACE), startY - mapTile.West.Info.TileOffset); if (mapTile.West.Info.HumanDoor || mapTile.West.Info.UFODoor) { g.DrawString( "Door", Font, System.Drawing.Brushes.Black, startX + (TOTAL_QUADRAN_SPACE), startY + PckImage.Height - Font.Height); } } else { g.DrawImage( Globals.ExtraTiles[1].Image, startX + (TOTAL_QUADRAN_SPACE), startY); } if (!topView.NorthVisible) { g.FillRectangle( System.Drawing.Brushes.DarkGray, startX + (2 * TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } if (mapTile != null && mapTile.North != null) { g.DrawImage( mapTile.North[MapViewPanel.Current].Image, startX + (2 * TOTAL_QUADRAN_SPACE), startY - mapTile.North.Info.TileOffset); if (mapTile.North.Info.HumanDoor || mapTile.North.Info.UFODoor) { g.DrawString( "Door", Font, System.Drawing.Brushes.Black, startX + (2 * TOTAL_QUADRAN_SPACE), startY + PckImage.Height - Font.Height); } } else { g.DrawImage( Globals.ExtraTiles[2].Image, startX + (2 * TOTAL_QUADRAN_SPACE), startY); } if (!topView.ContentVisible) { g.FillRectangle( System.Drawing.Brushes.DarkGray, startX + (3 * TOTAL_QUADRAN_SPACE), startY, tileWidth + 1, tileHeight + 2); } if (mapTile != null && mapTile.Content != null) { g.DrawImage( mapTile.Content[MapViewPanel.Current].Image, startX + (3 * TOTAL_QUADRAN_SPACE), startY - mapTile.Content.Info.TileOffset); if (mapTile.Content.Info.HumanDoor || mapTile.Content.Info.UFODoor) { g.DrawString( "Door", Font, System.Drawing.Brushes.Black, startX + (3 * TOTAL_QUADRAN_SPACE), startY + PckImage.Height - Font.Height); } } else { g.DrawImage( Globals.ExtraTiles[4].Image, startX + (3 * TOTAL_QUADRAN_SPACE), startY); } DrawGroundAndContent(g); g.DrawString( "Gnd", Font, System.Drawing.Brushes.Black, new RectangleF( startX, startY + tileHeight + space, tileWidth, 50)); g.DrawString( "West", Font, System.Drawing.Brushes.Black, new RectangleF( startX + (TOTAL_QUADRAN_SPACE), startY + tileHeight + space, tileWidth, 50)); g.DrawString( "North", Font, System.Drawing.Brushes.Black, new RectangleF( startX + (2 * TOTAL_QUADRAN_SPACE), startY + tileHeight + space, tileWidth, 50)); g.DrawString( "Object", Font, System.Drawing.Brushes.Black, new RectangleF( startX + (3 * TOTAL_QUADRAN_SPACE), startY + tileHeight + space, tileWidth + 50, 50)); for (int i = 0; i < 4; i++) { g.DrawRectangle( System.Drawing.Pens.Black, startX - 1 + (i * TOTAL_QUADRAN_SPACE), startY, tileWidth + 2, tileHeight + 2); } }