求高手指教-如何显示图片指定位置
我发现现在一般的软件,如QQ,快播,360等软件都会将比如“最小化”按钮的图片(包括:当鼠标移动时,按下时,释放等等)放在同一张图片中,比如下面这张是友道的皮肤:
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ShowPicPosition{ public partial class Form1 : Form { Bitmap pic = new Bitmap("win7-default.jpg"); public Form1() { InitializeComponent(); } private void panel1_Paint(object sender, PaintEventArgs e) { Rectangle r1 = new Rectangle(0, 0, 100, 40); Rectangle r2 = new Rectangle(14, 194, 100, 40); e.Graphics.DrawImage(pic, r1, r2, GraphicsUnit.Pixel); } }}