<bdo id='kAYiX'></bdo><ul id='kAYiX'></ul>
  • <legend id='kAYiX'><style id='kAYiX'><dir id='kAYiX'><q id='kAYiX'></q></dir></style></legend>

  • <tfoot id='kAYiX'></tfoot>

      <i id='kAYiX'><tr id='kAYiX'><dt id='kAYiX'><q id='kAYiX'><span id='kAYiX'><b id='kAYiX'><form id='kAYiX'><ins id='kAYiX'></ins><ul id='kAYiX'></ul><sub id='kAYiX'></sub></form><legend id='kAYiX'></legend><bdo id='kAYiX'><pre id='kAYiX'><center id='kAYiX'></center></pre></bdo></b><th id='kAYiX'></th></span></q></dt></tr></i><div id='kAYiX'><tfoot id='kAYiX'></tfoot><dl id='kAYiX'><fieldset id='kAYiX'></fieldset></dl></div>
      1. <small id='kAYiX'></small><noframes id='kAYiX'>

        如何将插入符号位置设置为 WPF 密码框中的特定索引

        How can i set the caret position to a specific index in passwordbox in WPF(如何将插入符号位置设置为 WPF 密码框中的特定索引)
          <bdo id='B4ycc'></bdo><ul id='B4ycc'></ul>

          1. <small id='B4ycc'></small><noframes id='B4ycc'>

              <tbody id='B4ycc'></tbody>
                • <tfoot id='B4ycc'></tfoot>

                  <i id='B4ycc'><tr id='B4ycc'><dt id='B4ycc'><q id='B4ycc'><span id='B4ycc'><b id='B4ycc'><form id='B4ycc'><ins id='B4ycc'></ins><ul id='B4ycc'></ul><sub id='B4ycc'></sub></form><legend id='B4ycc'></legend><bdo id='B4ycc'><pre id='B4ycc'><center id='B4ycc'></center></pre></bdo></b><th id='B4ycc'></th></span></q></dt></tr></i><div id='B4ycc'><tfoot id='B4ycc'></tfoot><dl id='B4ycc'><fieldset id='B4ycc'></fieldset></dl></div>
                  <legend id='B4ycc'><style id='B4ycc'><dir id='B4ycc'><q id='B4ycc'></q></dir></style></legend>

                  本文介绍了如何将插入符号位置设置为 WPF 密码框中的特定索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要在 WPF 中明确设置密码框内的光标位置.我在密码框中看不到 selectionstart 属性.

                  I need to set the cursorposition inside the passwordbox explicitly in WPF. I couldn't see the selectionstart property in passwordbox.

                  有什么帮助吗?

                  推荐答案

                  您可以尝试这样的方法来设置 PasswordBox 中的选择:

                  You can try something like this to set the selection in the PasswordBox:

                  private void SetSelection(PasswordBox passwordBox, int start, int length) {
                      passwordBox.GetType().GetMethod("Select", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(passwordBox, new object[] { start, length });
                  }
                  

                  之后,这样调用它来设置光标位置:

                  After that, call it like this to set the cursor position:

                  // set the cursor position to 2...
                  SetSelection( passwordBox1, 2, 0);
                  
                  // focus the control to update the selection
                  passwordBox1.Focus();
                  

                  这篇关于如何将插入符号位置设置为 WPF 密码框中的特定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to keep the Text of a Read only TextBox after PostBack()?(PostBack()之后如何保留只读文本框的文本?)
                  Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word(Winforms 文本框 - 使用 Ctrl-Backspace 删除整个单词)
                  C# - Add button click events using code(C# - 使用代码添加按钮单击事件)
                  Multi-color TextBox C#(多色文本框 C#)
                  C# Numeric Only TextBox Control(C# 纯数字文本框控件)
                  Unicode characters not showing in System.Windows.Forms.TextBox(System.Windows.Forms.TextBox 中未显示 Unicode 字符)
                    <bdo id='kzk2H'></bdo><ul id='kzk2H'></ul>

                      <tbody id='kzk2H'></tbody>

                        <small id='kzk2H'></small><noframes id='kzk2H'>

                        <tfoot id='kzk2H'></tfoot>

                        • <legend id='kzk2H'><style id='kzk2H'><dir id='kzk2H'><q id='kzk2H'></q></dir></style></legend>

                          1. <i id='kzk2H'><tr id='kzk2H'><dt id='kzk2H'><q id='kzk2H'><span id='kzk2H'><b id='kzk2H'><form id='kzk2H'><ins id='kzk2H'></ins><ul id='kzk2H'></ul><sub id='kzk2H'></sub></form><legend id='kzk2H'></legend><bdo id='kzk2H'><pre id='kzk2H'><center id='kzk2H'></center></pre></bdo></b><th id='kzk2H'></th></span></q></dt></tr></i><div id='kzk2H'><tfoot id='kzk2H'></tfoot><dl id='kzk2H'><fieldset id='kzk2H'></fieldset></dl></div>