如何为下一个单元格私有光标,直到最后一行上的光标 [英] how to privent cursor for next cell untill cursor on last row

查看:94
本文介绍了如何为下一个单元格私有光标,直到最后一行上的光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友您好,请帮助我


我在我的项目中有datagridview之类的

PARTYNAME C/D AMOUNT NARRATION<-((我的datagridview栏名称)
约翰c 250 xyz
JONY d 300 xyz
MONY C 500 xyz
SMITh d 230 xyz
DEvlin c 150 xyz
methu d 150 xyz


我有一个组合框,其中包含所有聚会名称,并且如果用户要更改聚会名称,则在按列上的Enter键的任何位置都可见true


我的问题是,每当我输入let来更改名称john时,我就将光标设置在john(单元格)上,然后按Enter键将光标移动到jony(下一行),因此我要停止直到最后一个单元格上的光标移动到该行(停止光标移动到下一行)任何伙伴都可以帮助我

进阶

ROSY

hello friend please help me


i have datagridview in my project like

PARTYNAME C/D AMOUNT NARRATION <-(MY datagridview COLUMN name)
JOHN c 250 xyz
JONY d 300 xyz
MONY c 500 xyz
SMITh d 230 xyz
DEvlin c 150 xyz
methu d 150 xyz


i have combo box with holds all party name and visible true wherever user press enter key on column if he want to change party name


my problem is that whenever i enter let if i want to change name john i set cursor on john (cell) and i press enter key cursor move jony(min next row)so i want to stop untill cursor on last cell the row this thing (stop cursor to move next row) can any buddy help me

thnaks in advanced

ROSY

推荐答案

如果我理解您的问题,则除非用户光标位于最后一行,否则您希望防止用户按下Enter时将光标向下移到下一行.让我知道我是否理解.

另外,当按下Enter键时,您想做什么?您是希望它保持原样,还是要移至同一行的下一个单元格,还是要将CR插入到光标所在的单元格中,还是其他? />
我对此的快速回答是,当DataGrid具有焦点时,观察按键被按下;当您不希望光标移动时,将event参数中的Handled属性设置为true;而当您希望光标移动时,将其保持原样.转到下一个单元格.事件处理程序可以从DataGrid读取属性,以确定光标是否在最后一行.您需要将活动行的索引与DataGrid中的行数进行比较,以进行脱盐处理.
If I understand your question, you want to prevent the cursor going down to the next row when a user presses Enter, unless the cursor is on the last row. Let me know if I understand that.

Also what do you want to happen when the Enter key is pressed? Do you want it to stay where it is, do you want it to move over to the next cell in the same row, or do you want a CR to be inserted into the cell where the cursor is at, or something else?

My quick answer about this would be to watch the keys being pressed when the DataGrid has focus, and set the Handled property in the event argument to true when you don''t want the cursor moving, and leave it as is when you do want it to go to the next cell. The event handler could read properties from the DataGrid to determine if the cursor was in the last row. You would need to compare the index of the active row with the count of rows in the DataGrid to make that desalinization.


这篇关于如何为下一个单元格私有光标,直到最后一行上的光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆