FormMain_DaWang(一)

Imports System.Xml
Imports System.IO
Imports System.Net
Imports System.Threading
Imports System.Drawing.Imaging


Public Class FormMain
    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 LabelView As System.Windows.Forms.Label
    Friend WithEvents PicIndexTextBox As System.Windows.Forms.TextBox
    Friend WithEvents PictureBoxShower As System.Windows.Forms.PictureBox
    Friend WithEvents TimerDownLoad As System.Windows.Forms.Timer
    Friend WithEvents LabelProgress As System.Windows.Forms.PictureBox
    Friend WithEvents TimerAutoPlay As System.Windows.Forms.Timer
    Friend WithEvents CheckBoxAutoPlay As System.Windows.Forms.CheckBox
    Friend WithEvents LabelScan As System.Windows.Forms.Label
    Friend WithEvents tv As System.Windows.Forms.TreeView
    Friend WithEvents LabelCurentSelect As System.Windows.Forms.Label
    Friend WithEvents LabelAbout As System.Windows.Forms.Label
    Friend WithEvents LabelClose As System.Windows.Forms.Label
    Friend WithEvents LabelMini As System.Windows.Forms.Label
    Friend WithEvents PaneBotoom As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FormMain))
        Me.LabelClose = New System.Windows.Forms.Label
        Me.LabelView = New System.Windows.Forms.Label
        Me.PicIndexTextBox = New System.Windows.Forms.TextBox
        Me.PictureBoxShower = New System.Windows.Forms.PictureBox
        Me.TimerDownLoad = New System.Windows.Forms.Timer(Me.components)
        Me.TimerAutoPlay = New System.Windows.Forms.Timer(Me.components)
        Me.LabelProgress = New System.Windows.Forms.PictureBox
        Me.CheckBoxAutoPlay = New System.Windows.Forms.CheckBox
        Me.LabelScan = New System.Windows.Forms.Label
        Me.tv = New System.Windows.Forms.TreeView
        Me.LabelCurentSelect = New System.Windows.Forms.Label
        Me.LabelAbout = New System.Windows.Forms.Label
        Me.LabelMini = New System.Windows.Forms.Label
        Me.PaneBotoom = New System.Windows.Forms.Panel
        Me.SuspendLayout()
        '
        'LabelClose
        '
        Me.LabelClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.LabelClose.BackColor = System.Drawing.Color.DarkGray
        Me.LabelClose.Cursor = System.Windows.Forms.Cursors.Hand
        Me.LabelClose.Image = CType(resources.GetObject("LabelClose.Image"), System.Drawing.Image)
        Me.LabelClose.Location = New System.Drawing.Point(558, 12)
        Me.LabelClose.Name = "LabelClose"
        Me.LabelClose.Size = New System.Drawing.Size(36, 21)
        Me.LabelClose.TabIndex = 3
        '
        'LabelView
        '
        Me.LabelView.BackColor = System.Drawing.Color.Transparent
        Me.LabelView.Cursor = System.Windows.Forms.Cursors.Hand
        Me.LabelView.Image = CType(resources.GetObject("LabelView.Image"), System.Drawing.Image)
        Me.LabelView.Location = New System.Drawing.Point(270, 345)
        Me.LabelView.Name = "LabelView"
        Me.LabelView.Size = New System.Drawing.Size(33, 24)
        Me.LabelView.TabIndex = 4
        '
        'PicIndexTextBox
        '
        Me.PicIndexTextBox.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
        Me.PicIndexTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.PicIndexTextBox.ForeColor = System.Drawing.Color.Red
        Me.PicIndexTextBox.Location = New System.Drawing.Point(207, 348)
        Me.PicIndexTextBox.Name = "PicIndexTextBox"
        Me.PicIndexTextBox.Size = New System.Drawing.Size(54, 14)
        Me.PicIndexTextBox.TabIndex = 5
        Me.PicIndexTextBox.Text = ""
        '
        'PictureBoxShower
        '
        Me.PictureBoxShower.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.PictureBoxShower.BackColor = System.Drawing.Color.Transparent
        Me.PictureBoxShower.Cursor = System.Windows.Forms.Cursors.SizeAll
        Me.PictureBoxShower.Location = New System.Drawing.Point(372, 184)
        Me.PictureBoxShower.Name = "PictureBoxShower"
        Me.PictureBoxShower.Size = New System.Drawing.Size(144, 160)
        Me.PictureBoxShower.TabIndex = 6
        Me.PictureBoxShower.TabStop = False
        '
        'TimerDownLoad
        '
        Me.TimerDownLoad.Interval = 400
        '
        'TimerAutoPlay
        '
        '
        'LabelProgress
        '
        Me.LabelProgress.BackColor = System.Drawing.Color.Transparent
        Me.LabelProgress.Image = CType(resources.GetObject("LabelProgress.Image"), System.Drawing.Image)
        Me.LabelProgress.Location = New System.Drawing.Point(294, 174)
        Me.LabelProgress.Name = "LabelProgress"
        Me.LabelProgress.Size = New System.Drawing.Size(22, 24)
        Me.LabelProgress.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.LabelProgress.TabIndex = 8
        Me.LabelProgress.TabStop = False
        '
        'CheckBoxAutoPlay
        '
        Me.CheckBoxAutoPlay.BackColor = System.Drawing.Color.Transparent
        Me.CheckBoxAutoPlay.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.CheckBoxAutoPlay.ForeColor = System.Drawing.Color.DodgerBlue
        Me.CheckBoxAutoPlay.Location = New System.Drawing.Point(304, 120)
        Me.CheckBoxAutoPlay.Name = "CheckBoxAutoPlay"
        Me.CheckBoxAutoPlay.TabIndex = 10
        Me.CheckBoxAutoPlay.Text = "AutoPlay"
        '
        'LabelScan
        '
        Me.LabelScan.BackColor = System.Drawing.Color.Transparent
        Me.LabelScan.ForeColor = System.Drawing.Color.Red
        Me.LabelScan.Location = New System.Drawing.Point(195, 174)
        Me.LabelScan.Name = "LabelScan"
        Me.LabelScan.Size = New System.Drawing.Size(88, 23)
        Me.LabelScan.TabIndex = 11
        Me.LabelScan.Text = "扫描中。。"
        Me.LabelScan.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.LabelScan.Visible = False
        '
        'tv
        '
        Me.tv.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.tv.ForeColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(192, Byte))
        Me.tv.ImageIndex = -1
        Me.tv.Location = New System.Drawing.Point(9, 39)
        Me.tv.Name = "tv"
        Me.tv.SelectedImageIndex = -1
        Me.tv.Size = New System.Drawing.Size(171, 432)
        Me.tv.TabIndex = 12
        '
        'LabelCurentSelect
        '
        Me.LabelCurentSelect.BackColor = System.Drawing.Color.Transparent
        Me.LabelCurentSelect.ForeColor = System.Drawing.Color.Red
        Me.LabelCurentSelect.Location = New System.Drawing.Point(189, 93)
        Me.LabelCurentSelect.Name = "LabelCurentSelect"
        Me.LabelCurentSelect.Size = New System.Drawing.Size(176, 23)
        Me.LabelCurentSelect.TabIndex = 13
        '
        'LabelAbout
        '
        Me.LabelAbout.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.LabelAbout.BackColor = System.Drawing.Color.Transparent
        Me.LabelAbout.Cursor = System.Windows.Forms.Cursors.Hand
        Me.LabelAbout.Image = CType(resources.GetObject("LabelAbout.Image"), System.Drawing.Image)
        Me.LabelAbout.Location = New System.Drawing.Point(555, 45)
        Me.LabelAbout.Name = "LabelAbout"
        Me.LabelAbout.Size = New System.Drawing.Size(38, 22)
        Me.LabelAbout.TabIndex = 14
        '
        'LabelMini
        '
        Me.LabelMini.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.LabelMini.BackColor = System.Drawing.Color.Transparent
        Me.LabelMini.Cursor = System.Windows.Forms.Cursors.Hand
        Me.LabelMini.Image = CType(resources.GetObject("LabelMini.Image"), System.Drawing.Image)
        Me.LabelMini.Location = New System.Drawing.Point(519, 12)
        Me.LabelMini.Name = "LabelMini"
        Me.LabelMini.Size = New System.Drawing.Size(36, 21)
        Me.LabelMini.TabIndex = 15
        '
        'PaneBotoom
        '
        Me.PaneBotoom.AutoScroll = True
        Me.PaneBotoom.BackColor = System.Drawing.Color.Transparent
        Me.PaneBotoom.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.PaneBotoom.Location = New System.Drawing.Point(0, 491)
        Me.PaneBotoom.Name = "PaneBotoom"
        Me.PaneBotoom.Size = New System.Drawing.Size(598, 126)
        Me.PaneBotoom.TabIndex = 16
        '
        'FormMain
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(598, 617)
        Me.Controls.Add(Me.PaneBotoom)
        Me.Controls.Add(Me.LabelMini)
        Me.Controls.Add(Me.LabelAbout)
        Me.Controls.Add(Me.LabelCurentSelect)
        Me.Controls.Add(Me.tv)
        Me.Controls.Add(Me.LabelScan)
        Me.Controls.Add(Me.CheckBoxAutoPlay)
        Me.Controls.Add(Me.LabelProgress)
        Me.Controls.Add(Me.PicIndexTextBox)
        Me.Controls.Add(Me.LabelView)
        Me.Controls.Add(Me.LabelClose)
        Me.Controls.Add(Me.PictureBoxShower)
        Me.Name = "FormMain"
        Me.Text = "打望专家"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Dim IsFullMode As Boolean = True
    Dim PicMaximum, PicFileLenth, wi As Integer
    Dim LabelProgressMaximum As Integer = 100
    Dim i As Integer = 1
    Dim IsRuning As Boolean
    Dim CurentPic As String
    Dim Cmplete, AutoPlay, CanStartAutoPlay As Boolean
    Dim strLocalPath As String

    '------------------------

    Dim bgDarkPic, bgLightPic As Image


    Dim smallPicSize As New Size(200, 250)

 

    '-------------------------------------------------------

    Dim myXPath As String = "//groups/channelgroup"
    'Dim strXpath3 As String = "//groups/group/name"
    'Dim strXPath4 As String = "//groups/group/channel"
    Dim x As XmlDocument
    Dim r As XmlReader

    Dim n As XmlNode
    Dim ns As XmlNodeList
    Dim xmlDoc As New XmlDocument
    Dim myXMLreader As XmlReader
    Dim myXMLwriter As XmlWriter
    Dim xmlNodeR As XmlNodeReader
    Dim xmlNode As XmlNode '' = xmlDoc.SelectSingleNode(strXpath)
    Dim objs As String


    Sub loadXML(ByVal XmlFilePath As String)


        xmlDoc.Load(XmlFilePath)


        Dim xmlNodes As XmlNodeList = xmlDoc.SelectNodes(myXPath)


        For i As Integer = 0 To xmlNodes.Count - 1

 

            Me.tv.Nodes.Add(xmlNodes.Item(i).Attributes.Item(0).Value)

 

 

            For j As Integer = 0 To xmlNodes.Item(i).ChildNodes.Count - 1


                Me.tv.Nodes(i).Nodes.Add(xmlNodes.Item(i).ChildNodes.ItemOf(j).Attributes(0).Value)

                For k As Integer = 0 To xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Count - 1

                    '  tv.Nodes(i).Nodes(j).Nodes.Add(xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).InnerXml)

                    For l As Integer = 0 To xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Count - 1
                        '---------------this comment code blow can not work ,can not set the treeNode's Tag property correct------WGSCD 2006---------
                        ' tv.Nodes(i).Nodes(j).Nodes.Add(xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Item(l).ChildNodes.Item(0).Value)
                        'Dim obj As String = xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Item(l).Attributes(0).Value
                        'MsgBox(tv.Nodes(i).Nodes(j).Nodes(l).Tag =obj
                        '-----------------------------------------------------------------

 

 

                        Dim myTreeNode As New TreeNode(xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Item(l).ChildNodes.Item(0).Value)

                        Dim obj As String() = New String(1) {xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Item(l).Attributes(0).Value, xmlNodes.Item(i).ChildNodes.ItemOf(j).ChildNodes.Item(k).ChildNodes.Item(l).Attributes(1).Value()}


                        myTreeNode.Tag = obj

 

                        tv.Nodes(i).Nodes(j).Nodes.Add(myTreeNode)

 

                    Next

                Next

            Next

            '    Me.tv.Nodes.Item(i).Nodes.Add(xmlNodes.Item(i).ChildNodes.Item(j).InnerXml)

        Next


        ' MsgBox(xmlNodes.ItemOf(i).HasChildNodes)


    End Sub

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        LabelView.Enabled = False


        bgLightPic = Me.BackgroundImage

        bgDarkPic = Image.FromFile("Pictures/BgDark.jpg")

 

 

        FullMode()
        '  Me.TopMost = True
        Me.CenterToScreen()


        loadXML("config/channels.xml")

        tv.ExpandAll()

 


        Me.TimerDownLoad.Interval = 50
        Me.TimerAutoPlay.Interval = 1000

 

 

 

    End Sub
    Sub FullMode()
        Me.FormBorderStyle = FormBorderStyle.None

        Me.Location = New Point(0, 0)
        Me.Size = New Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)

        Me.CenterToScreen()

    End Sub

   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值