我正在使用以下代码:
Private Sub Form_Load()
ResWidth = Screen.Width \ Screen.TwipsPerPixelX
ResHeight = Screen.Height \ Screen.TwipsPerPixelY
ScreenRes = ResWidth & "x" & ResHeight
MsgBox (ScreenRes)
End Sub
Run Code Online (Sandbox Code Playgroud)
以及我在谷歌上搜索过的其他几个类似的代码。问题是,我总是收到一个消息框,说我的分辨率是 1200x1200,尽管我的实际分辨率是 1920x1200。为什么我会得到不好的结果?
我从text103.text开始,其文本值为我要检查的C:\ test.txt.因此,如果text103.text中的任何内容与C中的任何内容匹配:\ test.txt label3.caption应该读取"成功",但每次运行它时,我都会"失败"为什么?
所以这是我的按钮中的代码:
Private Sub Command1_Click()
nFileNum = FreeFile
Open "C:\test.txt" For Input As nFileNum
lLineCount = 1
Do While Not EOF(nFileNum)
Line Input #nFileNum, sNextLine
sNextLine = sNextLine & vbCrLf
sText = sText & sNextLine
Loop
Text102.Text = sText
Close nFileNum
If Text102.Text = Text103.Text Then
Label3.Caption = "success"
Else
Label3.Caption = "failure"
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
即使我的text103.text以"hello"开头,我编辑C:\ test.txt只是说"你好"它总是给我label3.caption"失败"!!! 为什么???
vb6 ×2