home *** CD-ROM | disk | FTP | other *** search
Wrap
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace Components { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private NETXP.Components.Extenders.MenuImageExtender menuImageExtender1; private NETXP.Components.ImageStore imageStore1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Button button1; private NETXP.Components.ImageStore notifyBg; private NETXP.Components.ImageStore notifyClose; private NETXP.Components.NotifyIconEx notifyIconEx1; private System.Windows.Forms.Button button2; private System.ComponentModel.IContainer components; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuImageExtender1 = new NETXP.Components.Extenders.MenuImageExtender(this.components); this.imageStore1 = new NETXP.Components.ImageStore(this.components); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.button1 = new System.Windows.Forms.Button(); this.notifyBg = new NETXP.Components.ImageStore(this.components); this.notifyClose = new NETXP.Components.ImageStore(this.components); this.notifyIconEx1 = new NETXP.Components.NotifyIconEx(); this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // mainMenu1 // this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2, this.menuItem3}); this.menuItem1.Text = "&Menu With Images"; // // menuItem2 // this.menuImageExtender1.SetImage(this.menuItem2, ((System.Drawing.Image)(resources.GetObject("menuItem2.Image")))); this.menuItem2.Index = 0; this.menuItem2.OwnerDraw = true; this.menuItem2.Text = "&An Item"; // // menuItem3 // this.menuImageExtender1.SetImage(this.menuItem3, ((System.Drawing.Image)(resources.GetObject("menuItem3.Image")))); this.menuItem3.Index = 1; this.menuItem3.OwnerDraw = true; this.menuItem3.Text = "Another &Item"; // // imageStore1 // this.imageStore1.Image = ((System.Drawing.Image)(resources.GetObject("imageStore1.Image"))); // // pictureBox1 // this.pictureBox1.Location = new System.Drawing.Point(32, 32); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(128, 128); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // button1 // this.button1.Location = new System.Drawing.Point(312, 32); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(144, 23); this.button1.TabIndex = 1; this.button1.Text = "Test &Taskbar Notifier"; this.button1.Click += new System.EventHandler(this.button1_Click); // // notifyBg // this.notifyBg.Image = ((System.Drawing.Image)(resources.GetObject("notifyBg.Image"))); // // notifyClose // this.notifyClose.Image = ((System.Drawing.Image)(resources.GetObject("notifyClose.Image"))); // // notifyIconEx1 // this.notifyIconEx1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIconEx1.Icon"))); this.notifyIconEx1.Text = "This is a test of the NotifyIconEx."; this.notifyIconEx1.Visible = true; // // button2 // this.button2.Location = new System.Drawing.Point(296, 96); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(168, 23); this.button2.TabIndex = 2; this.button2.Text = "Test &Computer Browser"; this.button2.Click += new System.EventHandler(this.button2_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(480, 353); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.pictureBox1); this.Menu = this.mainMenu1; this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { //use ImageStore this.pictureBox1.Image = this.imageStore1.Image; this.notifyIconEx1.ShowBalloon("Testing NotifyIconEx", "This is a balloon tip. This is impossible to do with the standard NotifyIcon.", NETXP.Components.NotifyInfoFlags.Info, 3000); } private void pictureBox1_Click(object sender, System.EventArgs e) { this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; } private void button1_Click(object sender, System.EventArgs e) { NETXP.Components.TaskbarNotifier tn; tn = new NETXP.Components.TaskbarNotifier(); tn.NormalTitleColor = SystemColors.HotTrack; tn.NormalTitleFont = new Font(tn.NormalTitleFont, FontStyle.Bold); tn.NormalContentColor = SystemColors.WindowText; tn.HoverContentColor = SystemColors.HotTrack; tn.HoverTitleColor = SystemColors.ActiveCaption; tn.HoverTitleFont = tn.NormalTitleFont; tn.SetBackgroundBitmap(notifyBg.Image,Color.FromArgb(255,0,255)); tn.SetCloseBitmap(notifyClose.Image,Color.FromArgb(255,0,255),new Point(127,8)); tn.TitleRectangle=new Rectangle(60,12,100,30); tn.ContentRectangle=new Rectangle(8,43,133,64); tn.Show("Notification", "The XMark service has started.", 250, 1500, 250); } private void button2_Click(object sender, System.EventArgs e) { NETXP.Components.CompBrowser brf = new NETXP.Components.CompBrowser(); brf.ShowDialog(this); MessageBox.Show(brf.SelectedComputer); } } }