vb.net - 不懂做visual basic显示国家和城市的项目
问题描述
屏幕截图所以目前我正在尝试创建一个应用程序,其中有两个列表框,一个显示国家/地区,一个显示这些国家/地区的城市。单击列表框中的城市后,richtextbox 将以特定格式显示信息,这与我提供的屏幕截图相同。然后,图片框将提供该城市的图片。还有两个标签:人口和降雨量,它显示了它的统计信息,但是当我单击列表框中的城市时,我不知道如何触发它。另外,我想知道如何通过复选框使文本字体变大和变小,当然是BY CODE。我目前正在编写代码,但似乎我无处可去。
Public Class frmWorldCities
'---------------------------------------------------
'Description: Class-wide declarations
'
'Calls: fNumOfFiles
'---------------------------------------------------
Const cstrPath As String = "..\Data\gldfiles\"
Dim CIntNumofFiles As Integer = 78
Dim cstrFileNames(CIntNumofFiles - 1) As String
Dim cintFileLines(CIntNumofFiles - 1) As Integer
Dim cstrCityNames(CIntNumofFiles - 1) As String
Dim cstrFileCountryNames(CIntNumofFiles - 1) As String
Dim cstrPopulation(CIntNumofFiles - 1) As String
Dim cstrRainfall(CIntNumofFiles - 1) As String
Dim cstrInformation(CIntNumofFiles - 1) As String
Dim cstrPictureName(CIntNumofFiles - 1) As String
Private Sub frmWorldCities_Load(sender As Object, e As EventArgs) Handles Me.Load
'---------------------------------------------------------------------------
'Description: how the application should display while opening.
'---------------------------------------------------------------------------
Dim strTemp As String = ""
Dim intLines As Integer
Dim i As Integer
Dim j As Integer
FileOpen(1, cstrPath & "list.wcf", OpenMode.Input)
Input(1, strTemp)
intLines = CInt(strTemp)
For i = 0 To intLines - 2
Input(1, cstrFileNames(i))
lstCities.Items.Add(cstrFileNames(i))
Next i
FileClose(1)
For i = 0 To cstrFileNames.Length - 1
FileOpen(1, cstrPath & cstrFileNames(i), OpenMode.Input)
Input(1, strTemp)
cintFileLines(i) = CInt(strTemp)
cstrCityNames(i) = LineInput(1)
Input(1, strTemp)
Input(1, cstrFileCountryNames(i))
cstrPopulation(i) = LineInput(1)
Input(1, cstrRainfall(i))
Input(1, strTemp)
For j = 0 To cintFileLines(i) - 10
strTemp = LineInput(1)
cstrInformation(i) &= strTemp & Chr(13)
Next j
Input(1, strTemp)
Input(1, cstrPictureName(i))
FileClose(1)
Next i
End Sub
Private Sub lstCountries_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstCountries.SelectedIndexChanged
'------------------------------------
'Description: listing the cities.
'------------------------------------
Dim i As Integer
lstCities.Items.Clear()
For i = 0 To cstrCityNames.Length - 1
If lstCountries.SelectedItem.ToString = cstrFileCountryNames(i) Then
lstCities.Items.Add(cstrCityNames(i))
End If
Next i
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
' To close the application
Me.Close()
End Sub
Private Sub chkBold_CheckedChanged(sender As Object, e As EventArgs) Handles chkBold.CheckedChanged
' To make the information bold.
If chkBold.Checked = True Then
rtbInformation.Font = New Font(rtbInformation.Font, FontStyle.Bold)
Else
rtbInformation.Font = New Font(rtbInformation.Font, FontStyle.Regular)
End If
End Sub
Private Sub chkItalic_CheckedChanged(sender As Object, e As EventArgs) Handles chkItalic.CheckedChanged
If chkItalic.Checked = True Then
rtbInformation.Font = New Font(rtbInformation.Font, FontStyle.Italic)
Else
rtbInformation.Font = New Font(rtbInformation.Font, FontStyle.Regular)
End If
End Sub
Private Sub chkBiggerFont_CheckedChanged(sender As Object, e As EventArgs) Handles chkBiggerFont.CheckedChanged
If chkBiggerFont.Checked = True Then
rtbInformation.Font = New Font(rtbInformation.Font, FontStyle.Strikeout)
End If
End Sub
Private Sub chkSmallerFont_CheckedChanged(sender As Object, e As EventArgs) Handles chkSmallerFont.CheckedChanged
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles picCities.Click
End Sub
End Class
解决方案
推荐阅读
- python - 如何将多个参数从机器人脚本传递给python
- javascript - 如何使用 JavaScript/JQuery 在 CSV 标题中添加注释
- java - JDK中是否有一个可中断且可以直接注册回调的Future类?
- css - 如何在@font-face url中使用css变量
- javascript - 如何隐藏 HTML 表格中的列
- cumulocity - 限制用户访问特定组/设备、警报、事件、测量
- angular - Angular 7 - ControlValueAccessor - 修剪绑定到表单的输入值
- javascript - 如何计算球与墙壁碰撞的反射角
- reactjs - 即使商店状态正在改变,UI 也不会重新渲染?
- r - 在基础 R 中运行 rmarkdown 的代码/过程