|
No no, you misunderstand me. I WANT to fire the event, as if the user had double-clicked the column divider.
Why? Because the DataGridView handles the "AutoResizeColumns" concept somewhat, uh... stupidly. I can't tell the DGV to resize the columns themselves, and then go back to a state where the user can resize them, without them resetting themselves to their original widths.
So, I want to fire the "hey, act as if the user had double-clicked the column divider" event, which will cause the column to autoresize and still be user-changeable.
|
|
|
|
|
So, let's get back to the original question - what is the syntax for raising an event?
|
|
|
|
|
Hi Joe!
It is not difficult at all to implement your own delegates and events that allow you to send notifications from one part of your application to another.
You must understand the delegates and the events . Do yourself a favour and read this excellent article[^] by Joe Bennett.
SkyWalker
|
|
|
|
|
Before I dig into this - and this article essentially covers the same ground as the Alarm Clock example from the MSDN documentation, which I pointed out was unnecessarily complex to answer this simple question - do I really need to create delegates just to shoot an event to an existing .NET control?
I just want to raise an existing System event... is this not just one line of code?
|
|
|
|
|
the += EventHandler does what you want.
But, believe me, it's better if you understand the thing before using it, no offense
SkyWalker
|
|
|
|
|
I think he doesn't whant to now how to link the EventHandler.
He likes to have a possibility to fire an event.
Like if you call the Refresh method of a control the Paint event is fired.
To Joe:
This would only be possible if this special control (which I have no experience with) covers that with a method.
For example:
The Windows Button has the "PerformClick" method which fires the event.
But from outside there is no possibility to fire an event, I think.
All the best,
Martin
|
|
|
|
|
From a more formal—and a C#—perspective, an event is an object member, specifically a method (the discussion here primarily focuses on Windows forms but equally applies to other objects such as Buttons and other controls).
The event method, which is also called an event procedure, formally consists of the procedure name followed by two arguments. The first argument, or parameter, is the object firing the event, and the second an argument of the type System.EventArgs. In addition, the event method must also be hooked up as a delegate, or a method that stands in for another method, using the += operator.
Now, if you just want to invoke, let's say, a button's Enter event from another event or place, add a call to the YourButton_Enter method in the other event (or the other piece of code) like that:
System.EventArgs ea = new System.EventArgs();
YourButton_Enter (this, ea);
SkyWalker
|
|
|
|
|
This is EXACTLY what I needed. thanks.
Okay, I'm so close. Here's what I'm doing now:
HandledMouseEventArgs:
Button Gets which mouse button was pressed. (Inherited from MouseEventArgs.)
Clicks Gets the number of times the mouse button was pressed and released. (Inherited from MouseEventArgs.)
Delta Gets a signed count of the number of detents the mouse wheel has rotated. (Inherited from MouseEventArgs.)
Handled Gets or sets whether this event should be forwarded to the control's parent container.
Location Gets the location of the mouse during the generating mouse event. (Inherited from MouseEventArgs.)
X Gets the x-coordinate of the mouse during the generating mouse event. (Inherited from MouseEventArgs.)
Y Gets the y-coordinate of the mouse during the generating mouse event. (Inherited from MouseEventArgs.)
DataGridViewColumnDividerDoubleClickEventArgs(int ColumnIndex, HandledMouseEventArgs e)
So I'm doing this:
HandledMouseEventArgs ea = new HandledMouseEventArgs(MouseButtons.Left,2,0,0,0,false);<br />
System.Windows.Forms.DataGridViewColumnDividerDoubleClickEventArgs f = new DataGridViewColumnDividerDoubleClickEventArgs(2, ea);<br />
dgvAllEvents_ColumnDividerDoubleClick(this, f);
I'm just making up data for the HandledMouseEventArgs, except the second argument, which is the ColumnIndex (which column divider to doubleclick). And it's not doing anything yet. Apparently, I actually need to provide real point data in the HandledMouseEventArgs, although I'm not sure why it would need to know where the mouse actually is? And for the Handled argument, should I be sending True or False?
|
|
|
|
|
By setting the Handled argument to true, you specify that this event should be forwarded to the control's parent container (otherwise, set it to false).
If you are not going to use the actual mouse coordinates, then do not bother about them.
SkyWalker
|
|
|
|
|
Hello Joe!
This would only be possible if this special control (which I have no experience with) covers that with a method.
For example:
The Windows Button has the "PerformClick" method which fires the event.
But from outside there is no possibility to fire an event, I think.
All the best,
Martin
|
|
|
|
|
In a word document i've a paragraph. Programmatically i wants to check the spell and left side of each line of the paragraph i've to give the Error description.
In this above task,
I've done the spell check but i don't know how to generate error description in the left side of each line.
Any one can you help me?
Gopalakrishnan R (Software Engineer)
Ascendum Systems Pvt. Ltd
#90,II Main | Phase I | Electronics City | Hosur Rd | Bangalore 560100 | INDIA
Direct : 91.9860 44145
Office : 91.80.4135 9848
Email : Gopalakrishnan.R@ascendum.com
Web : www.ascendum.com
|
|
|
|
|
Please don't cross post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi..
I tried the code given in http://www.codeproject.com/csharp/SimpleContextMenu.asp. I wrote the below code in the form_load :
string menuCommand = string.Format("\"{0}\" \"%L\"",
Application.ExecutablePath);
FileShellExtension.Register("jpegfile", "Simple Context Menu",
"Context Menu", menuCommand);
But i am not getting the context menu. Is this the correct way to provide the code in the form load. How to get the context menu?
Please help
Thanks & Regards,
Venkat
|
|
|
|
|
Did you download the sample application? Your app needs to contain the Classes described in the article.
If you did download the sample application, does IT create the context menu when you run it?
|
|
|
|
|
Hi..
I tried the same code. I am getting the message box that the Shell extension was registered. But still i dont get the context menu?
please help
Thanks & Regards,
Venkat
|
|
|
|
|
I am able to register the context menu, but its not getting displayed..
please help
Thanks & Regards,
Venkat
|
|
|
|
|
Any help...
Thanks & Regards,
Venkat
|
|
|
|
|
i have a combo box and a TreeView Control in a windows application.
How to populate the drives in the combo box and folders in a TreeView Control.
the problem is:
i want to populate all the drives of the system in the combo box.And when i select a drive, it should display all the folders in the TreeView control corresponding to that selected drive.
I tried Using .getlogicalDrives,but invain.Is there any coding for this.
Please help me.
tirumal
|
|
|
|
|
With String[] drives = Environment.GetLogicalDrives() , you get an array of strings where each element contains the name of a logical drive.
Within a foreach loop, you could then add those names to your combobox and perform any additional staff related to each name. Much faster is to use the YourComboBox.Items.AddRange(drives) method.
After that, you may want to use the ComboBox.SelectionChangeCommitted event which occurs when the selected item has changed and that change is displayed in the combobox. Inside the private void YourComboBox_SelectionChangeCommitted(object sender, EventArgs e) function used to treat that event, you will populate the tree control with information on the folders. You may want to see the Windows Forms Programming example provided by MSDN: Creating an Explorer Style Interface with the ListView and TreeView Controls[^]
SkyWalker
|
|
|
|
|
I programmicaly created a datatable, meaning it isn't bound to a database. I want to be able to add style to it but I can't associate created DataGridColumn style with any column.
For example, I have 3 columns, 1-2-3. Then I create a style for them... what and how do I map it appropriately!
Thanks,
RABB17
RABB17
"Nothing fancy needed, please just solve all our problems as quickly as possible."
|
|
|
|
|
|
Please tell me.
What is size of hash table?
Thanks in advance
|
|
|
|
|
Hi,
The usable size of a hash table is the number of associations that the table can hold at a given time. If the number of associations in the table exceeds the usable size, the table will automatically grow, increasing the usable size to a new value that is sufficient to hold the associations.
The physical size is an abstract measure of a hash table that specifies how much space is allocated to hold the associations of the table. The physical size is not interesting in itself; it is interesting only for its effect on the performance of the hash table.
Regards,
Cormac Redmond
|
|
|
|
|
Please tell me.
How many tables does dataset contains?
Thanks in advance.
|
|
|
|
|