如何更改VB中某些文本的位置

时间:2019-06-27 04:01:29

标签: vb.net

我正在编写防病毒程序,真的需要知道如何更改显示“已感染!”文本的位置。和“清洁!”

我并没有做太多尝试,因为我参加了有关如何制作的教程。我不知道如何在Visual Basic中编程。对不起,我知道我是菜鸟。这是代码:

Private Sub btnBrowse_Click(sender As Object, e As EventArgs) Handles btnBrowse.Click
    If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim path As String = OpenFileDialog1.FileName
        txtFilePath.Text = path

        Dim sample As String
        sample = md5_hash(path)
        txtHash.Text = md5_hash(path)

        Using f As System.IO.FileStream = System.IO.File.OpenRead("md5.txt")
            Using s As System.IO.StreamReader = New System.IO.StreamReader(f)
                While Not s.EndOfStream
                    Dim line As String = s.ReadLine

                    If (line = sample) Then
                        lblResult.Text = "Infected!"
                        lblResult.ForeColor = Color.Red
                    Else
                        lblResult.Text = "Clean!"
                        lblResult.ForeColor = Color.Green
                    End If
                End While
            End Using
        End Using
    End If
End Sub

这只是一部分代码。请告诉我如何解决此问题。我真的可以使用一些帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

当尝试更改拉布的位置时,请使用

lblresult.Location = new Point(xCoord here, yCoord here)

另一种调整位置的方法是

lblresult.Top += How much you want it to be pushed down/up from its origin

lblresult.Right
lblresult.Left
lblresult.Bottom

参数。我认为您应该提供关于您要实现的目标以及如何帮助您的更清晰详细的信息