Hi,

I have found out a solution.  Please find the code below,


DataGridViewCell abc = this.dataGridView1.CurrentCell;

Rectangle RECT = this.dataGridView1.GetCellDisplayRectangle(abc.ColumnIndex,
abc.RowIndex, true);

contextMenuStrip1.Show(RECT.X + desired distance, RECT.Y + desired distance
);

Thanks guys for all your help.

Regards,

karthik.



On Wed, Oct 29, 2008 at 12:42 PM, karthi keyan <[EMAIL PROTECTED]> wrote:

> Dear Astrodrabb,
>
> You have exactly explained the situation.  Thank you so much. I am still
> working on it after a long weekend.  Please post me if you find out a
> solution for this.  I will keep you posted if I get an answer.
>
> Regards,
> Karthik.
>
>   On Tue, Oct 28, 2008 at 12:49 AM, AstroDrabb <[EMAIL PROTECTED]>wrote:
>
>> Glenn,
>>
>> I think Karhti is asking the following:
>>
>> Say I have a laptop screen that is 1280x800.  My app is full
>> screen/maximized with a DGV on it.  If I use the mouse to select an item, I
>> can get the X and Y coordinates of the mouse on the Click event(s) to
>> display some menu or pop-up window.  I can show the pop-up/menu at the EXACT
>> X/Y of the mouse event.
>>
>> However, using the keyboard UP/DOWN keys to select an item and hitting
>> another key to bring up the menu/pop-up doesn't put it in the correct
>> location because the mouse X/Y location could be anywhere on the screen
>> since it wasn't used to select the current row in the DGV.  The mouse could
>> be off the at the bottom of the screen
>>
>> For example, when I am doing heavy keyboard work, I push the mouse to the
>> top-right of my screen out of the way.  So on my monitor the X/Y would be
>> 1440/0.  Not the best place to show a menu/pop-up and it certainly wouldn't
>> show the X/Y of the currently selected DGV item.
>>
>> I have never had a need to do things this way.  I will run some tests when
>> I have time to see what I can find.
>>
>>
>>
>> On Sat, Oct 25, 2008 at 11:41 AM, Glenn <[EMAIL PROTECTED]> wrote:
>>
>>> It doesn't make a difference if the item was selected using the mouse of
>>> if you're using the keyboard.
>>>
>>> ...Glenn
>>>
>>> On Sat, Oct 25, 2008 at 8:05 AM, karthi keyan <[EMAIL PROTECTED]>wrote:
>>>
>>>> Hi Glenn,
>>>>
>>>> I agree with you, Yes, there is no need to know where it is, however if
>>>> I use the up/down arrow key & press the APPS key, I want the context menu
>>>> to  be populated at that particular cell location (I have done this using
>>>> DGV mouse down event, this time I don't wanna use Mouse)  I tried but I was
>>>> not able to find a proper solution for this.
>>>>
>>>> can you please guide me? Please correct me if I am wrong.
>>>>
>>>> Regards,
>>>> Karhti
>>>>
>>>
>>
>> >>
>>
>

Reply via email to