|
|
Yes and it works but I don't want that. I want to show the ContextMenuStrip for the sub menu items of the favorite menu only, not for the main menu items.
|
|
|
|
|
Hello
I believe in this case you will have to do it manually, by adding a MouseDown event handler to the MenuItems you wish the ContextMenuStrip to appear for.
eg.
private void testToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
if(e.Button == MouseButtons.Right)<br />
contextmenu1.Show(sender, new Point(10, 10));<br />
}
|
|
|
|
|
Thanks a lot. It worked but there's a little bug.
The problem is when I right click on a menu item the main menu (Favorites) is being closed as soon as the context menu is shown.
How can I fix that?
|
|
|
|
|
Hello again
This time it'll be a bit of a mess;)
you see, Internet Explorer uses Shell menus to do this task, we'll have to do it manually:
Modify the previouse code to this:
private void testToolStripMenuItem2_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
contextMenuStrip1.Show(this, new Point(10, 10));
contextMenuStrip1.AutoClose = false;
menuToolStripMenuItem.ShowDropDown();
contextMenuStrip1.BringToFront();
}
}
Where:
testToolStripMenuItem2 is the submenu you wish to right click on -Like the favourite folders-
menuToolStripMenuItem is the Main menuitem -Like the favoutires menuitem.
Notice that after the contextmenu shows up the Menustrip behind it still has the mouse activity. To stop this:
1- Make another context menu
2- Assign it as the dropdown of your -favourites- menuitem
3- At the end of the RightClick event handler add this line
contextMenuStrip1.Capture = true;
it won't work unless the DropDown is another ContextMenuStrip not just MenuItemColection.
Note that you still have to set the AutoClose back to true to close the ContextMenuStrip. Do it when you know that the user won't be needing it any longer
I told you this is going to get messy
|
|
|
|
|
I'm looking for a free open source* RTE (Rich Text Editor).
I'm looking for ASP.NET, but I figured to my self, that this forum is more supportive and can help better than the other one (although I will post there also).
If anyone have any links that might help me, I would that him soooooo much!!!
Thanks in advanced... SOOOOOOOOOOOOOOOO Muchh.....
*Open source = A component that I can edit the style\looks of it, so I can change his appearens to my needs.
NaNg.
|
|
|
|
|
|
A google search with the exact subject you used gives this[^] as the first result, ehich is a list of WYSIWYG editors.
Google is your friend.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
|
I need a common function for returning similiar kind of stored procedure in C#
For Example
sp_Insert-dept
sp_Insert_deptclass
Will write common funtion for this two sp
|
|
|
|
|
|
In addition to what J4amieC said, please read the C# forum guidelines[^]. In particular, look at guideline #3, which mentions how descriptive topics are necessary. Instead of "urgent" as a topic, please state the nature of your problem, such as "How can I share code between 2 stored procedures" or somethign similar.
Now, to answer your question, if you're using SQL database, look into user functions[^].
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
|
Hey, some suggestions about how to get help quickly and use it wisely:
1) Try it out yourself before asking.
2) Be specific, and very specific in your question. Vague questions and vague answers just waste your and our time.
3) Don't depend on others to do the job for you.
Best,
Jun
|
|
|
|
|
Hi.
I was just wondering, how many times you nice people will reply to these annoying subjects?
I know it sound hard, but there has to be a consequence at some point.
Programming is like Mathematics… you take ONE step at the time!
|
|
|
|
|
If you haven't noticed yet, and from the looks of your post history you'll have to try about a hundred more times before it sinks in, if you mention the word "Urgent" anywhere in your post, it gets you ignored or ridiculed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi:
I would like to launch an application from C# if it is not already running -- I dont want multiple instances of the application running.
How do I check what programs are currently running on the system?
Thanks, smurfy
|
|
|
|
|
There are several ways to guarantee a single instance. Search CP for "single instance" and you'll get tons of articals and code snippets.
Best,
Jun
|
|
|
|
|
Are you talking about using a C# application to detect an instance of itself and stop a subsequent launch of itself? If so then the other reply about Single Instance.
If you're talking about using a C# application to launch another, unassociated application only if it's not running (ie: testapp1 checks for testapp2 and if it finds it doesn't launch but does launch if testapp2 isn't running) then you need to use Process.GetProcessesByName.
Example:
Process [] TestApp2Instance;
TestApp2Instance = Process.GetProcessesByName("TestApp2.exe");
Since Process is an array, if the length exceeds 0, then the TestApp2 is running so you can abort the launch, otherwise, do a Process.Start("TestApp2.EXE");
Keep in mind that if your testapp isn't registered as a system app in the Windows registry, you'll have to provide a full path to the app you want to launch.
Mike Poz
-- modified at 20:50 Monday 26th June, 2006
Realized I made an error...
|
|
|
|
|
using System;<br />
using System.Runtime.InteropServices;<br />
using System.Windows.Forms;<br />
using System.Diagnostics;<br />
using System.Reflection;<br />
<br />
public class OneInstnace<br />
{ <br />
[STAThread]<br />
public static void Main()<br />
{<br />
Process instance = RunningInstance();<br />
if (instance == null)<br />
{<br />
Application.Run (new Form());<br />
}<br />
else<br />
{<br />
HandleRunningInstance(instance);<br />
}<br />
}<br />
public static Process RunningInstance()<br />
{<br />
Process current = Process.GetCurrentProcess();<br />
Process[] processes = Process.GetProcessesByName (current.ProcessName);<br />
<br />
foreach (Process process in processes)<br />
{<br />
if (process.Id != current.Id)<br />
{<br />
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") ==<br />
current.MainModule.FileName)<br />
{<br />
return process;<br />
}<br />
}<br />
}<br />
<br />
return null;<br />
}<br />
<br />
<br />
public static void HandleRunningInstance(Process instance)<br />
{<br />
ShowWindowAsync (instance.MainWindowHandle , WS_SHOWNORMAL);<br />
<br />
SetForegroundWindow (instance.MainWindowHandle);<br />
}<br />
<br />
[DllImport("User32.dll")] <br />
<br />
private static extern bool ShowWindowAsync(<br />
IntPtr hWnd, int cmdShow);<br />
[DllImport("User32.dll")] private static extern bool<br />
SetForegroundWindow(IntPtr hWnd);<br />
private const int WS_SHOWNORMAL = 1;<br />
}<br />
<br />
--Srini--
|
|
|
|
|
Hi all,
I want to implement double click event handling in my code. I have done in following way, but it is not working.
<br />
this.button1.DoubleClick += new System.EventHandler(this.button1_DoubleClick);<br />
<br />
<br />
private void button1_DoubleClick(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("I am in Double Click");<br />
}<br />
<br />
Can anyone suggest me whats going wrong here?
Please help me.
Thanks in advance.
|
|
|
|
|
For_IT wrote: Can anyone suggest me whats going wrong here
Im afraid that my mind-reading AND my remote-debugging abilities are not working at the moment, so without details of any error message you receive I dont think I can tell you what went wrong.
You have also not mentioned which version of the framework you are programming against - but I can tell you that in v1.x the Button control did not contain a DoubleClick event (this may be different for the v2 framework but I dont have it in front of me to check).
Capturing a Double click in v1.x was done using the MouseDown event as follows
private void button1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left && e.Clicks == 2)
{
MessageBox.Show("I was a double left button click");
}
}
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
-- modified at 10:58 Monday 26th June, 2006
|
|
|
|
|
Now .NET supports both "DoubleClick" and "MouseDoubleClick" events and the latter is for .NET 2.0 only. Check out this link.
Best,
Jun
|
|
|
|
|
Thank you both. This helped.
|
|
|
|
|
Hello all. I am interested in hiding a ListView Control underneath a
TabControl. The ListView Control will contain say, 5 columns. When the user
selects 1 of the tabs, I want to show the ListView and 3 columns (the other 2
will be hidden). When the user selects the other tab, I want to show the
other 2 columns of the ListView. Is there a way to do this without creating
two ListViews (1 for each Tab)? I have tried using all the Focus, Selected, and Show functionalities to the hidden ListView, but it will not appear over the
TabControl.
Thanks for the help.
|
|
|
|