wince的.netcf让pda界面支持右键(c#版本)

简介: Recently i wanted to implement contextmenu withanimation(progress) though there is no direct api or way to do it after hoursof searching on the net i ...

Recently i wanted to implement contextmenu withanimation(progress) though there is no direct api or way to do it after hoursof searching on the net i finally found a hack to do it by using win32 dll byP/invoking SHRecognizeGesture in aygshell.dll below pic shows the example ofcontext menu in calendar week view

img_f261e9925456264fdf372d0c88413c49.jpg

// Initialize the below code snippet in thebeginning of the class
     internal struct SHRGINFO
     {
         public int cbSize;
         public IntPtr hwndClient;
         public int ptDownX;
         public int ptDownY;
         public SHRGFLags dwFlags;
     }
     
     [Flags]
     internal enum SHRGFLags
     {
         SHRG_RETURNCMD = 0x00000001,
         SHRG_NOTIFYPARENT = 0x00000002,
         SHRG_LONGDELAY = 0x00000008,
         SHRG_NOANIMATION = 0x00000010,
     }
     [DllImport("aygshell")]
     extern private static intSHRecognizeGesture(ref SHRGINFO shr);

     [DllImport("coredll.dll",SetLastError = true)]
     public static extern IntPtr GetActiveWindow();


     //call the showContMenu() method inMouseup or MouseDown event
     public void showContMenu(int x, inty)
     {
         SHRGINFO shr = new SHRGINFO();
         shr.cbSize =Marshal.SizeOf(typeof(SHRGINFO));
         shr.dwFlags = SHRGFLags.SHRG_RETURNCMD;
         shr.ptDownX = x;
         shr.ptDownY = y;
         shr.hwndClient =GetActiveWindow();

         int ret = SHRecognizeGesture(refshr);

         if (ret == 1000)
             contextMenu1.Show(this, newSystem.Drawing.Point(x, y));

     }


I have used above method in more than two views and it works awesome, if youhave any problem with above snippet you can reach me through email at thebottom of the page and if there is a better way or if managed code exists sharewith us.

相关文章
|
安全 C# 开发工具
模拟.NET应用场景,综合应用反编译、第三方库调试、拦截、一库多版本兼容方案
模拟.NET实际应用场景,综合应用三个主要知识点:一是使用dnSpy反编译第三库及调试,二是使用Lib.Harmony库实现第三库拦截、伪造,三是实现同一个库支持多版本同时引用。
模拟.NET应用场景,综合应用反编译、第三方库调试、拦截、一库多版本兼容方案
|
6月前
|
开发框架 安全 .NET
Microsoft .NET Framework 3.5、4.5.2、4.8.1,适用于 Windows 版本的 .NET,Microsoft C Runtime等下载
.NET Framework是Windows平台的开发框架,包含CLR和FCL,支持多种语言开发桌面、Web应用。常用版本有3.5、4.5.2、4.8.1,系统可同时安装多个版本,确保软件兼容运行。
1575 0
Microsoft .NET Framework 3.5、4.5.2、4.8.1,适用于 Windows 版本的 .NET,Microsoft C Runtime等下载
|
数据挖掘 BI
.net8 Syncfusion生成pdf/doc/xls/ppt最新版本
通过使用 Syncfusion,您可以高效地生成各种文档,满足不同的业务需求。这些工具不仅易于使用,还具有高性能和高度可扩展性,是处理文档的理想选择。
617 16
C# 版本的 计时器类 精确到微秒 秒后保留一位小数 支持年月日时分秒带单位的输出
这篇2010年的文章是从别处搬运过来的,主要包含一个C#类`TimeCount`,该类有多个方法用于处理时间相关的计算。例如,`GetMaxYearCount`计算以毫秒为单位的最大年数,`GetCurrentTimeByMiliSec`将当前时间转换为毫秒,还有`SecondsToYYMMDDhhmmss`将秒数转换为年月日时分秒的字符串。此外,类中还包括一些辅助方法,如处理小数点后保留一位数字的`RemainOneFigureAfterDot`。
|
JSON API C#
闲话 .NET(6):.NET Core 各个版本的特性
闲话 .NET(6):.NET Core 各个版本的特性
579 0
|
XML 开发框架 数据格式
.Net Core 开发框架,支持多版本的类库
.Net Core 开发框架,支持多版本的类库
393 0
|
安全 程序员 Shell
老程序员分享:NSIS自定义界面,下载并安装Net.Framework4.8
老程序员分享:NSIS自定义界面,下载并安装Net.Framework4.8
|
开发框架 JavaScript .NET
.NET 8 候选版本 2 (RC2) 现已可用
.NET 8 候选版本 2 (RC2) 现已可用
367 0
.NET 8 候选版本 2 (RC2) 现已可用
|
存储 文字识别 C#
一个基于百度飞桨封装的.NET版本OCR工具类库 - PaddleOCRSharp
一个基于百度飞桨封装的.NET版本OCR工具类库 - PaddleOCRSharp
1028 0