frmProxy.frm
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:7k
源码类别:

浏览器

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmProxy 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "代理设置"
  5.    ClientHeight    =   3855
  6.    ClientLeft      =   3570
  7.    ClientTop       =   3435
  8.    ClientWidth     =   6480
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3855
  14.    ScaleWidth      =   6480
  15.    ShowInTaskbar   =   0   'False
  16.    Begin VB.ListBox lstOrder 
  17.       Height          =   1035
  18.       Left            =   360
  19.       TabIndex        =   12
  20.       Top             =   1680
  21.       Visible         =   0   'False
  22.       Width           =   1455
  23.    End
  24.    Begin VB.CommandButton cmdCancel 
  25.       Cancel          =   -1  'True
  26.       Caption         =   "取消"
  27.       Height          =   300
  28.       Left            =   5280
  29.       TabIndex        =   11
  30.       Top             =   3480
  31.       Width           =   1095
  32.    End
  33.    Begin VB.CommandButton cmdOk 
  34.       Caption         =   "确定"
  35.       Height          =   300
  36.       Left            =   4080
  37.       TabIndex        =   10
  38.       Top             =   3480
  39.       Width           =   1095
  40.    End
  41.    Begin VB.Frame Frame2 
  42.       Caption         =   "代理设置"
  43.       Height          =   3255
  44.       Left            =   2520
  45.       TabIndex        =   4
  46.       Top             =   120
  47.       Width           =   3855
  48.       Begin VB.CommandButton cmdUpdata 
  49.          Caption         =   "更新(&U)"
  50.          Height          =   300
  51.          Left            =   2880
  52.          TabIndex        =   16
  53.          Top             =   2880
  54.          Width           =   855
  55.       End
  56.       Begin VB.CheckBox chkByPass 
  57.          Caption         =   "对于本地地址不使用代理服务器"
  58.          Height          =   255
  59.          Left            =   120
  60.          TabIndex        =   14
  61.          Top             =   1080
  62.          Width           =   2895
  63.       End
  64.       Begin VB.TextBox txtByPass 
  65.          Height          =   1095
  66.          Left            =   120
  67.          MultiLine       =   -1  'True
  68.          ScrollBars      =   2  'Vertical
  69.          TabIndex        =   13
  70.          Top             =   1680
  71.          Width           =   3615
  72.       End
  73.       Begin VB.TextBox txtPort 
  74.          Height          =   270
  75.          Left            =   3120
  76.          TabIndex        =   9
  77.          Top             =   600
  78.          Width           =   615
  79.       End
  80.       Begin VB.TextBox txtAddress 
  81.          Height          =   270
  82.          Left            =   720
  83.          TabIndex        =   7
  84.          Top             =   600
  85.          Width           =   2295
  86.       End
  87.       Begin VB.TextBox txtName 
  88.          Height          =   270
  89.          Left            =   720
  90.          TabIndex        =   5
  91.          Top             =   240
  92.          Width           =   3015
  93.       End
  94.       Begin VB.Label Label3 
  95.          Caption         =   "对于以下地址不使用代理服务器:"
  96.          Height          =   180
  97.          Left            =   120
  98.          TabIndex        =   15
  99.          Top             =   1440
  100.          Width           =   2700
  101.       End
  102.       Begin VB.Label Label2 
  103.          Caption         =   "地址:"
  104.          Height          =   180
  105.          Left            =   120
  106.          TabIndex        =   8
  107.          Top             =   600
  108.          Width           =   540
  109.       End
  110.       Begin VB.Label Label1 
  111.          Caption         =   "名称:"
  112.          Height          =   180
  113.          Left            =   120
  114.          TabIndex        =   6
  115.          Top             =   240
  116.          Width           =   540
  117.       End
  118.    End
  119.    Begin VB.Frame Frame1 
  120.       Caption         =   "代理服务器列表"
  121.       Height          =   3255
  122.       Left            =   120
  123.       TabIndex        =   0
  124.       Top             =   120
  125.       Width           =   2175
  126.       Begin VB.CommandButton cmdDel 
  127.          Caption         =   "删除"
  128.          Height          =   300
  129.          Left            =   1200
  130.          TabIndex        =   3
  131.          Top             =   2880
  132.          Width           =   855
  133.       End
  134.       Begin VB.CommandButton cmdAdd 
  135.          Caption         =   "新增"
  136.          Height          =   300
  137.          Left            =   120
  138.          TabIndex        =   2
  139.          Top             =   2880
  140.          Width           =   855
  141.       End
  142.       Begin VB.ListBox lstProxyList 
  143.          Height          =   2400
  144.          Left            =   120
  145.          TabIndex        =   1
  146.          Top             =   240
  147.          Width           =   1935
  148.       End
  149.    End
  150. End
  151. Attribute VB_Name = "frmProxy"
  152. Attribute VB_GlobalNameSpace = False
  153. Attribute VB_Creatable = False
  154. Attribute VB_PredeclaredId = True
  155. Attribute VB_Exposed = False
  156. Option Explicit
  157. Dim tmpProxyData() As proxyType
  158. Dim tmpProxyDataCount As Integer
  159. Dim iniProxyData As proxyType
  160. Public IsCancel As Boolean
  161. Private Sub cmdAdd_Click()
  162. tmpProxyDataCount = tmpProxyDataCount + 1
  163. ReDim Preserve tmpProxyData(0 To tmpProxyDataCount)
  164. tmpProxyData(tmpProxyDataCount) = iniProxyData
  165. lstOrder.AddItem tmpProxyDataCount
  166. lstProxyList.AddItem "New Proxy"
  167. lstProxyList.ListIndex = lstProxyList.ListCount - 1
  168. With txtName
  169.     .Text = "New Proxy"
  170.     .SetFocus
  171. End With
  172. End Sub
  173. Private Sub cmdCancel_Click()
  174. IsCancel = True
  175. Me.Hide
  176. 'Unload Me
  177. End Sub
  178. Private Sub cmdDel_Click()
  179. If lstProxyList.ListIndex >= 0 Then
  180.     Dim tmpIndex As Integer
  181.     tmpIndex = lstProxyList.ListIndex
  182.     lstOrder.RemoveItem tmpIndex
  183.     lstProxyList.RemoveItem tmpIndex
  184.     If lstProxyList.ListCount - 1 < tmpIndex Then tmpIndex = tmpIndex - 1
  185.     If lstProxyList.ListCount > 0 Then
  186.         lstProxyList.ListIndex = tmpIndex
  187.         lstOrder.ListIndex = tmpIndex
  188.     End If
  189. End If
  190. End Sub
  191. Private Sub cmdOk_Click()
  192. Dim i As Integer
  193. proxyDataCount = lstOrder.ListCount
  194. ReDim proxyData(0 To proxyDataCount)
  195. For i = 1 To proxyDataCount
  196.     proxyData(i) = tmpProxyData(Val(lstOrder.List(i - 1)))
  197. Next
  198. IsCancel = False
  199. Me.Hide
  200. 'Unload Me
  201. End Sub
  202. Private Sub cmdUpdata_Click()
  203. If lstProxyList.ListIndex >= 0 Then
  204.     With tmpProxyData(Val(lstOrder.List(lstProxyList.ListIndex)))
  205.         .proxyName = Trim$(txtName)
  206.         .address = Trim$(txtAddress)
  207.         .port = Trim$(txtPort)
  208.         .isByPass = chkByPass.Value
  209.         .bypass = Trim$(txtByPass)
  210.         lstProxyList.List(lstProxyList.ListIndex) = .proxyName
  211.     End With
  212. End If
  213. End Sub
  214. Private Sub Form_Initialize()
  215. IsCancel = True
  216. With iniProxyData
  217.     .address = vbNullChar
  218.     .bypass = vbNullChar
  219.     .isByPass = 0
  220.     .port = vbNullChar
  221.     .proxyName = "New Proxy"
  222. End With
  223. ReDim tmpProxyData(0 To proxyDataCount)
  224. tmpProxyDataCount = proxyDataCount
  225. End Sub
  226. Private Sub Form_Load()
  227. If proxyDataCount > 0 Then
  228.     Dim i As Integer
  229.     For i = 1 To proxyDataCount
  230.         tmpProxyData(i) = proxyData(i)
  231.         lstProxyList.AddItem tmpProxyData(i).proxyName
  232.         lstOrder.AddItem i
  233.     Next
  234.     lstProxyList.ListIndex = 0
  235. End If
  236. End Sub
  237. Private Sub lstProxyList_Click()
  238. With tmpProxyData(Val(lstOrder.List(lstProxyList.ListIndex)))
  239.     txtAddress.Text = RTrim$(.address)
  240.     txtPort.Text = RTrim$(.port)
  241.     txtName.Text = RTrim$(.proxyName)
  242.     txtByPass.Text = RTrim$(.bypass)
  243.     chkByPass.Value = .isByPass
  244. End With
  245. End Sub
  246. Private Sub txtName_GotFocus()
  247. With txtName
  248.     .SelStart = 0
  249.     .SelLength = Len(.Text)
  250. End With
  251. End Sub