|
Even i have used the TaskBarnotifier class from the same link
then i created a form and a button on that form
on the click of the button the taskbarnotifier is displayed
the code for the form that i created is below here
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using CustomUIControls;
namespace WindowsApplication7
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
TaskbarNotifier taskbarnotifier;
int x,y;
bool bMouseDown = false;
private System.Windows.Forms.Button button1;
ArrayList arlist = new ArrayList();
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
taskbarnotifier = new TaskbarNotifier();
taskbarnotifier.MouseHover += new EventHandler(taskbarnotifier_MouseHover);
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 96);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
bMouseDown = true;
x = e.X;
y = e.Y;
arlist.Add(new Point(x,y));
}
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(bMouseDown)
{
Graphics gr=this.CreateGraphics();
if (x == -1 && y == -1)
{
x=e.X;
y=e.Y;
}
gr.DrawLine(new Pen(Color.Blue),e.X,e.Y,x,y);
x=e.X;
y=e.Y;
arlist.Add(new Point(x,y));
}
}
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
bMouseDown = false;
}
private void button1_Click(object sender, System.EventArgs e)
{
taskbarnotifier.BackgroundImage = Image.FromFile(@"C:\WINNT\Coffee Bean.bmp");
taskbarnotifier.SetBackgroundBitmap(@"C:\WINNT\Coffee Bean.bmp",Color.White);
taskbarnotifier.Text = "Coffee Bean";
taskbarnotifier.Show("POP-UP", "",1500,1500,1500);
}
private void taskbarnotifier_MouseHover(object sender, EventArgs e)
{
taskbarnotifier.Show("POP-UP", "",1500,1500,1500);
}
}
}
Regards,
Pramod
|
|
|
|
|
you are also passing images to taskbarnotifier but my case is different i want to pass an Form object i want my form to show as a popup rather than an image
Amit Grover
CDAC R&D
|
|
|
|
|
The taskBarNotifier itself is a windows form
how can u pass a form on a form?
can u tell me the ur objective in details
so that i can help u more.
Regards,
Pramod
|
|
|
|
|
i had little bit confusion now it is clear. actullay i have form with listbox on it.listbox is of form size.i would like that form to be popup.but now what happen form is working as a popup but that listbox is not coming on it.
Amit Grover
CDAC R&D
|
|
|
|
|
just check the visible property of the listbox
can u please send me ur code so that i will check wht's going wrong?
Regards,
Pramod
|
|
|
|
|
my code works like this
in one form i have two button one is hide and another is show . show button popup the form and hide button popup down the form.following is code for form
private void button1_Click(object sender, System.EventArgs e)
{
taskbarNotifier1.nShow();
}
private void button2_Click(object sender, System.EventArgs e)
{
taskbarNotifier1.WHide();
}
// now the taskbarNoitfier code is which has one button on it. which is not showing when the form popup's
<br />
#region TaskbarNotifier Protected Members<br />
<br />
protected Rectangle WorkAreaRectangle;<br />
protected Timer timer = new Timer();<br />
protected TaskbarStates taskbarState = TaskbarStates.hidden;<br />
protected int nShowEvents;<br />
protected int nHideEvents;<br />
protected int nVisibleEvents;<br />
protected int nIncrementShow;<br />
protected int nIncrementHide;<br />
protected bool bIsMouseOverPopup = false;<br />
protected bool bIsMouseOverClose = false;<br />
protected bool bIsMouseOverContent = false;<br />
protected bool bIsMouseOverTitle = false;<br />
protected bool bIsMouseDown = false;<br />
protected bool bKeepVisibleOnMouseOver = true;
protected bool bReShowOnMouseOver = false;<br />
private System.Windows.Forms.Button button1;
<br />
private int flag=0;<br />
#endregion<br />
<br />
#region TaskbarNotifier Enums<br />
public enum TaskbarStates<br />
{<br />
hidden = 0,<br />
appearing = 1,<br />
visible = 2,<br />
disappearing = 3<br />
}<br />
#endregion<br />
<br />
#region TaskbarNotifier Constructor<br />
public TaskbarNotifier()<br />
{<br />
<br />
WindowState = FormWindowState.Maximized;<br />
ShowInTaskbar = false;<br />
<br />
timer.Enabled = true;<br />
timer.Tick += new EventHandler(OnTimer);<br />
}<br />
#endregion<br />
<br />
#region TaskbarNotifier Properties<br />
public TaskbarStates TaskbarState<br />
{<br />
get<br />
{<br />
return taskbarState;<br />
}<br />
}<br />
<br />
public bool KeepVisibleOnMousOver<br />
{<br />
get<br />
{<br />
return bKeepVisibleOnMouseOver;<br />
}<br />
set<br />
{<br />
bKeepVisibleOnMouseOver=value;<br />
}<br />
}<br />
<br />
public bool ReShowOnMouseOver<br />
{<br />
get<br />
{<br />
return bReShowOnMouseOver;<br />
}<br />
set<br />
{<br />
bReShowOnMouseOver=value;<br />
}<br />
}<br />
<br />
#endregion<br />
<br />
#region TaskbarNotifier Public Methods<br />
[DllImport("user32.dll")]<br />
private static extern Boolean ShowWindow(IntPtr hWnd,Int32 nCmdShow);<br />
<br />
public void nShow()<br />
{<br />
flag=0;<br />
WorkAreaRectangle = Screen.GetWorkingArea(WorkAreaRectangle);<br />
int nTimeToShow=1300;<br />
int nTimeToHide=1300;<br />
nVisibleEvents= 1300;<br />
int nEvents;<br />
if (nTimeToShow > 10)<br />
{<br />
nEvents = Math.Min((nTimeToShow / 10), 224);<br />
nShowEvents = nTimeToShow / nEvents;<br />
nIncrementShow = 224 / nEvents;<br />
}<br />
else<br />
{<br />
nShowEvents = 10;<br />
nIncrementShow = 224;<br />
}<br />
<br />
if( nTimeToHide > 10)<br />
{<br />
nEvents = Math.Min((nTimeToHide / 10), 224);<br />
nHideEvents = nTimeToHide / nEvents;<br />
nIncrementHide = 224 / nEvents;<br />
}<br />
else<br />
{<br />
nHideEvents = 10;<br />
nIncrementHide = 224;<br />
}<br />
<br />
switch (taskbarState)<br />
{<br />
case TaskbarStates.hidden:<br />
taskbarState = TaskbarStates.appearing;<br />
SetBounds(WorkAreaRectangle.Right-248, WorkAreaRectangle.Bottom-1, 248, 0);<br />
timer.Interval = nShowEvents;<br />
timer.Start();<br />
ShowWindow(this.Handle, 4);<br />
break;<br />
<br />
case TaskbarStates.appearing:<br />
Refresh();<br />
break;<br />
<br />
case TaskbarStates.visible:<br />
timer.Stop();<br />
timer.Interval = nVisibleEvents;<br />
timer.Start();<br />
Refresh();<br />
break;<br />
<br />
case TaskbarStates.disappearing:<br />
timer.Stop();<br />
taskbarState = TaskbarStates.visible;<br />
SetBounds(WorkAreaRectangle.Right-248, WorkAreaRectangle.Bottom-224-1, 248, 224);<br />
timer.Interval = nVisibleEvents;<br />
timer.Start();<br />
Refresh();<br />
break;<br />
}<br />
}<br />
<br />
public new void Hide()<br />
{<br />
if (taskbarState != TaskbarStates.hidden)<br />
{<br />
timer.Stop();<br />
taskbarState = TaskbarStates.hidden;<br />
base.Hide();<br />
}<br />
}<br />
<br />
<br />
<br />
public void WHide()<br />
{<br />
flag=1;<br />
}<br />
<br />
#endregion<br />
<br />
#region TaskbarNotifier Events Overrides<br />
protected void OnTimer(Object obj, EventArgs ea)<br />
{<br />
switch (taskbarState)<br />
{<br />
case TaskbarStates.appearing:<br />
if (Height < 224)<br />
SetBounds(Left, Top-nIncrementShow ,Width, Height + nIncrementShow);<br />
else<br />
{<br />
timer.Stop();<br />
Height = 224;<br />
timer.Interval = nVisibleEvents;<br />
taskbarState = TaskbarStates.visible;<br />
timer.Start();<br />
}<br />
break;<br />
<br />
case TaskbarStates.visible:<br />
if(flag.Equals(1))<br />
{<br />
timer.Stop();<br />
timer.Interval = nHideEvents;<br />
taskbarState = TaskbarStates.disappearing;
timer.Start();<br />
}<br />
break;<br />
case TaskbarStates.disappearing:<br />
<br />
if(flag.Equals(1))<br />
{<br />
if (Top < WorkAreaRectangle.Bottom)<br />
SetBounds(Left, Top + nIncrementHide, Width, Height - nIncrementHide);<br />
else<br />
Hide();<br />
}<br />
break;<br />
}<br />
<br />
}<br />
<br />
#endregion<br />
<br />
private void InitializeComponent()<br />
{<br />
this.button1 = new System.Windows.Forms.Button();<br />
this.SuspendLayout();<br />
this.button1.Location = new System.Drawing.Point(112, 120);<br />
this.button1.Name = "button1";<br />
this.button1.TabIndex = 0;<br />
this.button1.Text = "button1";<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(292, 273);<br />
this.Controls.Add(this.button1);<br />
this.Name = "TaskbarNotifier";<br />
this.Load += new System.EventHandler(this.TaskbarNotifier_Load);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
<br />
private void TaskbarNotifier_Load(object sender, System.EventArgs e)<br />
{<br />
<br />
}<br />
Amit Grover
CDAC R&D
|
|
|
|
|
after eperimenting a lot what i get to know is that
u cannot put controls on the taskbarNotifier form
but y do u want to put list box on the popup form?
Regards,
Pramod
|
|
|
|
|
When I want my file to be hidden, I simply use this System.IO.File.SetAttributes(str filepath, FileAttributes.Hidden) .
But what about Directory, How can I set my directory to be hidden, I dont find any SetAttributes method for directory !
Any helps ???
|
|
|
|
|
DirectoryInfo d = new DirectoryInfo(@"path\to\your\directory");
d.Attributes |= FileAttributes.Hidden;
|
|
|
|
|
Great ... It works ! Thank you !
|
|
|
|
|
Hello,
Use DirectoryInfo class's Attributes property.
HTH, Cheers
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Hi all !
i want to get the value of monthcalendar and put its value into a label(Label1). how can i do it ?
Please help me !
REGARDS
|
|
|
|
|
Have you tried something like
Label1.text = MonthCalender.ToString();
|
|
|
|
|
yes , but it doesn't work . I want When i click a day in monthcalendar control ,its value show into the Lable1.
Lable1.Text=MonthCalender1....?
thanks
-- modified at 4:34 Tuesday 7th March, 2006
|
|
|
|
|
Handle the calendar's onchanged event and inside that update the label.
|
|
|
|
|
Hi all,
i am using Arraylist to store some values
i add the values using the list.Add() method
but when i try to access the values from the list
it gives me exception saying that
object Reference not set to an instance of an object
i try to retrieve the value in the following form
string ss = urls[x].ToString();
i have even tried
string ss = (string) urls[x];
Can anyone help me out of this?
Thanks,
Pramod
|
|
|
|
|
This error means one of two things. Either:
You have not initilized the ArrayList
or
You are trying to access an element of the list that does not exist (the index is less than 0 or greater than the number of elements in the list minus one)
|
|
|
|
|
sorry that's not the case
i have initialized the Arraylist
also this exceptions comes sometimes
Actually it is in a thread and the values are retrieved for
the first 2 threads but when some thread tries to access the exception occurs
i have even checked the index, it is within the bounds and the values exist
the values are displayed in the watch window
don't actually know wht's happening?
Thanks,
Pramod
|
|
|
|
|
Could you post some of the code so I can try and find where you are going wrong?
|
|
|
|
|
public void PostPageURLS()
{
string strPostURL="";
string strPostId = "";
bool BreakFlag = false;
//
j=Convert.ToInt32(Thread.CurrentThread.Name);
for(int k=0; k<urls[j].count; k++)
="" {="" {
="" monitor.enter(thread.currentthread);
="" try
="" if(thread.currentthread="" !="null)
" j="Convert.ToInt32(Thread.CurrentThread.Name);
" }
="" catch(exception="" exc)
="" messagebox.show(exc.message);
=""
="" if(k<="" urls[j].count="" &&="" bi="" <="" blogurls.count)
="" string="" keyword="urls[j][k].ToString();
" int="" chpos="keyword.LastIndexOf("=");
" posttext="SearchKeywordsYahoo(keyword.ToString());
" +="SearchKeywordsMSN(keyword.ToString());
" bloglib.movabletypeinterface="" mti="new" webbloggenerator.bloglib.movabletypeinterface(posturls[bi].tostring());
="" object[]="" obj1="{objDT.Rows[(int)" checkedobj[j]].itemarray[0],objdt.rows[(int)="" checkedobj[j]].itemarray[1],objdt.rows[(int)="" checkedobj[j]].itemarray[2],
="" objdt.rows[(int)="" checkedobj[j]].itemarray[3],objdt.rows[(int)="" checkedobj[j]].itemarray[4],k*100="" urls[j].count,
="" "blogging"};
="" checkedobj[j]].itemarray="obj1;
" objdt.acceptchanges();
="" sss="(string)" posturls[bi];="" <-="" occurs="" exception
="" if(sss.indexof("msn")="" post(blogusername[bi].tostring(),blogpassword[bi].tostring(),posttext,urls[j][k].tostring());
="" excc)
="" bi++;
="" }
="" strpostid="mti.NewPost("",BlogUsername[bi].ToString(),BlogPassword[bi].ToString(),"New" post="" "="" +"="" !!!","<a="" href="+urls[j][k].ToString()+">"+urls[j][k].ToString()+" "+PostText,DateTime.Now,false);
if(Convert.ToInt32(mti.PublishPost(strPostId,BlogUsername[bi].ToString(),BlogPassword[bi].ToString()))>0)
{
// MessageBox.Show("Post Successful !!! "+str+ " " + th.Name);
}
else
{
// MessageBox.Show("Unsuccessful ???");
}
if(strPostId!=null ||strPostId!="")
{
WebBlogGenerator.BLL.PageUrl objPageUrl = new WebBlogGenerator.BLL.PageUrl();
int intPageUrlId=objPageUrl.UpdatePageURL(Convert.ToInt32(PageURLId[j][k]),Convert.ToInt32(BlogURLId[bi]),0);
}
bi++;
if(bi == BlogURLS.Count)
bi=0;
Monitor.Exit(Thread.CurrentThread);
Thread.Sleep(5000);
}
}
}
hope u understand that....
Thanks,
Pramod
|
|
|
|
|
hi all,
Actually i am a beginner in visual studio c# development and developing a software for our firm in c# (windows forms).
The main task of mine is to display the contents of the floppy when i click on the button in the windows forms and display the contents in the another window forms.Can anybody help me and guide me to go about it?
Nitin_ap
|
|
|
|
|
what do you mean with the word "content" ? is content Files list in Floppy Disk ? You can easily get files content of your floppy disk by using System.IO.Directory.GetFiles . You can get your Floppy Disk drive info by using System.Environment.GetLogicalDrives
good luck !
|
|
|
|
|
Is there a way to rename the hostname using C#?
thanX in advanced
|
|
|
|
|
|
The application that I have written perfroms additional tasks (editing INI, environment variables, XML) the only thing that I need to do is rename the hostname at this time.
|
|
|
|
|