.net中窗体的调整

时间:2007-01-21 14:07:42   来源:  作者:  点击:次  出处:技术无忧
关键字:.net

Private r As RectangleF

 

    Private m_image As Image = Image.FromFile("g:/picture.bmp")

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try

            r = New RectangleF(0, 0, Me.ClientSize.Width, Me.ClientSize.Height)

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

 

    Private Sub mydrawimage()

        Try

            Dim g As Graphics = Me.CreateGraphics

            g.DrawImage(m_image, r)

            g.Dispose()

        Catch ex As Exception

 

        End Try

    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

 

        mydrawimage()

 

    End Sub

 

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize

 

        r = New RectangleF(0, 0, Me.ClientSize.Width, Me.ClientSize.Height)

 

        mydrawimage()

    End Sub

欢迎收藏Pc51.Net技术无忧网


文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面