如何在可编辑模式下保存datagridview richtextbox cel [英] How can preserve datagridview richtextbox cel which ls in editable mode

查看:94
本文介绍了如何在可编辑模式下保存datagridview richtextbox cel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在可编辑模式下将datagridview richtextbox单元格作为richtextbox

我将其设为可编辑

我使用以下代码



I want datagridview richtextbox cell as richtextbox in editable mode
I made it as editable
I used following code

private void dgvPARs_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
       {

           DataGridView dgvPARsTMD = sender as DataGridView;
           dgvPARsTMD.CurrentCell = dgvPARsTMD[e.ColumnIndex, e.RowIndex];


               RichTextBox temp = dgvPARs.EditingControl as RichTextBox;
       }



我得到当前可编辑的单元格,但是如果输入任何特殊字符(我有特殊字符的面板),可编辑的行会​​失去焦点



如何保留datagridview可编辑行的焦点

任何建议


Iam getting current editable cell but if entering any special character(i have panel for special charcters) editable row loses its focus

How can i preserve focus of datagridview editable row
Any suggestions

推荐答案

很可能你的特殊字符面板(顺便说一下,没有字符是特殊的,但我能理解你的意思)在这种情况下不能使用,因为它抓住焦点。



但是,如果您需要快速解决方法,我可以使用它:应用程序焦点的输入和丢失 [ ^ ]。



这个想法是:当你的特殊字符面板抓住焦点时,你可以制作它一个单独的表格这是不可聚焦的,不可选择的。但是它会被你的目标表单发回。为了防止这种情况,它也应该始终在最顶层。由于您暂时只显示此面板,因此不应该出现问题。这只是一个想法,您可以修改此解决方案以满足您的需求。



-SA
It's most likely that your panel for "special characters" (none of characters are "special", by the way, but I can understand what you mean) cannot be used in this case, because it grabs the focus.

However, if you need a quick workaround, I have it: Application focus getting and losing[^].

The idea is: as your "special characters" panel grabs focus, you can make it a separate form which is non focusable and not selectable. But then it would be sent to back by your target form. To prevent that, it should also be made "always on top". As you show this panel only temporarily, it should not be a problem. This is just the idea, you can modify this workaround solution to fit your needs.

—SA


这篇关于如何在可编辑模式下保存datagridview richtextbox cel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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