Button本来就能响应鼠标动作,至于图片,我也想知道

解决方案 »

  1.   

    用鼠标的两个事件,换图片就可以了。MouseEnter,MouseLeave
      

  2.   

    你说的是.ico把。
    这个可以用工具做,跟c#是没有关系的。
    可以生成16*16, 32*32, 64*64, 128*128等等。因为同一个图片可能在不同的场合下,大小是不一样的,主要派这个用场吧,比如在右下角的任务栏目里面它是16*16,在windows的菜单栏里面的大小可能是大一点的,你可以把windows的显示方式改成“大”来试一下。
    我知道有些工具可以生成,感兴趣可以去google找一下。
      

  3.   

    从包含多幅小图的大图中载入小图到一个图像列表对象的方法,希望对你有点启示。
    private ImageList loadImageList(string str)
    {
    Bitmap bitmap = new Bitmap(str);
    int count = (int) (bitmap.Width / bitmap.Height);
    ImageList imageList = new ImageList();
    imageList.ColorDepth=ColorDepth.Depth32Bit;
    //imageList.ImageSize=new Size(bitmap.Width,bitmap.Width);
    imageList.TransparentColor=Color.FromArgb(255,0,255);
    Rectangle rectangle = new Rectangle(0, 0, bitmap.Height, bitmap.Height);
    for (int i = 0; i < count; i++)
    {
    imageList.Images.Add(bitmap.Clone(rectangle, bitmap.PixelFormat));
    rectangle.X += bitmap.Height;
    }
    return imageList;
    }
      

  4.   

    QQ是从大图生成小图的,楼主可以细看一下QQ的文件夹,有两幅图的。