|
I changed it to MouseDoubleClick and the ContMenuStrip is already assigned to the ContextMenuStrip property of TB_Icon. Still, the icon does not respond.
|
|
|
|
|
This is working for me.
(Added button[btnOK], notifyIcon[TB_Icon], contextMenuStrip[ContMenuStrip] and a toolStripMenuItem to ContMenuStrip with TB_Icon's ContextMenuStrip property set to ContMenuStrip)
public partial class MainFrm : Form
{
public MainFrm()
{
InitializeComponent();
btnOK.Click += new EventHandler(btnOK_Click); Resize += new EventHandler(MainFrm_Resize);
TB_Icon.MouseDoubleClick += new MouseEventHandler(TB_Icon_MouseDoubleClick);
ContMenuStrip.Click += new EventHandler(ContMenuStrip_Click);
}
void btnOK_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
void MainFrm_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
Hide();
}
void TB_Icon_MouseDoubleClick(object sender, MouseEventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
void ContMenuStrip_Click(object sender, EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
}
Dave
|
|
|
|
|
Hi,
why do you hide the main form when it gets minimized? when it gets minimized it
is no longer visible on the desktop. I am afraid hiding it explicitly makes it
not responding on anything anymore until you somehow make it visible again.
if you want to remove it from the task bar, use the Form.ShowInTaskbar Property
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I have tried the ShowInTaskbar approach, but still, no dice.
I tried to "run to cursor" to the point where the double-click event occurs, but it never goes to it. So, obviously, the icon does not recognize any mouse clicks. Is there a way to ensure that it does?
|
|
|
|
|
danielhasdibs wrote: Now, keep in mind that after the user completes the MainFrame form (clicks the "OK" button), a loop is constantly running
This could be where your problem lies. How are you calling this loop and what's happening in it?
Dave
|
|
|
|
|
This is a reminder program. On the MainFrame form, the user enters a time to be reminded. After the reminder is set (the user clicks OK), the window minimizes and hides. Then the program enters a loop checking the difference in timespan. When the timespan.minutes is less than one, the reminder activates.
I had the thread sleeping between iterations just to keep the memory usage down, but even when I remove the sleep methods, the icon does not respond.
|
|
|
|
|
Please see my last comment explaining what the program does.
|
|
|
|
|
I'm guessing your loop is preventing you main window from processing messages. You could identify this by putting an Application.DoEvents() line into the loop which should resume processing. However, this is bad and should not be seen as a solution only a test to see if it is message processing.
The better approach would be to have your okay button start a timer rather than wait in a loop. You can use a timer control which should be able to do what you require.
|
|
|
|
|
I've tried the timer, but it still doesn't work. Could you give me a sample code that works for you using a timer (or a loop) and a NotifyIcon? Thanks.
|
|
|
|
|
public partial class MainFrm : Form
{
Timer MyReminder = new Timer();
public MainFrm()
{
InitializeComponent();
btnOK.Click += new EventHandler(btnOK_Click);
Resize += new EventHandler(MainFrm_Resize);
TB_Icon.Icon = Icon;
TB_Icon.MouseDoubleClick += new MouseEventHandler(TB_Icon_MouseDoubleClick);
ContMenuStrip.Click += new EventHandler(ContMenuStrip_Click);
MyReminder.Interval = 2000;
MyReminder.Tick += new EventHandler(MyReminder_Tick);
}
void MyReminder_Tick(object sender, EventArgs e)
{
Console.WriteLine("You have been reminded at " + DateTime.Now);
}
void btnOK_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
void MainFrm_Resize(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
Hide();
MyReminder.Start();
}
else
{
MyReminder.Stop();
}
}
void TB_Icon_MouseDoubleClick(object sender, MouseEventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
void ContMenuStrip_Click(object sender, EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
}
Dave
|
|
|
|
|
Thank you, thank you!
Solution is above.
Thanks to DaveyM69.
|
|
|
|
|
I would like to speed up my processing with visual studio and or other programs. Does anyone know of free distributed computing software that I can run with Visual Studio 2005 to speed up processing? Does anyone know of free distributed computing software that I can run other programs with (Run Visual Studio 2005 on my computer and SQL Server 2005 on another computer which is accessed on my computer)? It doesn't have to be over the internet but through a LAN.
|
|
|
|
|
Not sure exactly what you are doing, but BOINC is an amazing distributed computer framework. A simple Google search will find you loads of information.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
chris175 wrote: Run Visual Studio 2005 on my computer and SQL Server 2005 on another computer which is accessed on my computer
What are you going on about. SQL Server and every other Database natively support remote connections and have like forever.
led mike
|
|
|
|
|
led mike wrote: SQL Server and every other Database natively support remote connections
I guess sql server is a bad example. Maybe if I had 3 Visual Studio 2005 instances running. I would want one working on my computer and the other two computing on another computer.
|
|
|
|
|
chris175 wrote: I guess sql server is a bad example. Maybe if I had 3 Visual Studio 2005 instances running. I would want one working on my computer and the other two computing on another computer.
As far as I am aware, Visual Studio is NOT a distributed application. If you have found information to the contrary perhaps you could supply a link to it? I seems so far you've done a very poor job either understanding distributed computing or explaining your question.
led mike
|
|
|
|
|
led mike wrote: As far as I am aware, Visual Studio is NOT a distributed application.
Thanks you for the answer to my question. I was simply asking if it was possible to have distributed computing for Visual Studio 2005.
The other part of my question involves something entirly different. I was wanting to know if I could have an ENTIRE application (Ex: VS2005) running on another computer but being controled from my computer.
|
|
|
|
|
chris175 wrote: The other part of my question involves something entirly different. I was wanting to know if I could have an ENTIRE application (Ex: VS2005) running on another computer but being controled from my computer.
Yes there are various technologies for doing just that. They are NOT equal.
http://en.wikipedia.org/wiki/Remote_control_software[^]
led mike
|
|
|
|
|
If you want to know if you can spread a large projects compile over multiple machines to speed it up there's 3rd party software to do so. IIRC the one I've heard of before is called incredibuild.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
|
I am populating my Dropdownlist using dataset
DataTable t_table = new DataTable();
SqlDataAdapter adapt;
SqlCommand cmd = new SqlCommand("SELECT distinct ID from TBL1",conn);
adapt = new SqlDataAdapter(cmd);
adapt.Fill(t_table);
dsProj.Tables.Add(t_table);
The staement does populate as expected but I want to insert a Blank Line First.
How can I do this?
|
|
|
|
|
This was asked over here[^], roughly.
|
|
|
|
|
Hi Guy
This is easy just use insertAtRow() method to table, u can insert a blank row after bind to Combobox.
thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I dont have much knowledge about System.Drawing namespace,
I want to print a particular text in Bold letters with in printed page.
Its an window application, having a form similar to standard mail interface. like having fields
From:
To:
Subject:
Now user can print this form contents.
What I want to do feilds like From, To, Subject, should print in bold letters.
|
|
|
|
|
The Font that you use has a FontStyle property. When you create the font, set FontStyle.Bold. If my memory serves correctly, the call would look like this:
Font myFont = new Font("Verdana", 12, FontStyle.Bold);
|
|
|
|