我有这样一张图片:
我想初始化的时候显示第一部分。
鼠标悬浮的时候显示第二部分。
鼠标按下的时候显示第三部分。各位大大赶紧帮帮俺。。
俺都快愁死了!

解决方案 »

  1.   

    随便。比如是picturebox
    能在窗体显示这个图片的就行了
      

  2.   

    这不就是button之类控件的属性吗?
      

  3.   

    使用ImageList控件把这张加载了,把ImageList的图片宽度设置为第一张图片的宽度。
    使用picbox加载图片ImageList[0],当鼠标移上去的时候加载ImageList[1];
      

  4.   


    我不用imagelist..用这个老是把图片弄的特难看。和原图不像。。我就是想问问。这样一张整个的图片。能不能实现。我说的那种效果!具体怎么实现呢?
      

  5.   

     ''' <summary>
        ''' 获取三切图指定序列
        ''' </summary>
        ''' <param name="SourceBitmap">要切割的三切图源图</param>
        ''' <param name="nIndex">获取第几部分</param>
        ''' <returns></returns>
        ''' <res></res>
        Private Function GetnIndexBitmap(ByVal SourceBitmap As Bitmap, ByVal nIndex As Integer) As Bitmap
            Dim W As Integer = SourceBitmap.Width / 3
            Dim H As Integer = SourceBitmap.Height
            Dim B As New Bitmap(W, H)
            Using G As Graphics = Graphics.FromImage(B)
                G.DrawImage(SourceBitmap, New Rectangle(0, 0, W, H), New Rectangle(SourceBitmap.Width / 3 * nIndex, 0, W, H), GraphicsUnit.Pixel)
            End Using
            Return B
        End Function'示例:
    Label1.BackgroundImage = GetnIndexBitmap(源图, 0) ' 普通状态
            Label1.BackgroundImage = GetnIndexBitmap(源图, 1) ' 移上状态.
            Label1.BackgroundImage = GetnIndexBitmap(源图, 2) ' 按下状态