home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Shareware / Programare / netxp / netxp.exe / Samples / VB / Components / Form1.vb < prev   
Encoding:
Text File  |  2004-04-09  |  8.0 KB  |  182 lines

  1. Imports System
  2. Imports System.Drawing
  3. Imports System.Collections
  4. Imports System.ComponentModel
  5. Imports System.Windows.Forms
  6. Imports System.Data
  7.  
  8. Namespace Components
  9.     Public Class Form1
  10.         Inherits System.Windows.Forms.Form
  11.         Private mainMenu1 As System.Windows.Forms.MainMenu
  12.         Private menuItem1 As System.Windows.Forms.MenuItem
  13.         Private menuItem2 As System.Windows.Forms.MenuItem
  14.         Private menuItem3 As System.Windows.Forms.MenuItem
  15.         Private menuImageExtender1 As NETXP.Components.Extenders.MenuImageExtender
  16.         Private imageStore1 As NETXP.Components.ImageStore
  17.         Private WithEvents pictureBox1 As System.Windows.Forms.PictureBox
  18.         Private WithEvents button1 As System.Windows.Forms.Button
  19.         Private notifyBg As NETXP.Components.ImageStore
  20.         Private notifyClose As NETXP.Components.ImageStore
  21.         Private notifyIconEx1 As NETXP.Components.NotifyIconEx
  22.         Private WithEvents button2 As System.Windows.Forms.Button
  23.         Private components As System.ComponentModel.IContainer
  24.  
  25.         Public Sub New()
  26.             '
  27.             ' Required for Windows Form Designer support
  28.             '
  29.             InitializeComponent()
  30.  
  31.             '
  32.             ' TODO: Add any constructor code after InitializeComponent call
  33.             '
  34.         End Sub
  35.  
  36.         Protected Overrides Sub Dispose(ByVal disposing As Boolean)
  37.             If disposing Then
  38.                 If Not components Is Nothing Then
  39.                     components.Dispose()
  40.                 End If
  41.             End If
  42.             MyBase.Dispose(disposing)
  43.         End Sub
  44.  
  45. #Region "Windows Form Designer generated code"
  46.         Private Sub InitializeComponent()
  47.             Me.components = New System.ComponentModel.Container
  48.             Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
  49.             Me.mainMenu1 = New System.Windows.Forms.MainMenu
  50.             Me.menuItem1 = New System.Windows.Forms.MenuItem
  51.             Me.menuItem2 = New System.Windows.Forms.MenuItem
  52.             Me.menuItem3 = New System.Windows.Forms.MenuItem
  53.             Me.menuImageExtender1 = New NETXP.Components.Extenders.MenuImageExtender(Me.components)
  54.             Me.imageStore1 = New NETXP.Components.ImageStore(Me.components)
  55.             Me.pictureBox1 = New System.Windows.Forms.PictureBox
  56.             Me.button1 = New System.Windows.Forms.Button
  57.             Me.notifyBg = New NETXP.Components.ImageStore(Me.components)
  58.             Me.notifyClose = New NETXP.Components.ImageStore(Me.components)
  59.             Me.notifyIconEx1 = New NETXP.Components.NotifyIconEx
  60.             Me.button2 = New System.Windows.Forms.Button
  61.             Me.SuspendLayout()
  62.             ' 
  63.             ' mainMenu1
  64.             ' 
  65.             Me.mainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuItem1})
  66.             ' 
  67.             ' menuItem1
  68.             ' 
  69.             Me.menuItem1.Index = 0
  70.             Me.menuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuItem2, Me.menuItem3})
  71.             Me.menuItem1.Text = "&Menu With Images"
  72.             ' 
  73.             ' menuItem2
  74.             ' 
  75.             Me.menuImageExtender1.SetImage(Me.menuItem2, (CType((resources.GetObject("menuItem2.Image")), System.Drawing.Image)))
  76.             Me.menuItem2.Index = 0
  77.             Me.menuItem2.OwnerDraw = True
  78.             Me.menuItem2.Text = "&An Item"
  79.             ' 
  80.             ' menuItem3
  81.             ' 
  82.             Me.menuImageExtender1.SetImage(Me.menuItem3, (CType((resources.GetObject("menuItem3.Image")), System.Drawing.Image)))
  83.             Me.menuItem3.Index = 1
  84.             Me.menuItem3.OwnerDraw = True
  85.             Me.menuItem3.Text = "Another &Item"
  86.             ' 
  87.             ' imageStore1
  88.             ' 
  89.             Me.imageStore1.Image = (CType((resources.GetObject("imageStore1.Image")), System.Drawing.Image))
  90.             ' 
  91.             ' pictureBox1
  92.             ' 
  93.             Me.pictureBox1.Location = New System.Drawing.Point(32, 32)
  94.             Me.pictureBox1.Name = "pictureBox1"
  95.             Me.pictureBox1.Size = New System.Drawing.Size(128, 128)
  96.             Me.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
  97.             Me.pictureBox1.TabIndex = 0
  98.             Me.pictureBox1.TabStop = False
  99.             ' 
  100.             ' button1
  101.             ' 
  102.             Me.button1.Location = New System.Drawing.Point(312, 32)
  103.             Me.button1.Name = "button1"
  104.             Me.button1.Size = New System.Drawing.Size(144, 23)
  105.             Me.button1.TabIndex = 1
  106.             Me.button1.Text = "Test &Taskbar Notifier"
  107.             ' 
  108.             ' notifyBg
  109.             ' 
  110.             Me.notifyBg.Image = (CType((resources.GetObject("notifyBg.Image")), System.Drawing.Image))
  111.             ' 
  112.             ' notifyClose
  113.             ' 
  114.             Me.notifyClose.Image = (CType((resources.GetObject("notifyClose.Image")), System.Drawing.Image))
  115.             ' 
  116.             ' notifyIconEx1
  117.             ' 
  118.             Me.notifyIconEx1.Icon = (CType((resources.GetObject("notifyIconEx1.Icon")), System.Drawing.Icon))
  119.             Me.notifyIconEx1.Text = "This is a test of the NotifyIconEx."
  120.             Me.notifyIconEx1.Visible = True
  121.             ' 
  122.             ' button2
  123.             ' 
  124.             Me.button2.Location = New System.Drawing.Point(296, 96)
  125.             Me.button2.Name = "button2"
  126.             Me.button2.Size = New System.Drawing.Size(168, 23)
  127.             Me.button2.TabIndex = 2
  128.             Me.button2.Text = "Test &Computer Browser"
  129.             ' 
  130.             ' Form1
  131.             ' 
  132.             Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  133.             Me.ClientSize = New System.Drawing.Size(480, 353)
  134.             Me.Controls.Add(Me.button2)
  135.             Me.Controls.Add(Me.button1)
  136.             Me.Controls.Add(Me.pictureBox1)
  137.             Me.Menu = Me.mainMenu1
  138.             Me.Name = "Form1"
  139.             Me.Text = "Form1"
  140.             Me.ResumeLayout(False)
  141.  
  142.         End Sub
  143. #End Region
  144.  
  145.         <STAThread()> _
  146.         Public Shared Sub Main(ByVal args As String())
  147.             Application.Run(New Form1)
  148.         End Sub
  149.  
  150.         Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  151.             'use ImageStore
  152.             Me.pictureBox1.Image = Me.imageStore1.Image
  153.             Me.notifyIconEx1.ShowBalloon("Testing NotifyIconEx", "This is a balloon tip. This is impossible to do with the standard NotifyIcon.", NETXP.Components.NotifyInfoFlags.Info, 3000)
  154.         End Sub
  155.  
  156.         Private Sub pictureBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles pictureBox1.Click
  157.             Me.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
  158.         End Sub
  159.  
  160.         Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.click
  161.             Dim tn As NETXP.Components.TaskbarNotifier
  162.             tn = New NETXP.Components.TaskbarNotifier
  163.             tn.NormalTitleColor = SystemColors.HotTrack
  164.             tn.NormalTitleFont = New Font(tn.NormalTitleFont, FontStyle.Bold)
  165.             tn.NormalContentColor = SystemColors.WindowText
  166.             tn.HoverContentColor = SystemColors.HotTrack
  167.             tn.HoverTitleColor = SystemColors.ActiveCaption
  168.             tn.HoverTitleFont = tn.NormalTitleFont
  169.             tn.SetBackgroundBitmap(notifyBg.Image, Color.FromArgb(255, 0, 255))
  170.             tn.SetCloseBitmap(notifyClose.Image, Color.FromArgb(255, 0, 255), New Point(127, 8))
  171.             tn.TitleRectangle = New Rectangle(60, 12, 100, 30)
  172.             tn.ContentRectangle = New Rectangle(8, 43, 133, 64)
  173.             tn.Show("Notification", "The XMark service has started.", 250, 1500, 250)
  174.         End Sub
  175.  
  176.         Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.click
  177.             Dim brf As NETXP.Components.CompBrowser = New NETXP.Components.CompBrowser
  178.             brf.ShowDialog(Me)
  179.             MessageBox.Show(brf.SelectedComputer)
  180.         End Sub
  181.     End Class
  182. End Namespace