.Net compact framework 界面自适应输入法
2010-06-18 09:54
274 查看
.NET Compact Framework提供了一个很不错的组件,名字叫InputPanel。好,现在大家在已经打开的VS平台中新建一个Windows Mobile的项目,并且从“工具箱”中找到那个"InputPanel"组件,把其拖放到窗体编辑中。
接下来我们在窗体中添加一个Panel控件“pnlTextchat”,并把其的Dock属性设置为Fill状态,然后添加一个文本框控件,假设ID是“txtRecord". 那么我们切换到文本框控件的事件列表中来,然后按着我们里面事件,添加这两个事件:GotFocus和LostFocus。
然后添加InputPanel控件的EnabledChanged事件
代码写到这里基本差不多了,但是还有重要的一点:
用完inputPanel后,一定要释放资源,好像inputPanel不会自动释放,
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yanzhibo/archive/2010/03/22/5403921.aspx
接下来我们在窗体中添加一个Panel控件“pnlTextchat”,并把其的Dock属性设置为Fill状态,然后添加一个文本框控件,假设ID是“txtRecord". 那么我们切换到文本框控件的事件列表中来,然后按着我们里面事件,添加这两个事件:GotFocus和LostFocus。
然后添加InputPanel控件的EnabledChanged事件
/// <summary> /// 启用或禁用输入法软面板(SIP)时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void inputPanel_EnabledChanged(object sender, EventArgs e) { if(pnlTextchat != null) { if (inputPanel.Enabled) { pnlTextchat.Height -= inputPanel.Bounds.Height; } else { pnlTextchat.Height += inputPanel.Bounds.Height; } } } /// <summary> /// 启用或禁用输入法软面板(SIP)时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void inputPanel_EnabledChanged(object sender, EventArgs e) { if(pnlTextchat != null) { if (inputPanel.Enabled) { pnlTextchat.Height -= inputPanel.Bounds.Height; } else { pnlTextchat.Height += inputPanel.Bounds.Height; } } }
代码写到这里基本差不多了,但是还有重要的一点:
用完inputPanel后,一定要释放资源,好像inputPanel不会自动释放,
/// <summary> /// 界面关闭时调用inputPanel的Dispose()释放其资源,否则会出现ObjectDisposedException. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TextChatForm_Closing(object sender, CancelEventArgs e) { inputPanel.Dispose(); } /// <summary> /// 界面关闭时调用inputPanel的Dispose()释放其资源,否则会出现ObjectDisposedException. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TextChatForm_Closing(object sender, CancelEventArgs e) { inputPanel.Dispose(); }
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yanzhibo/archive/2010/03/22/5403921.aspx
相关文章推荐
- .Net compact framework 界面自适应输入法
- .NET Compact Framework 线程与界面上的控件
- 基于.NET Compact Framework的应用程序和库汇总
- 在 .NET Compact Framework 2.0 中使用序列化
- .Net Compact Framework 小技巧(1)
- 《.NET Compact Framework 移动开发指南》,即将与大家见面
- 新书《.NET Compact Framework 移动开发指南》章节连载
- .NET Compact Framework下的串口通信
- 微软发布 .NET Compact Framework 3.5 Beta1
- 在Windows Mobile和Wince(Windows Embedded CE)下如何使用.NET Compact Framework开发进程管理程序
- .Net Compact Framework 基础篇(7)
- .net compact framework
- Windows Mobile和Wince(Windows Embedded CE )下使用.NET Compact Framework下注册表导出工具的开发
- 设计.Net Compact Framework CLR
- .Net Compact Framework 中使用 Timer
- 在.NET Compact Framework 2.0中使用序列化
- RDIFramework.NET ━ .NET快速信息化系统开发框架 V3.2->Web版本新增新的角色授权管理界面效率更高、更规范
- Windows Phone,Windows Mobile,Windows Embedded CE(WinCE),.NET Compact Framework,Native C++开发系列(上百篇原创文章不断更新完善中)【转】
- RDIFramework.NET ━ .NET快速信息化系统开发框架 V3.2->WinForm版本新增新的角色授权管理界面效率更高、更规范
- Net Compact Framework 意义