?? frmjobadd.vb
字號:
Public Class frmJobAdd
Inherits System.Windows.Forms.Form
#Region " Windows 窗體設計器生成的代碼 "
Public Sub New()
MyBase.New()
'該調用是 Windows 窗體設計器所必需的。
InitializeComponent()
'在 InitializeComponent() 調用之后添加任何初始化
End Sub
'窗體重寫 dispose 以清理組件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗體設計器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下過程是 Windows 窗體設計器所必需的
'可以使用 Windows 窗體設計器修改此過程。
'不要使用代碼編輯器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents URLS As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents INdirs As System.Windows.Forms.TextBox
Friend WithEvents INname As System.Windows.Forms.TextBox
Friend WithEvents C_DIR As System.Windows.Forms.Button
Friend WithEvents login As System.Windows.Forms.CheckBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents USERS As System.Windows.Forms.TextBox
Friend WithEvents PASS As System.Windows.Forms.TextBox
Friend WithEvents BTNok As System.Windows.Forms.Button
Friend WithEvents BTNcancel As System.Windows.Forms.Button
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents InputPanel1 As Microsoft.WindowsCE.Forms.InputPanel
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents Mcopy As System.Windows.Forms.MenuItem
Friend WithEvents Mp As System.Windows.Forms.MenuItem
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents DOM As System.Windows.Forms.TextBox
Friend WithEvents CheckPage As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmJobAdd))
Me.Label1 = New System.Windows.Forms.Label
Me.URLS = New System.Windows.Forms.TextBox
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu
Me.Mcopy = New System.Windows.Forms.MenuItem
Me.Mp = New System.Windows.Forms.MenuItem
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.INdirs = New System.Windows.Forms.TextBox
Me.INname = New System.Windows.Forms.TextBox
Me.C_DIR = New System.Windows.Forms.Button
Me.login = New System.Windows.Forms.CheckBox
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.USERS = New System.Windows.Forms.TextBox
Me.PASS = New System.Windows.Forms.TextBox
Me.BTNok = New System.Windows.Forms.Button
Me.BTNcancel = New System.Windows.Forms.Button
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.InputPanel1 = New Microsoft.WindowsCE.Forms.InputPanel
Me.Label6 = New System.Windows.Forms.Label
Me.DOM = New System.Windows.Forms.TextBox
Me.CheckPage = New System.Windows.Forms.CheckBox
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(2, 27)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(45, 16)
Me.Label1.Text = "地址"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'URLS
'
Me.URLS.ContextMenu = Me.ContextMenu1
Me.URLS.Location = New System.Drawing.Point(50, 27)
Me.URLS.Name = "URLS"
Me.URLS.Size = New System.Drawing.Size(177, 21)
Me.URLS.TabIndex = 15
Me.URLS.Text = "http://"
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.Add(Me.Mcopy)
Me.ContextMenu1.MenuItems.Add(Me.Mp)
'
'Mcopy
'
Me.Mcopy.Text = "復制"
'
'Mp
'
Me.Mp.Text = "粘貼"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(2, 53)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(45, 16)
Me.Label2.Text = "保存位置"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(2, 79)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(45, 17)
Me.Label3.Text = "另存為"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'INdirs
'
Me.INdirs.Location = New System.Drawing.Point(50, 53)
Me.INdirs.Name = "INdirs"
Me.INdirs.Size = New System.Drawing.Size(156, 21)
Me.INdirs.TabIndex = 12
Me.INdirs.Text = "\"
'
'INname
'
Me.INname.Location = New System.Drawing.Point(50, 79)
Me.INname.Name = "INname"
Me.INname.Size = New System.Drawing.Size(177, 21)
Me.INname.TabIndex = 11
'
'C_DIR
'
Me.C_DIR.Location = New System.Drawing.Point(205, 53)
Me.C_DIR.Name = "C_DIR"
Me.C_DIR.Size = New System.Drawing.Size(22, 21)
Me.C_DIR.TabIndex = 10
Me.C_DIR.Text = "…"
'
'login
'
Me.login.Location = New System.Drawing.Point(46, 118)
Me.login.Name = "login"
Me.login.Size = New System.Drawing.Size(124, 20)
Me.login.TabIndex = 9
Me.login.Text = "用以下用戶登陸"
'
'Label4
'
Me.Label4.Enabled = False
Me.Label4.Location = New System.Drawing.Point(2, 144)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(45, 16)
Me.Label4.Text = "用戶名"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label5
'
Me.Label5.Enabled = False
Me.Label5.Location = New System.Drawing.Point(2, 168)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(45, 16)
Me.Label5.Text = "口令"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'USERS
'
Me.USERS.Enabled = False
Me.USERS.Location = New System.Drawing.Point(50, 144)
Me.USERS.Name = "USERS"
Me.USERS.Size = New System.Drawing.Size(177, 21)
Me.USERS.TabIndex = 6
'
'PASS
'
Me.PASS.Enabled = False
Me.PASS.Location = New System.Drawing.Point(50, 168)
Me.PASS.Name = "PASS"
Me.PASS.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
Me.PASS.Size = New System.Drawing.Size(177, 21)
Me.PASS.TabIndex = 5
'
'BTNok
'
Me.BTNok.Location = New System.Drawing.Point(75, 232)
Me.BTNok.Name = "BTNok"
Me.BTNok.Size = New System.Drawing.Size(72, 20)
Me.BTNok.TabIndex = 4
Me.BTNok.Text = "確定"
'
'BTNcancel
'
Me.BTNcancel.Location = New System.Drawing.Point(153, 232)
Me.BTNcancel.Name = "BTNcancel"
Me.BTNcancel.Size = New System.Drawing.Size(72, 20)
Me.BTNcancel.TabIndex = 3
Me.BTNcancel.Text = "取消"
'
'Label6
'
Me.Label6.Enabled = False
Me.Label6.Location = New System.Drawing.Point(2, 192)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(45, 20)
Me.Label6.Text = "域"
Me.Label6.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'DOM
'
Me.DOM.Enabled = False
Me.DOM.Location = New System.Drawing.Point(50, 192)
Me.DOM.Name = "DOM"
Me.DOM.Size = New System.Drawing.Size(177, 21)
Me.DOM.TabIndex = 1
'
'CheckPage
'
Me.CheckPage.Location = New System.Drawing.Point(138, 118)
Me.CheckPage.Name = "CheckPage"
Me.CheckPage.Size = New System.Drawing.Size(95, 20)
Me.CheckPage.TabIndex = 0
Me.CheckPage.Text = "處理此網頁"
Me.CheckPage.Visible = False
'
'frmJobAdd
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
Me.ClientSize = New System.Drawing.Size(240, 268)
Me.Controls.Add(Me.login)
Me.Controls.Add(Me.CheckPage)
Me.Controls.Add(Me.DOM)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.BTNcancel)
Me.Controls.Add(Me.BTNok)
Me.Controls.Add(Me.PASS)
Me.Controls.Add(Me.USERS)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.C_DIR)
Me.Controls.Add(Me.INname)
Me.Controls.Add(Me.INdirs)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.URLS)
Me.Controls.Add(Me.Label1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Menu = Me.MainMenu1
Me.Name = "frmJobAdd"
Me.Text = "添加"
Me.ResumeLayout(False)
End Sub
#End Region
Dim f_hwnd As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNok.Click
Me.DialogResult = Windows.Forms.DialogResult.OK
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNcancel.Click
Me.DialogResult = Windows.Forms.DialogResult.Cancel
End Sub
Private Sub C_DIR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C_DIR.Click
Dim op As New frmSelectSavePath
If op.ShowDialog = Windows.Forms.DialogResult.OK Then INdirs.Text = op.LASTdir
End Sub
Private Sub login_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles login.Click
If login.Checked = True Then
Label4.Enabled = True
Label5.Enabled = True
Label6.Enabled = True
USERS.Enabled = True
PASS.Enabled = True
DOM.Enabled = True
Else
Label4.Enabled = False
Label5.Enabled = False
Label6.Enabled = False
USERS.Enabled = False
PASS.Enabled = False
DOM.Enabled = False
End If
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
URLS.Capture = True
f_hwnd = GetCapture()
URLS.Text = "http://"
End Sub
Private Sub URLS_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles URLS.GotFocus
URLS.SelectAll()
End Sub
Private Sub Mp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mp.Click
Try
SendMessage(f_hwnd, WM_PASTE, 0, 0)
Catch ex As Exception
End Try
End Sub
Private Sub Mcopy_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Mcopy.Click
Try
SendMessage(f_hwnd, WM_COPY, 0, 0)
Catch ex As Exception
End Try
End Sub
Private Sub Form2_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If Me.DialogResult = Windows.Forms.DialogResult.Cancel Then Exit Sub
If INdirs.Text = "\" Then
MessageBox.Show("請不要選擇根文件夾!", "MobileAnt Demo")
e.Cancel = True
Exit Sub
End If
'文件保存位置不存在
If System.IO.Directory.Exists(INdirs.Text) = False Then
If MessageBox.Show("文件保存位置不存在,是否建立?", "MobileAnt Demo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
Try
System.IO.Directory.CreateDirectory(INdirs.Text)
Catch ex As IO.IOException
MessageBox.Show("建立文件夾失敗!", "MobileAnt Demo")
e.Cancel = True
Exit Sub
End Try
End If
End If
Dim UU As Uri
Try
UU = New Uri(URLS.Text)
Select Case UU.Scheme '支持的下載協議
Case "http"
Case "https"
Case "ftp"
Case Else
Throw New System.Exception("")
End Select
Catch ex As Exception
MessageBox.Show("網址錄入不正確或不支持的下載方式,請重新檢查!", "MobileAnt Demo")
e.Cancel = True
End Try
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -