home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Shareware / Programare / netxp / netxp.exe / Samples / CS / TaskPane / Form1.cs < prev    next >
Encoding:
Text File  |  2004-04-03  |  10.0 KB  |  285 lines

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7.  
  8. namespace TaskPane
  9. {
  10.     /// <summary>
  11.     /// Summary description for Form1.
  12.     /// </summary>
  13.     public class Form1 : System.Windows.Forms.Form
  14.     {
  15.         private NETXP.Controls.TaskPane.XPTaskPane xpTaskPane1;
  16.         private NETXP.Controls.TaskPane.XPTaskPaneGroup xpTaskPaneGroup1;
  17.         private NETXP.Controls.TaskPane.XPTaskPaneGroup xpTaskPaneGroup2;
  18.         private NETXP.Controls.TaskPane.XPLink xpLink1;
  19.         private NETXP.Controls.TaskPane.XPLink xpLink2;
  20.         private NETXP.Controls.TaskPane.XPLink xpLink3;
  21.         private NETXP.Controls.TaskPane.XPLink xpLink4;
  22.         private System.Windows.Forms.Panel panel1;
  23.         private System.Windows.Forms.Splitter splitter1;
  24.         private System.Windows.Forms.RadioButton radioButton1;
  25.         private System.Windows.Forms.RadioButton radioButton2;
  26.         /// <summary>
  27.         /// Required designer variable.
  28.         /// </summary>
  29.         private System.ComponentModel.Container components = null;
  30.  
  31.         public Form1()
  32.         {
  33.             //
  34.             // Required for Windows Form Designer support
  35.             //
  36.             InitializeComponent();
  37.  
  38.             //
  39.             // TODO: Add any constructor code after InitializeComponent call
  40.             //
  41.         }
  42.  
  43.         /// <summary>
  44.         /// Clean up any resources being used.
  45.         /// </summary>
  46.         protected override void Dispose( bool disposing )
  47.         {
  48.             if( disposing )
  49.             {
  50.                 if (components != null) 
  51.                 {
  52.                     components.Dispose();
  53.                 }
  54.             }
  55.             base.Dispose( disposing );
  56.         }
  57.  
  58.         #region Windows Form Designer generated code
  59.         /// <summary>
  60.         /// Required method for Designer support - do not modify
  61.         /// the contents of this method with the code editor.
  62.         /// </summary>
  63.         private void InitializeComponent()
  64.         {
  65.             System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
  66.             this.xpTaskPane1 = new NETXP.Controls.TaskPane.XPTaskPane();
  67.             this.xpTaskPaneGroup2 = new NETXP.Controls.TaskPane.XPTaskPaneGroup();
  68.             this.xpLink2 = new NETXP.Controls.TaskPane.XPLink();
  69.             this.xpLink1 = new NETXP.Controls.TaskPane.XPLink();
  70.             this.xpTaskPaneGroup1 = new NETXP.Controls.TaskPane.XPTaskPaneGroup();
  71.             this.xpLink4 = new NETXP.Controls.TaskPane.XPLink();
  72.             this.xpLink3 = new NETXP.Controls.TaskPane.XPLink();
  73.             this.panel1 = new System.Windows.Forms.Panel();
  74.             this.radioButton2 = new System.Windows.Forms.RadioButton();
  75.             this.radioButton1 = new System.Windows.Forms.RadioButton();
  76.             this.splitter1 = new System.Windows.Forms.Splitter();
  77.             this.xpTaskPane1.SuspendLayout();
  78.             this.xpTaskPaneGroup2.SuspendLayout();
  79.             this.xpTaskPaneGroup1.SuspendLayout();
  80.             this.panel1.SuspendLayout();
  81.             this.SuspendLayout();
  82.             // 
  83.             // xpTaskPane1
  84.             // 
  85.             this.xpTaskPane1.AutoScroll = true;
  86.             this.xpTaskPane1.Controls.Add(this.xpTaskPaneGroup2);
  87.             this.xpTaskPane1.Controls.Add(this.xpTaskPaneGroup1);
  88.             this.xpTaskPane1.Dock = System.Windows.Forms.DockStyle.Left;
  89.             this.xpTaskPane1.Location = new System.Drawing.Point(0, 0);
  90.             this.xpTaskPane1.Name = "xpTaskPane1";
  91.             this.xpTaskPane1.Size = new System.Drawing.Size(200, 414);
  92.             this.xpTaskPane1.TabIndex = 0;
  93.             this.xpTaskPane1.Text = "xpTaskPane1";
  94.             // 
  95.             // xpTaskPaneGroup2
  96.             // 
  97.             this.xpTaskPaneGroup2.Controls.Add(this.xpLink2);
  98.             this.xpTaskPaneGroup2.Controls.Add(this.xpLink1);
  99.             this.xpTaskPaneGroup2.Image = ((System.Drawing.Image)(resources.GetObject("xpTaskPaneGroup2.Image")));
  100.             this.xpTaskPaneGroup2.Location = new System.Drawing.Point(16, 128);
  101.             this.xpTaskPaneGroup2.Name = "xpTaskPaneGroup2";
  102.             this.xpTaskPaneGroup2.Size = new System.Drawing.Size(168, 80);
  103.             this.xpTaskPaneGroup2.TabIndex = 1;
  104.             this.xpTaskPaneGroup2.Text = "Normal Tasks";
  105.             // 
  106.             // xpLink2
  107.             // 
  108.             this.xpLink2.BackColor = System.Drawing.Color.Transparent;
  109.             this.xpLink2.Cursor = System.Windows.Forms.Cursors.Hand;
  110.             this.xpLink2.Image = ((System.Drawing.Image)(resources.GetObject("xpLink2.Image")));
  111.             this.xpLink2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  112.             this.xpLink2.Location = new System.Drawing.Point(8, 56);
  113.             this.xpLink2.Name = "xpLink2";
  114.             this.xpLink2.Size = new System.Drawing.Size(136, 16);
  115.             this.xpLink2.TabIndex = 1;
  116.             this.xpLink2.Text = "Connect to Network";
  117.             this.xpLink2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  118.             // 
  119.             // xpLink1
  120.             // 
  121.             this.xpLink1.BackColor = System.Drawing.Color.Transparent;
  122.             this.xpLink1.Cursor = System.Windows.Forms.Cursors.Hand;
  123.             this.xpLink1.Image = ((System.Drawing.Image)(resources.GetObject("xpLink1.Image")));
  124.             this.xpLink1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  125.             this.xpLink1.Location = new System.Drawing.Point(8, 32);
  126.             this.xpLink1.Name = "xpLink1";
  127.             this.xpLink1.Size = new System.Drawing.Size(136, 16);
  128.             this.xpLink1.TabIndex = 0;
  129.             this.xpLink1.Text = "Clean Hard Disk";
  130.             this.xpLink1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  131.             // 
  132.             // xpTaskPaneGroup1
  133.             // 
  134.             this.xpTaskPaneGroup1.Controls.Add(this.xpLink4);
  135.             this.xpTaskPaneGroup1.Controls.Add(this.xpLink3);
  136.             this.xpTaskPaneGroup1.Image = ((System.Drawing.Image)(resources.GetObject("xpTaskPaneGroup1.Image")));
  137.             this.xpTaskPaneGroup1.Location = new System.Drawing.Point(16, 16);
  138.             this.xpTaskPaneGroup1.Name = "xpTaskPaneGroup1";
  139.             this.xpTaskPaneGroup1.Size = new System.Drawing.Size(168, 88);
  140.             this.xpTaskPaneGroup1.SpecialTasks = true;
  141.             this.xpTaskPaneGroup1.TabIndex = 0;
  142.             this.xpTaskPaneGroup1.Text = "Special Tasks";
  143.             // 
  144.             // xpLink4
  145.             // 
  146.             this.xpLink4.BackColor = System.Drawing.Color.Transparent;
  147.             this.xpLink4.Cursor = System.Windows.Forms.Cursors.Hand;
  148.             this.xpLink4.Image = ((System.Drawing.Image)(resources.GetObject("xpLink4.Image")));
  149.             this.xpLink4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  150.             this.xpLink4.Location = new System.Drawing.Point(8, 64);
  151.             this.xpLink4.Name = "xpLink4";
  152.             this.xpLink4.Size = new System.Drawing.Size(144, 16);
  153.             this.xpLink4.TabIndex = 1;
  154.             this.xpLink4.Text = "Disk Backup";
  155.             this.xpLink4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  156.             // 
  157.             // xpLink3
  158.             // 
  159.             this.xpLink3.BackColor = System.Drawing.Color.Transparent;
  160.             this.xpLink3.Cursor = System.Windows.Forms.Cursors.Hand;
  161.             this.xpLink3.Image = ((System.Drawing.Image)(resources.GetObject("xpLink3.Image")));
  162.             this.xpLink3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  163.             this.xpLink3.Location = new System.Drawing.Point(8, 40);
  164.             this.xpLink3.Name = "xpLink3";
  165.             this.xpLink3.Size = new System.Drawing.Size(144, 16);
  166.             this.xpLink3.TabIndex = 0;
  167.             this.xpLink3.Text = "Open Shortcut";
  168.             this.xpLink3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  169.             // 
  170.             // panel1
  171.             // 
  172.             this.panel1.BackColor = System.Drawing.SystemColors.Window;
  173.             this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  174.             this.panel1.Controls.Add(this.radioButton2);
  175.             this.panel1.Controls.Add(this.radioButton1);
  176.             this.panel1.Controls.Add(this.splitter1);
  177.             this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
  178.             this.panel1.Location = new System.Drawing.Point(200, 0);
  179.             this.panel1.Name = "panel1";
  180.             this.panel1.Size = new System.Drawing.Size(360, 414);
  181.             this.panel1.TabIndex = 1;
  182.             // 
  183.             // radioButton2
  184.             // 
  185.             this.radioButton2.Location = new System.Drawing.Point(64, 72);
  186.             this.radioButton2.Name = "radioButton2";
  187.             this.radioButton2.Size = new System.Drawing.Size(168, 24);
  188.             this.radioButton2.TabIndex = 2;
  189.             this.radioButton2.Text = "Custom Colors";
  190.             this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
  191.             // 
  192.             // radioButton1
  193.             // 
  194.             this.radioButton1.Checked = true;
  195.             this.radioButton1.Location = new System.Drawing.Point(64, 48);
  196.             this.radioButton1.Name = "radioButton1";
  197.             this.radioButton1.Size = new System.Drawing.Size(168, 24);
  198.             this.radioButton1.TabIndex = 1;
  199.             this.radioButton1.TabStop = true;
  200.             this.radioButton1.Text = "Windows Default Colors";
  201.             this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
  202.             // 
  203.             // splitter1
  204.             // 
  205.             this.splitter1.Location = new System.Drawing.Point(0, 0);
  206.             this.splitter1.Name = "splitter1";
  207.             this.splitter1.Size = new System.Drawing.Size(3, 410);
  208.             this.splitter1.TabIndex = 0;
  209.             this.splitter1.TabStop = false;
  210.             // 
  211.             // Form1
  212.             // 
  213.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  214.             this.ClientSize = new System.Drawing.Size(560, 414);
  215.             this.Controls.Add(this.panel1);
  216.             this.Controls.Add(this.xpTaskPane1);
  217.             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  218.             this.Name = "Form1";
  219.             this.Text = "Test Form";
  220.             this.Load += new System.EventHandler(this.Form1_Load);
  221.             this.xpTaskPane1.ResumeLayout(false);
  222.             this.xpTaskPaneGroup2.ResumeLayout(false);
  223.             this.xpTaskPaneGroup1.ResumeLayout(false);
  224.             this.panel1.ResumeLayout(false);
  225.             this.ResumeLayout(false);
  226.  
  227.         }
  228.         #endregion
  229.  
  230.         /// <summary>
  231.         /// The main entry point for the application.
  232.         /// </summary>
  233.         [STAThread]
  234.         static void Main() 
  235.         {
  236.             Application.Run(new Form1());
  237.         }
  238.  
  239.         private void Form1_Load(object sender, System.EventArgs e)
  240.         {
  241.         }
  242.  
  243.         private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
  244.         {
  245.             if(radioButton1.Checked)
  246.             {
  247.                 this.xpTaskPane1.ColorTable = NETXP.Library.ColorTables.Dynamic;
  248.             }
  249.         }
  250.  
  251.         private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
  252.         {
  253.             if(radioButton2.Checked)
  254.             {
  255.                 this.xpTaskPane1.ColorTable = new CustomColors();
  256.             }
  257.         }
  258.     }
  259.     internal class CustomColors : NETXP.Library.IColorTable
  260.     {
  261.         #region IColorTable Members
  262.  
  263.         private NETXP.Library.ColorCollection colors;
  264.  
  265.         public CustomColors()
  266.         {
  267.             colors = new NETXP.Library.ColorCollection();
  268.             foreach(Color clr in NETXP.Library.ColorTables.XPOlive.Colors)
  269.             {
  270.                 colors.Add(Color.FromArgb(clr.G, clr.B, clr.B));
  271.             }
  272.         }
  273.  
  274.         public NETXP.Library.ColorCollection Colors
  275.         {
  276.             get
  277.             {
  278.                 return colors;
  279.             }
  280.         }
  281.  
  282.         #endregion
  283.     }
  284. }
  285.