Windows窗体CTRL + I [英] Windows forms CTRL + I

查看:54
本文介绍了Windows窗体CTRL + I的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Basic制作一个简单的程序,在这种情况下,我试图在富文本框中添加一个快捷方式,以使所选文本变为斜体,并发现ctrl + i有效地输入了Tab,然后没有代码创建了一个新项目 并在其中进行了尝试,发现在富文本框和多行文本框中仍然会发生这种情况.有谁知道如何禁用此功能,以便我可以将CTRL + i用作斜体代码?

这也是我的斜体功能的一个副本,我发现当我从一个对象中选择文本然后从另一个对象中选择文本时,它都会斜体显示这两种斜体,任何想法都使它变为斜体,这样只有以后的选择才会斜体. /p>

  Private Sub Form1_KeyDown(作为对象发送,作为System.Windows.Forms.KeyEventArgs发送)处理Me.KeyDown
       如果(e.KeyCode = Keys.I And也e.Modifiers = Keys.Control)然后


           如果DescriptionDescriptionTxt.SelectionFont.Italic然后'已为斜体,则将其设置为常规
               说明Txt.ShortcutsEnabled = False
                DescriptionTxt.SelectionFont =新字体(DescriptionTxt.Font.FontFamily,DescriptionTxt.Font.Size,FontStyle.Regular)
           否则将其设为斜体
                DescriptionTxt.SelectionFont =新字体(DescriptionTxt.Font.FontFamily,DescriptionTxt.Font.Size,FontStyle.Italic)
           如果结束

           如果为StepsTxt.SelectionFont.Italic,则其已为斜体,因此将其设置为常规
                    StepsTxt.SelectionFont =新字体(StepsTxt.Font.FontFamily,StepsTxt.Font.Size,FontStyle.Regular)
               否则将其设为斜体
                    StepsTxt.SelectionFont =新字体(StepsTxt.Font.FontFamily,StepsTxt.Font.Size,FontStyle.Italic)
               如果结束

               如果ExpectedTxt.SelectionFont.Italic然后'已为斜体,则将其设置为常规
                    ExpectedTxt.SelectionFont =新字体(ExpectedTxt.Font.FontFamily,ExpectedTxt.Font.Size,FontStyle.Regular)
               否则将其设为斜体
                    ExpectedTxt.SelectionFont =新字体(ExpectedTxt.Font.FontFamily,ExpectedTxt.Font.Size,FontStyle.Italic)
               如果结束

               如果是NotesTxt.SelectionFont.Italic,则其已为斜体,因此将其设置为常规
                    NotesTxt.SelectionFont =新字体(NotesTxt.Font.FontFamily,NotesTxt.Font.Size,FontStyle.Regular)
               否则将其设为斜体
                    NotesTxt.SelectionFont =新字体(NotesTxt.Font.FontFamily,NotesTxt.Font.Size,FontStyle.Italic)
               如果结束

           如果结束
   结束子

解决方案

朋友,

此论坛讨论的是Visual Studio WPF/SL设计器,Visual Studio指导自动化工具包,开发人员文档和帮助系统以及Visual Studio编辑器.

您的问题与VB有关,我将把此主题移到相应的论坛上寻求专业解答.感谢您的理解:)

最诚挚的问候

Fletcher


I am using visual basic to make a simple program, in this I am attempting to add a shortcut into rich text boxes that will make the selected text italic and have discovered that ctrl + i effectively enters Tab, I then made a new project with no code and tried within that and have found this still happens in both rich text boxes and multi-line text boxes. Does anyone know how to disable this so that i can use CTRL + i for my italics code?

Also here is a copy of my italics function, i have found that when i select text from one object and then select text from another object it italicises both, any idea how to make it so that only later selection gets italicised.

 Private Sub Form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If (e.KeyCode = Keys.I AndAlso e.Modifiers = Keys.Control) Then


            If DescriptionTxt.SelectionFont.Italic Then 'its already italic, so set it to regular
                DescriptionTxt.ShortcutsEnabled = False
                DescriptionTxt.SelectionFont = New Font(DescriptionTxt.Font.FontFamily, DescriptionTxt.Font.Size, FontStyle.Regular)
            Else 'make it italic
                DescriptionTxt.SelectionFont = New Font(DescriptionTxt.Font.FontFamily, DescriptionTxt.Font.Size, FontStyle.Italic)
            End If

            If StepsTxt.SelectionFont.Italic Then 'its already italic, so set it to regular
                    StepsTxt.SelectionFont = New Font(StepsTxt.Font.FontFamily, StepsTxt.Font.Size, FontStyle.Regular)
                Else 'make it italic
                    StepsTxt.SelectionFont = New Font(StepsTxt.Font.FontFamily, StepsTxt.Font.Size, FontStyle.Italic)
                End If

                If ExpectedTxt.SelectionFont.Italic Then 'its already italic, so set it to regular
                    ExpectedTxt.SelectionFont = New Font(ExpectedTxt.Font.FontFamily, ExpectedTxt.Font.Size, FontStyle.Regular)
                Else 'make it italic
                    ExpectedTxt.SelectionFont = New Font(ExpectedTxt.Font.FontFamily, ExpectedTxt.Font.Size, FontStyle.Italic)
                End If

                If NotesTxt.SelectionFont.Italic Then 'its already italic, so set it to regular
                    NotesTxt.SelectionFont = New Font(NotesTxt.Font.FontFamily, NotesTxt.Font.Size, FontStyle.Regular)
                Else 'make it italic
                    NotesTxt.SelectionFont = New Font(NotesTxt.Font.FontFamily, NotesTxt.Font.Size, FontStyle.Italic)
                End If

            End If
    End Sub

解决方案

Hi friend,

This forum is discussing Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

Your issue is related to VB, I will move this thread to corresponding forum for a professional answer. Thanks for your understanding:)

Best regards,

Fletcher


这篇关于Windows窗体CTRL + I的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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