Created
April 30, 2012 23:23
-
-
Save dchristensen/2563600 to your computer and use it in GitHub Desktop.
Change a PictureBox dynamically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MapForm2 : Form | |
{ | |
private Bitmap map_t; | |
private Bitmap map; | |
public MapForm2() | |
{ | |
InitializeComponent(); | |
var size = Properties.Resources.Penguins.Size; | |
map_t = new Bitmap("map.gif", true); | |
map = new Bitmap(map_t.Width, map_t.Height); | |
MapCanvas.Image = map; | |
} | |
private void MapCanvas_MouseUp(object sender, MouseEventArgs e) | |
{ | |
var rect = new Rectangle(e.X - 3, e.Y - 3, 7, 7); | |
using (var g = Graphics.FromImage(map)) | |
{ | |
g.FillEllipse(Brushes.Red, rect); | |
} | |
MapCanvas.Invalidate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment