Zorh Opteron Power ! | Bonjour !
J'ai un petit Code don je n'arrive pas résoudre le problème.
Celui-ci m'affiche une erreur à la compil !
>> the name 'xxx' does not exist in the class or namespace SystemTray
xxx étant TitleClick / ContentClick et CloseClick.
Lignes 56,57,58 // 74,75,76 // 84,85,86.
si vous avez besoin d'autre information dite le moi !
merci d'avance
PS: le Code est pas encore fini, donc ne cherche pas à quoi il dois aboutir ^^
Code :
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data;
- using CustomUIControls;
- using System.IO;
- namespace SystemTray
- {
- /// <summary>
- /// Description résumée de Form1.
- /// </summary>
- public class Form1 : System.Windows.Forms.Form
- {
- private System.Windows.Forms.ContextMenu contextMenu;
- private System.Windows.Forms.MenuItem menuItem_Hide;
- private System.Windows.Forms.MenuItem menuItem_Show;
- private System.Windows.Forms.MenuItem menuItem_About;
- private System.Windows.Forms.MenuItem menuItem_Exit;
- private System.Windows.Forms.MenuItem menuItem_Separator;
- private System.Windows.Forms.NotifyIcon notifyIcon;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Label label1;
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.TextBox textBoxTitle;
- private System.Windows.Forms.TextBox textBoxContent;
- private System.Windows.Forms.TextBox textBoxDelayShowing;
- private System.Windows.Forms.TextBox textBoxDelayStaying;
- private System.Windows.Forms.TextBox textBoxDelayHiding;
- private System.Windows.Forms.CheckBox checkBoxTitleClickable;
- private System.Windows.Forms.CheckBox checkBoxContentClickable;
- private System.Windows.Forms.CheckBox checkBoxCloseClickable;
- private System.Windows.Forms.CheckBox checkBoxReShowOnMouseOver; // Added Rev 002
- private System.Windows.Forms.CheckBox checkBoxKeepVisibleOnMouseOver;
- private System.Windows.Forms.CheckBox checkBoxSelectionRectangle; // Added Rev 002
- TaskbarNotifier taskbarNotifier1;
- TaskbarNotifier taskbarNotifier2;
- TaskbarNotifier taskbarNotifier3;
- public Form1()
- {
- //
- // Requis pour la prise en charge du Concepteur Windows Forms
- //
- InitializeComponent();
- textBoxContent.Text="This is a sample content, it can spread on multiple lines";
- textBoxTitle.Text="Title";
- textBoxDelayShowing.Text="500";
- textBoxDelayStaying.Text="3000";
- textBoxDelayHiding.Text="500";
- checkBoxSelectionRectangle.Checked=true;
- checkBoxTitleClickable.Checked=false;
- checkBoxContentClickable.Checked=true;
- checkBoxCloseClickable.Checked=true;
- checkBoxKeepVisibleOnMouseOver.Checked = true; // Added Rev 002
- checkBoxReShowOnMouseOver.Checked = false; // Added Rev 002
- taskbarNotifier1=new TaskbarNotifier();
- taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(),"skin.bmp" ),Color.FromArgb(255,0,255));
- taskbarNotifier1.SetCloseBitmap(new Bitmap(GetType(),"close.bmp" ),Color.FromArgb(255,0,255),new Point(127,8));
- taskbarNotifier1.TitleRectangle=new Rectangle(40,9,70,25);
- taskbarNotifier1.ContentRectangle=new Rectangle(8,41,133,68);
- taskbarNotifier1.TitleClick+=new EventHandler(TitleClick);
- taskbarNotifier1.ContentClick+=new EventHandler(ContentClick);
- taskbarNotifier1.CloseClick+=new EventHandler(CloseClick);
- taskbarNotifier2=new TaskbarNotifier();
- taskbarNotifier2.SetBackgroundBitmap(new Bitmap(GetType(),"skin2.bmp" ),Color.FromArgb(255,0,255));
- taskbarNotifier2.SetCloseBitmap(new Bitmap(GetType(),"close2.bmp" ),Color.FromArgb(255,0,255),new Point(300,74));
- taskbarNotifier2.TitleRectangle=new Rectangle(123,80,176,16);
- taskbarNotifier2.ContentRectangle=new Rectangle(116,97,197,22);
- taskbarNotifier2.TitleClick +=new EventHandler(TitleClick);
- taskbarNotifier2.ContentClick +=new EventHandler(ContentClick);
- taskbarNotifier2.CloseClick +=new EventHandler(CloseClick);
- // Added Rev 002
- taskbarNotifier3=new TaskbarNotifier();
- taskbarNotifier3.SetBackgroundBitmap(new Bitmap(GetType(),"skin3.bmp" ),Color.FromArgb(255,0,255));
- taskbarNotifier3.SetCloseBitmap(new Bitmap(GetType(),"close.bmp" ),Color.FromArgb(255,0,255),new Point(280,57));
- taskbarNotifier3.TitleRectangle=new Rectangle(150, 57, 125, 28);
- taskbarNotifier3.ContentRectangle=new Rectangle(75, 92, 215, 55);
- taskbarNotifier3.TitleClick+=new EventHandler(TitleClick);
- taskbarNotifier3.ContentClick+=new EventHandler(ContentClick);
- taskbarNotifier3.CloseClick+=new EventHandler(CloseClick); //
- // TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
- //
- }
- /// <summary>
- /// Nettoyage des ressources utilisées.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if (components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Code généré par le Concepteur Windows Form
- /// <summary>
- /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
- /// le contenu de cette méthode avec l'éditeur de code.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
- this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
- this.contextMenu = new System.Windows.Forms.ContextMenu();
- this.menuItem_Hide = new System.Windows.Forms.MenuItem();
- this.menuItem_Show = new System.Windows.Forms.MenuItem();
- this.menuItem_About = new System.Windows.Forms.MenuItem();
- this.menuItem_Exit = new System.Windows.Forms.MenuItem();
- this.menuItem_Separator = new System.Windows.Forms.MenuItem();
- this.button1 = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.checkBoxSelectionRectangle = new System.Windows.Forms.CheckBox();
- this.textBoxTitle = new System.Windows.Forms.TextBox();
- this.textBoxContent = new System.Windows.Forms.TextBox();
- this.textBoxDelayShowing = new System.Windows.Forms.TextBox();
- this.textBoxDelayStaying = new System.Windows.Forms.TextBox();
- this.textBoxDelayHiding = new System.Windows.Forms.TextBox();
- this.checkBoxReShowOnMouseOver = new System.Windows.Forms.CheckBox();
- this.checkBoxKeepVisibleOnMouseOver = new System.Windows.Forms.CheckBox();
- this.checkBoxCloseClickable = new System.Windows.Forms.CheckBox();
- this.checkBoxContentClickable = new System.Windows.Forms.CheckBox();
- this.checkBoxTitleClickable = new System.Windows.Forms.CheckBox();
- this.SuspendLayout();
- //
- // notifyIcon
- //
- this.notifyIcon.ContextMenu = this.contextMenu;
- this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon" )));
- this.notifyIcon.Text = "Exemple SystemTray";
- this.notifyIcon.Visible = true;
- this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick);
- //
- // contextMenu
- //
- this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
- this.menuItem_Hide,
- this.menuItem_Show,
- this.menuItem_About,
- this.menuItem_Exit,
- this.menuItem_Separator});
- //
- // menuItem_Hide
- //
- this.menuItem_Hide.DefaultItem = true;
- this.menuItem_Hide.Index = 0;
- this.menuItem_Hide.Text = "Hide";
- this.menuItem_Hide.Click += new System.EventHandler(this.menuItem_Hide_Click);
- //
- // menuItem_Show
- //
- this.menuItem_Show.Index = 1;
- this.menuItem_Show.Text = "Show";
- this.menuItem_Show.Click += new System.EventHandler(this.menuItem_Show_Click);
- //
- // menuItem_About
- //
- this.menuItem_About.Index = 2;
- this.menuItem_About.Text = "About";
- this.menuItem_About.Click += new System.EventHandler(this.menuItem_About_Click);
- //
- // menuItem_Exit
- //
- this.menuItem_Exit.Index = 3;
- this.menuItem_Exit.Text = "Exit";
- this.menuItem_Exit.Click += new System.EventHandler(this.menuItem_Exit_Click);
- //
- // menuItem_Separator
- //
- this.menuItem_Separator.Index = 4;
- this.menuItem_Separator.Text = "-";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(200, 96);
- this.button1.Name = "button1";
- this.button1.TabIndex = 0;
- this.button1.Text = "button1";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(176, 168);
- this.label1.Name = "label1";
- this.label1.TabIndex = 1;
- this.label1.Text = "label1";
- //
- // checkBoxSelectionRectangle
- //
- this.checkBoxSelectionRectangle.Location = new System.Drawing.Point(128, 48);
- this.checkBoxSelectionRectangle.Name = "checkBoxSelectionRectangle";
- this.checkBoxSelectionRectangle.Size = new System.Drawing.Size(160, 16);
- this.checkBoxSelectionRectangle.TabIndex = 2;
- this.checkBoxSelectionRectangle.Text = "Show Selection Rectangle";
- //
- // textBoxTitle
- //
- this.textBoxTitle.Location = new System.Drawing.Point(64, 32);
- this.textBoxTitle.Name = "textBoxTitle";
- this.textBoxTitle.Size = new System.Drawing.Size(224, 20);
- this.textBoxTitle.TabIndex = 3;
- this.textBoxTitle.Text = "textBoxTitle";
- //
- // textBoxContent
- //
- this.textBoxContent.Location = new System.Drawing.Point(64, 64);
- this.textBoxContent.Name = "textBoxContent";
- this.textBoxContent.Size = new System.Drawing.Size(224, 20);
- this.textBoxContent.TabIndex = 4;
- this.textBoxContent.Text = "textBoxContent";
- //
- // textBoxDelayShowing
- //
- this.textBoxDelayShowing.Location = new System.Drawing.Point(32, 152);
- this.textBoxDelayShowing.Name = "textBoxDelayShowing";
- this.textBoxDelayShowing.Size = new System.Drawing.Size(56, 20);
- this.textBoxDelayShowing.TabIndex = 10;
- this.textBoxDelayShowing.Text = "textBoxDelayShowing";
- //
- // textBoxDelayStaying
- //
- this.textBoxDelayStaying.Location = new System.Drawing.Point(128, 152);
- this.textBoxDelayStaying.Name = "textBoxDelayStaying";
- this.textBoxDelayStaying.Size = new System.Drawing.Size(56, 20);
- this.textBoxDelayStaying.TabIndex = 9;
- this.textBoxDelayStaying.Text = "textBoxDelayStaying";
- //
- // textBoxDelayHiding
- //
- this.textBoxDelayHiding.Location = new System.Drawing.Point(216, 152);
- this.textBoxDelayHiding.Name = "textBoxDelayHiding";
- this.textBoxDelayHiding.Size = new System.Drawing.Size(56, 20);
- this.textBoxDelayHiding.TabIndex = 8;
- this.textBoxDelayHiding.Text = "textBoxDelayHiding";
- //
- // checkBoxKeepVisibleOnMouseOver
- //
- this.checkBoxKeepVisibleOnMouseOver.Location = new System.Drawing.Point(16, 72);
- this.checkBoxKeepVisibleOnMouseOver.Name = "checkBoxKeepVisibleOnMouseOver";
- this.checkBoxKeepVisibleOnMouseOver.Size = new System.Drawing.Size(268, 16);
- this.checkBoxKeepVisibleOnMouseOver.TabIndex = 6;
- this.checkBoxKeepVisibleOnMouseOver.Text = "Keep Visible when Mouse over window";
- //
- // checkBoxCloseClickable
- //
- this.checkBoxCloseClickable.Location = new System.Drawing.Point(16, 48);
- this.checkBoxCloseClickable.Name = "checkBoxCloseClickable";
- this.checkBoxCloseClickable.Size = new System.Drawing.Size(104, 16);
- this.checkBoxCloseClickable.TabIndex = 3;
- this.checkBoxCloseClickable.Text = "Close Clickable";
- //
- // checkBoxContentClickable
- //
- this.checkBoxContentClickable.Location = new System.Drawing.Point(128, 24);
- this.checkBoxContentClickable.Name = "checkBoxContentClickable";
- this.checkBoxContentClickable.Size = new System.Drawing.Size(112, 16);
- this.checkBoxContentClickable.TabIndex = 1;
- this.checkBoxContentClickable.Text = "Content Clickable";
- //
- // checkBoxTitleClickable
- //
- this.checkBoxTitleClickable.Location = new System.Drawing.Point(16, 24);
- this.checkBoxTitleClickable.Name = "checkBoxTitleClickable";
- this.checkBoxTitleClickable.Size = new System.Drawing.Size(96, 16);
- this.checkBoxTitleClickable.TabIndex = 0;
- this.checkBoxTitleClickable.Text = "Title Clickable";
- //
- // Form1
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(292, 273);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.textBoxDelayShowing);
- this.Controls.Add(this.textBoxDelayStaying);
- this.Controls.Add(this.textBoxDelayHiding);
- this.Controls.Add(this.textBoxContent);
- this.Controls.Add(this.textBoxTitle);
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon" )));
- this.Name = "Form1";
- this.ShowInTaskbar = false;
- this.Text = "Form1";
- this.Resize += new System.EventHandler(this.Form1_Resize);
- this.ResumeLayout(false);
- }
- #endregion
- /// <summary>
- /// Point d'entrée principal de l'application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.Run(new Form1());
- }
- private void menuItem_Hide_Click(object sender, System.EventArgs e)
- {
- this.ShowInTaskbar = false;
- this.Hide();
- }
- private void notifyIcon_DoubleClick(object sender, System.EventArgs e)
- {
- this.ShowInTaskbar = true;
- this.Show();
- }
- private void menuItem_Show_Click(object sender, System.EventArgs e)
- {
- this.ShowInTaskbar = true;
- this.Show();
- }
- private void menuItem_About_Click(object sender, System.EventArgs e)
- {
- MessageBox.Show("XXX France Copyright" );
- }
- private void menuItem_Exit_Click(object sender, System.EventArgs e)
- {
- notifyIcon.Visible = false;
- Application.Exit();
- }
- private void Form1_Resize(object sender, System.EventArgs e)
- {
- if ( this.WindowState == FormWindowState.Minimized)
- {
- // le masque de la barre des taches
- this.ShowInTaskbar = false;
- // cache le form
- this.Hide();
- }
- }
- private void Up()
- {
- // reaffiche dans la barre des taches
- this.ShowInTaskbar = true;
- // reaffiche le form
- this.Show();
- // remet la taille normale
- this.WindowState = FormWindowState.Normal;
- }
- public static long DirSize(DirectoryInfo d)
- {
- long Size = 0;
- //ajout taille fichiers
- FileInfo[] fis = d.GetFiles();
- foreach(FileInfo fi in fis)
- {
- Size += fi.Length ;
- }
- //ajout taille sous dossier
- DirectoryInfo[] dis = d.GetDirectories();
- foreach(DirectoryInfo di in dis)
- {
- Size +=DirSize(di);
- }
- return(Size);
- }
- private void Errs()
- {
- DirectoryInfo d = new DirectoryInfo(@"%username%" );
- foreach(DirectoryInfo xp in d.GetDirectories())
- {
- if(DirSize(xp) > 90000000)
- {
- notifyIcon.Icon = new Icon("globe2-floppy-orange.ico" );
- taskbarNotifier1.CloseClickable=checkBoxCloseClickable.Checked;
- taskbarNotifier1.TitleClickable=checkBoxTitleClickable.Checked;
- taskbarNotifier1.ContentClickable=checkBoxContentClickable.Checked;
- taskbarNotifier1.EnableSelectionRectangle=checkBoxSelectionRectangle.Checked;
- taskbarNotifier1.KeepVisibleOnMousOver=checkBoxKeepVisibleOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.ReShowOnMouseOver=checkBoxReShowOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.Show(textBoxTitle.Text,textBoxContent.Text,Int32.Parse(textBoxDelayShowing.Text),Int32.Parse(textBoxDelayStaying.Text),Int32.Parse(textBoxDelayHiding.Text));
- }
- if(DirSize(xp) > 100000000)
- {
- notifyIcon.Icon = new Icon("globe2-floppy-red.ico" );
- taskbarNotifier1.CloseClickable=checkBoxCloseClickable.Checked;
- taskbarNotifier1.TitleClickable=checkBoxTitleClickable.Checked;
- taskbarNotifier1.ContentClickable=checkBoxContentClickable.Checked;
- taskbarNotifier1.EnableSelectionRectangle=checkBoxSelectionRectangle.Checked;
- taskbarNotifier1.KeepVisibleOnMousOver=checkBoxKeepVisibleOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.ReShowOnMouseOver=checkBoxReShowOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.Show(textBoxTitle.Text,textBoxContent.Text,Int32.Parse(textBoxDelayShowing.Text),Int32.Parse(textBoxDelayStaying.Text),Int32.Parse(textBoxDelayHiding.Text));
- }
- if(DirSize(xp) < 90000000)
- {
- notifyIcon.Icon = new Icon("globe2-floppy-green.ico" );
- taskbarNotifier1.CloseClickable=checkBoxCloseClickable.Checked;
- taskbarNotifier1.TitleClickable=checkBoxTitleClickable.Checked;
- taskbarNotifier1.ContentClickable=checkBoxContentClickable.Checked;
- taskbarNotifier1.EnableSelectionRectangle=checkBoxSelectionRectangle.Checked;
- taskbarNotifier1.KeepVisibleOnMousOver=checkBoxKeepVisibleOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.ReShowOnMouseOver=checkBoxReShowOnMouseOver.Checked; // Added Rev 002
- taskbarNotifier1.Show(textBoxTitle.Text,textBoxContent.Text,Int32.Parse(textBoxDelayShowing.Text),Int32.Parse(textBoxDelayStaying.Text),Int32.Parse(textBoxDelayHiding.Text));
- }
- }
- }
- }
- }
|
Message édité par Zorh le 11-01-2006 à 15:52:23 ---------------
---
|