0

有人在这里看到我的错误吗?

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
    Dim renderer As VisualStyleRenderer
    renderer = New VisualStyleRenderer(VisualStyleElement.Button.PushButton.Normal)

    Dim nRect As New Rectangle
    nRect = Rectangle.FromLTRB(0, 0, 100, 100)

    renderer.DrawBackground(Me.PictureBox1.CreateGraphics, nRect)
    Me.PictureBox1.Invalidate(True)
End Sub
4

1 回答 1

1

你不应该借鉴CreateGraphics(); 下次控件绘制自身时,它将被删除。

相反,您需要处理Paint事件并在e.Graphics.

于 2012-10-22T18:11:33.737 回答