
.NET
whisht
十年
展开
-
C# OCX控件之开发
在C#中,其实没有OCX控件一说,相对应的只是COM组件,编译后也是.DLL,而不是.ocx.所以在C#中,在创建项目时只能创建类库项目。 然后就是具体的代码开发。(略) 要使组件成为能被网页脚本调用的OCX控件,在开发时,要注意以下几点: 1、必须要为将发布OCX控件的主类设置GUID码。该码在创建类库时,C#会自动生成一个(你可以使用,也可以重新生成),并存储在AssemblyInfo.cs中。设置GUID的代码参照以下:namespace xxxx { [Guid("8d7d8518-原创 2011-05-31 17:05:00 · 1625 阅读 · 0 评论 -
C# SHMultiFileProperties查看多个文件属性
[DllImport("shell32.dll", CharSet = CharSet.Auto)]private static extern IntPtr SHMultiFileProperties(IDataObject pdtobj, int dwFlags);[DllImport("shell32.dll", CharSet = CharSet.Auto)]public static原创 2013-05-23 10:54:50 · 1285 阅读 · 1 评论 -
c# 单实例运行
using System;using System.Collections.Generic;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Diagnostics;using System.Reflection;namespace BBrowser{ static cl原创 2013-05-07 15:12:20 · 903 阅读 · 0 评论 -
C# 删除文件、文件到到回收站及异常判断
Namespace: Microsoft.VisualBasic.FileIOAssembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)SyntaxC#C++F#VBpublic static void原创 2013-05-17 09:37:34 · 1273 阅读 · 0 评论 -
C#中图片透明
/// /// 处理图片透明操作/// /// 原始图片/// 透明度(0.0---1.0)/// private Image TransparentImage(Image srcImage, float opacity){ float[][] nArray ={ new float[] {1, 0, 0, 0, 0}, new原创 2013-05-02 11:33:55 · 1081 阅读 · 0 评论 -
图片旋转---老外写的代码
/// /// Creates a new Image containing the same image only rotated/// /// The to rotate/// The amount to rotate the image, clockwise, in degrees/// A new that is just large enough/// to contai原创 2013-05-02 11:37:40 · 760 阅读 · 0 评论 -
C# 中引用IHTMLDocument2
C#做浏览器,需要获取当前网页选中的内容具体方法 引用--》COM--》Microsoft HTML Object Library代码:using mshtml; IHTMLDocument2 document = (IHTMLDocument2)web.Document.DomDocument; IHTMLTxtRange htmlElem = (IHTMLTx原创 2013-04-11 17:48:55 · 5442 阅读 · 0 评论 -
.Net利用反射调用DLL时,被调用DLL引用其它库问题
项目中利用反射加载dll,部署要求所有dll放在指定的文件夹,与主程序不在一起,测试使用Assembly.LoadFile,一切正常,直到有的dll还引用其它dll时碰到问题,查msdn解释改为LoadForm正常另:Assembly.LoadFile 与 Assembly.LoadFrom的区别1、Assembly.LoadFile只载入相应的dll文件,比如Assemb原创 2013-03-22 11:36:47 · 1276 阅读 · 0 评论 -
C#中设置窗口圆角样式
private void FrmMain_Paint(object sender, PaintEventArgs e){ GraphicsPath oPath = new GraphicsPath(); int x = 0; int y = 0; int w = Width; int h = Height; int a =原创 2013-03-01 10:36:20 · 3829 阅读 · 0 评论 -
C# 工具条控件设置背景色去除边框
1、设置控件toolStrip1属性RenderMode为System2、重绘代码private void toolStrip1_Paint(object sender, PaintEventArgs e){ if ((sender as ToolStrip).RenderMode == ToolStripRenderMode.System) { Rectangle rect原创 2013-03-01 10:32:39 · 3532 阅读 · 0 评论 -
C# 执行bat文件并取得回显
using System.IO;using System.Diagnostics;ProcessStartInfo pro = new System.Diagnostics.ProcessStartInfo("cmd.exe");pro.UseShellExecute = false;pro.RedirectStandardOutput = true;pro.Redir原创 2012-10-27 22:53:54 · 4861 阅读 · 0 评论 -
c# 创建 XML-RPC服务
1、下载XML-PRC for .net 包,工程中引用CookComputing.XmlRpcV2.dll2、接口文件using System;using System.Collections.Generic;using System.Windows.Forms;using SMSServer;using CookComputing.XmlRpc;namespace S原创 2012-08-10 15:44:52 · 4175 阅读 · 2 评论 -
WIN7 C# System.Runtime.InteropServices.COMException VLC HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)
Win7 + VS2005 C#引用 VLC,运行错误:System.Runtime.InteropServices.COMException VLC HRESULT:0x80040154 (REGDB_E_CLASSNOTREG) 解决办法:在项目属性里设置“生成”=>“目标平台”为x86而不是默认的ANY CPU.原创 2012-07-08 15:05:00 · 4825 阅读 · 0 评论 -
C# 获取空闲端口及查看已用端口
转自论坛:http://topic.youkuaiyun.com/u/20100603/13/ef349c6e-66ee-4129-a884-61c9091a9a99.htmlusing System.Net.NetworkInformation;/// /// 获取第一个可用的端口号/// /// public static int GetFirstAvailablePort()原创 2012-06-22 16:29:29 · 11000 阅读 · 2 评论 -
如何获到其它进程鼠标选中的文字
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropService原创 2013-07-02 15:02:13 · 819 阅读 · 0 评论