| 网站首页 | VB.Net实例分析 | .Net技术文摘 | 下载中心 | VB.Net书籍笔记 | .Net源码 | VBS脚本与组件调用 | Windows2008技术文摘 | 给我们留言 | 
最新公告:

  没有公告

您现在的位置: 乐博网 >> VB.Net实例分析 >> 外接设备编程 >> 实例分析正文
最新推荐 更多内容
Tablet PC 2005 的区分上下文功能(VB2010实例)
Tablet PC 2005 的区分上下文功能(VB2010实例)
作者:Akyao    来源:乐博网收集     更新时间:2011-4-18

本文代码实现演示 Microsoft Windows XP Tablet PC Edition 2005 的区分上下文功能,来自乐博网。

如果你想下载本文的源代码RAR压缩集合包  请访问
VB2010源代码集合包(芋头糕)    http://www.lob.cn/code/utility/2795.shtml
特别感谢网友 芋头糕 将此资源提供乐博网分享,欢迎加入 40797788 的.Net超级qq群交流。

演示 Microsoft Windows XP Tablet PC Edition 2005 的区分上下文功能的实例代码如下:

Imports Microsoft.Ink
Imports System.Reflection

Public Class Form1
    Dim myPenInputPanel As PenInputPanel
    Dim factoidNameValues = New SortedList(Of String, String)

    Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        'Attach the programmable PenInputPanel to the control
        myPenInputPanel = New PenInputPanel(textBox1)

        'Add all supported Factoids to the checked list box
        AddAllFactoids(listBox1.Items)
    End Sub  '更多.net源代码 来自乐博网lob.cn

    Private Sub AddAllFactoids(ByVal objectCollection As ListBox.ObjectCollection)
        'Factoids are defined as static, public string constant fields in the Factoid object
        Dim factoidType As Type = GetType(Factoid)
        Dim field As FieldInfo

        For Each field In factoidType.GetFields(BindingFlags.Static Or BindingFlags.Public)
            'Retrieve the name of the Factoid
            Dim fieldName As String = field.Name

            '"WordList" factoid is not supported for PenInputPanel
            If fieldName = "WordList" Then
                Continue For
            End If

            'Retrieve the value of the Factoid (generally, but not always, the Name in uppercase
            Dim fieldValue As String = CType(field.GetValue(factoidType), String)

            'Add the name to the checked list box
            objectCollection.Add(fieldName)

            'Store the value so it can be retrieved when the list box is manipulated
            factoidNameValues.Add(fieldName, fieldValue)
        Next
    End Sub

    Sub ListBoxSelectedIndexChangedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles ListBox1.SelectedIndexChanged
        If ListBox1.SelectedItems.Count = 0 Then
            'If none selected, set Factoid to default
            myPenInputPanel.Factoid = Factoid.Default
        End If

        'Get selected name of Factoid
        Dim factoidName As String = CType(ListBox1.SelectedItem, String)

        'Retrieve factoid value
        Dim factoidValue As String = factoidNameValues(factoidName)

        Try
            'Set context
            myPenInputPanel.Factoid = factoidValue
        Catch
            'Not all systems support all factoids
            MessageBox.Show("Factoid not supported on this system")

            'Set the factoid to default
            myPenInputPanel.Factoid = Factoid.Default
            ListBox1.SelectedIndex = 1
            ListBox1.Items.Remove(factoidName)
            ListBox1.Invalidate()
        End Try
    End Sub

    Sub CheckBoxChangedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked Then
            ListBox1.Enabled = True
        Else
            ListBox1.Enabled = False
            myPenInputPanel.Factoid = Factoid.Default
        End If
    End Sub

End Class

  • 上一篇:

  • 下一篇:
  • 【字体: 】【打印此文】【关闭窗口
      相关文章:(只显示最新16条)
    管理计算机电源状态的类(VB2010实例)
    Tablet PC 上可用的文本识别选项(VB2010实例)
    Tablet PC 2005 中对笔势的系统识别(VB2010实例)
    自定义数据控件(VB2010实例)
    响应数字化仪触笔背面的橡皮擦(VB2010实例)
    WMI编程实例(VB2010实例)
    系统服务管理实例(VB2010实例)
    进程管理(VB2010实例)
    显示进程组成模块(VB2010实例)
    任务管理器编程(VB2010实例)
    性能计数器编程(VB2010实例)
    消息队列MSMQListener(VB2010实例)
    消息队列MSMQClient(VB2010实例)
    写入事件日志(VB2010实例)
    读取事件日志(VB2010实例)
    创建和删除事件日志(VB2010实例)

    | 设为首页 | 加入收藏 | 联系站长 | | 友情链接 | 版权申明 |
    乐博网欢迎各种媒体转载我们的原创作品[转载请注明出处];我们鼓励更多VB.Net开发者一起加入研究与探讨;如发现文章访问错误、内容错误或版权疑问、内容有违相关法律(如涉及政治、色情、反动或散布虚假有害信息)等情况,请及时向我们举报,我们将及时纠正!
    联系邮箱:Shiny#vip.qq.com (#替换为@) QQ交流群: 40797788 [闽ICP备05014267号]