日期:2014-05-18 浏览次数:20887 次
private void Form1_Load(object sender, EventArgs e) { menu.Items.Add("item1"); menu.Items.Add("item2"); menu.Items.Add("item3"); } Bitmap bmp = new Bitmap(@"C:\Users\SaeWind\Desktop\123\1.png"); private void pictureBox1_Paint(object sender, PaintEventArgs e) { Graphics g=e.Graphics; g.DrawImage(bmp,pictureBox1.Bounds); } ContextMenuStrip menu = new ContextMenuStrip(); private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Point t =PointToScreen(e.Location); menu.Show(t.X,t.Y); } } private void pictureBox1_SizeChanged(object sender, EventArgs e) { ((Control)sender).Refresh(); }