会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
kenter的.net学习博客
博客园
首页
新随笔
联系
管理
订阅
上一页
1
2
3
4
5
6
7
8
下一页
2011年8月10日
异常来自 HRESULT:0x80131015 解决办法
摘要: vs2010 rdlc .net4.0 卸载 Appdomain 时出错。 (异常来自 HRESULT:0x80131015) 解决办法 只要在窗口的关闭事件中,调用ReportViewer控件的LocalReport.Dispose()方法即可!
阅读全文
posted @ 2011-08-10 13:24 kenter
阅读(829)
评论(0)
推荐(0)
2011年8月9日
windows 多线程编程的几点经验 (防止死锁)
摘要: 1) 不要在线程函数体内操作MFC控件,不要再线程里面调用UpdateData函数更新用户界面,而应该尽量采用发送消息的方式,在主线程的消息响应函数中操作控件;2)不建议采用SendMessage往主线程发送消息,因为它是同步的,阻塞的,可以考虑采用PostMessage代替;3)线程退出时,尽量不要使用TerminateThread函数,而尽可能的让线程自己退出;4) 当线程退出时,必须先等待工作者线程退出,主线程才退出,但是在主线程里面不要使用WaitForSingleObject或 WaitForMultiObjects等待线程结束,因为它可能造成死锁,当主线程使用这两个函数时,主线程就
阅读全文
posted @ 2011-08-09 17:46 kenter
阅读(265)
评论(0)
推荐(0)
2011年8月8日
测试代码运行效率
摘要: #include<time.h>#defineBEGIN_COUNT(mark)__int64__begin_count##mark;\QueryPerformanceCounter((LARGE_INTEGER*)&__begin_count##mark);\#defineEND_COUNT(mark)__int64__end_count##mark;\QueryPerformanceCounter((LARGE_INTEGER*)&__end_count##mark);\__int64__Frequency##mark;\QueryPerformanceFreq
阅读全文
posted @ 2011-08-08 09:08 kenter
阅读(279)
评论(1)
推荐(0)
2011年8月6日
C# 播放和暂停播放wav文件
摘要: [DllImport("winmm.DLL", EntryPoint = "PlaySound", SetLastError = true, CharSet = CharSet.Unicode, ThrowOnUnmappableChar = true)] private static extern bool PlaySound(string szSound, System.IntPtr hMod, PlaySoundFlags flags); [System.Flags] public enum PlaySoundFlags : int { SND_S
阅读全文
posted @ 2011-08-06 22:13 kenter
阅读(1880)
评论(1)
推荐(0)
2011年8月1日
用宏实现的单例模式
摘要: #defineSINGLETON_CLASS_NO_DEF_CONSTRUCT_BODY(class_name)\private:\class_name();\class_name(constclass_name&);\class_name&operator=(constclass_name&);\public:\staticclass_name&Instance()\{\staticclass_nameone;\returnone;\}#defineSINGLETON_CLASS(class_name)\private:\class_name(){}\clas
阅读全文
posted @ 2011-08-01 23:40 kenter
阅读(267)
评论(0)
推荐(0)
2011年7月31日
调用第三方程序,指定父窗体
摘要: [DllImport("user32.dll")]staticexternIntPtrSetParent(IntPtrhWndChild,IntPtrhWndNewParent);[DllImport("user32.dll")]privatestaticexternboolShowWindowAsync(IntPtrhWnd,intnCmdShow);privatevoidbutton1_Click(objectsender,EventArgse){System.Diagnostics.Processp=System.Diagnostics.Proce
阅读全文
posted @ 2011-07-31 23:11 kenter
阅读(269)
评论(0)
推荐(0)
图像旋转的C#示例
摘要: privatevoidRotateTransform_Click(objectsender,System.EventArgse){Graphicsgraphics=this.CreateGraphics();graphics.Clear(Color.White);//装入图片Bitmapimage=newBitmap("nemo.bmp");//获取当前窗口的中心点Rectanglerect=newRectangle(0,0,this.ClientSize.Width,this.ClientSize.Height);PointFcenter=newPointF(rect.W
阅读全文
posted @ 2011-07-31 20:05 kenter
阅读(320)
评论(0)
推荐(0)
在WEB程序中如何画图并显示
摘要: 大家都知道,在窗体上画图形,并显示出来很容易,只要得到相关容器的Graphics,就可以按照自己想要的样式去画;但是在WEB中,想要在某个页面中去随意画出图形并且显示出来则不能像窗体程序那样,因为不能获得某个容器的Graphics,这是B/S的架构有关,毕竟显示的页面是在Client,而你的处理地方是在Server端。那么如何在WEB程序中如何画图并显示,则需要一定设置,大致步骤如下:首先,需要设置WEB程序运行的目录下,设置一个临时目录,用于存放临时的图片文件,例如:“ImagesTemp”,并设置ASPNET用户能对此目录可写。接下来,画图的思路,是动态生成一个Bitmap,用它产生容器,
阅读全文
posted @ 2011-07-31 20:03 kenter
阅读(704)
评论(0)
推荐(0)
如何把网络共享目录映射为本地驱动器
摘要: 要映射一个网络目录为本地驱动器,需要调用系统DLL的WNetAddConnection2函数来进行添加。首先,系统函数的申明如下:using System.Runtime.InteropServices; [DllImport("mpr.dll", EntryPoint="WNetAddConnection2")] public static extern uint WNetAddConnection2( [In] NETRESOURCE lpNetResource,string lpPassword,string lpUsername,uint dwF
阅读全文
posted @ 2011-07-31 19:59 kenter
阅读(1150)
评论(0)
推荐(0)
如何在窗体以外的地方绘制图像
摘要: 很多人都疑惑,如何在窗体以外的地方绘制图像,其实在以前VC中很方便。其实在C#中也很方便,需要调用DLL的方法,大致如下。首先,定义DLL的函数,代码如下: [DllImport("User32.dll")] public extern static IntPtr GetDC(System.IntPtr hWnd); 然后就是调用了,如下代码是调用以上的方法画一个填充矩形: IntPtr DesktopHandle = GetDC(IntPtr.Zero); Graphics g = System.Drawing.Graphics.FromHdc(DesktopHandle
阅读全文
posted @ 2011-07-31 19:56 kenter
阅读(472)
评论(2)
推荐(2)
上一页
1
2
3
4
5
6
7
8
下一页
公告