I want to be able to display a context menu when the user righthand drags an item into a textbox. It states in the documentation that the e.KeyState property will be set accordingly in the drop event. But when I check the value it is always 0, the value is set correctly for Shift, Ctrl, Alt. Am I doing something wrong?
private void textBox2_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
textBox1.DoDragDrop("Test",DragDropEffects.Copy);
}
private void textBox2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
label1.Text = e.KeyState.ToString();
} 2 4264
You can probably use the static Control.ModifierKeys property to deterine
what control keys are pressed.
George Shepherd's Windows Forms FAQ contains an entry entitled:
How can I tell if an ALT, Shift or CTL key is pressed without catching
an event?
Check it out at: http://www.syncfusion.com/faq/winforms/search/656.asp
=============================================
Clay Burch, .NET MVP
Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials
"Paul Ledger" <Pa********@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com... I want to be able to display a context menu when the user righthand drags
an item into a textbox. It states in the documentation that the e.KeyState
property will be set accordingly in the drop event. But when I check the
value it is always 0, the value is set correctly for Shift, Ctrl, Alt. Am I
doing something wrong? private void textBox2_DragEnter(object sender,
System.Windows.Forms.DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
private void textBox1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e) { textBox1.DoDragDrop("Test",DragDropEffects.Copy); }
private void textBox2_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e) { label1.Text = e.KeyState.ToString(); }
Try this
if(Control.MouseButtons == System.Windows.Forms.MouseButtons.Right)
{
//show context menu
}
--
Shak
(Houston)
"Paul Ledger" <Pa********@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com... Sorry didnt make it clear in my original post. I want to determine if the
right mouse button is down "ClayB [Syncfusion]" wrote:
You can probably use the static Control.ModifierKeys property to
deterine what control keys are pressed.
George Shepherd's Windows Forms FAQ contains an entry entitled:
How can I tell if an ALT, Shift or CTL key is pressed without
catching an event?
Check it out at: http://www.syncfusion.com/faq/winforms/search/656.asp
============================================= Clay Burch, .NET MVP
Syncfusion, Inc. visit http://www.syncfusion.com for .NET Essentials "Paul Ledger" <Pa********@discussions.microsoft.com> wrote in message news:16**********************************@microsof t.com... I want to be able to display a context menu when the user righthand
drags an item into a textbox. It states in the documentation that the
e.KeyState property will be set accordingly in the drop event. But when I check the value it is always 0, the value is set correctly for Shift, Ctrl, Alt.
Am I doing something wrong? private void textBox2_DragEnter(object sender,
System.Windows.Forms.DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { textBox1.DoDragDrop("Test",DragDropEffects.Copy); }
private void textBox2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { label1.Text = e.KeyState.ToString(); }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lauren Quantrell |
last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.)
onto a field in Access2K and capture the full file path.
I found an posting below that says this is possible but I cannot...
|
by: SamSpade |
last post by:
There seems to be two ways to put things on the clipboard ( I don't mean
different formats): SetClipboardData and OleSetClipboard
If I want to get data off the clipboard do I care how it was put...
|
by: Ajay Krishnan Thampi |
last post by:
I have a slight problem implementing 'drag and drop' from a datagrid
to a tree-view. I have pasted my code below. Someone please advice me
on what to do...pretty blur right now.
==code==
...
|
by: Chris |
last post by:
Hi,
I need to be able to detect when a drag is cancelled after it has started.
Meaning: after the drag operation has begun, and the user does not complete
the drag, but releases whatever's being...
|
by: jojobar |
last post by:
Hello,
I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I
tried to run it under firefox browser but it did not run.
If I want to use this feature in a commercial product...
|
by: Chris Leffer |
last post by:
I am trying to run a combination of some MS samples regarding drag and
drop. I want to copy or move data from a textbox depending on the
Keystate property, but my DragDrop event won't fire:
...
|
by: Manuel Canas |
last post by:
Hi there,
This is the code that I am using to drag items from a list box and drop them
into a text box.
I'm not sure, but from what I know, each item on a list box is an object.
Let say I get a...
|
by: VB Programmer |
last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2
listboxes? Thanks!
|
by: Romulo NF |
last post by:
Greetings,
I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |