摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Window...
阅读全文
随笔分类 - .NET
摘要:[DllImport("shell32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SHMultiFileProperties(IDataObject pdtobj, int dwFlags);
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr ILCreateFromPath(string path);
[DllImport("shell32.dll"
阅读全文
摘要:Namespace:Microsoft.VisualBasic.FileIOAssembly:Microsoft.VisualBasic(in Microsoft.VisualBasic.dll)SyntaxC#C++F#VBpublicstaticvoidDeleteFile( stringfile, UIOptionshowUI, RecycleOptionrecycle, UICancelOptiononUserCancel
)
ParametersfileType:System.StringName and path of the file to be deleted.show...
阅读全文
摘要:using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection; namespace BBrowser
{ static class Program { private const int WS_SHOWNORMAL = 1; public const Int32 AW_BLEND =...
阅读全文
摘要:/// <summary>
/// Creates a new Image containing the same image only rotated
/// </summary>
/// <param name="image">The <see cref="System.Drawing.Image"/> to rotate</param>
/// <param name="angle">The amount to rotate the image, clock
阅读全文
摘要:/// <summary>
/// 处理图片透明操作
/// </summary>
/// <param name="srcImage">原始图片</param>
/// <param name="opacity">透明度(0.0---1.0)</param>
/// <returns></returns>
private Image TransparentImage(Image srcImage, float opacity)
{ float[][] nAr
阅读全文
摘要:C#做浏览器,需要获取当前网页选中的内容具体方法 引用--》COM--》Microsoft HTML Object Library代码:using mshtml; IHTMLDocument2 document = (IHTMLDocument2)web.Document.DomDocument; IHTMLTxtRange htmlElem = (IHTMLTxtRange)document.selection.createRange(); string text = htmlElem.text; //选中的文字内容
阅读全文
摘要:项目中利用反射加载dll,部署要求所有dll放在指定的文件夹,与主程序不在一起,测试使用Assembly.LoadFile,一切正常,直到有的dll还引用其它dll时碰到问题,查msdn解释改为LoadForm正常另:Assembly.LoadFile 与 Assembly.LoadFrom的区别1、Assembly.LoadFile只载入相应的dll文件,比如Assembly.LoadFile("a.dll"),则载入a.dll,如果a.dll中引用了b.dll的话,b.dll并不会被载入。Assembly.LoadFrom则不一样,它会载入dll文件及其引用的其他dll
阅读全文
摘要: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 = 8; Graphics g = CreateGraphics(); oPath.AddArc(x, y, a, a, 180, 90); //边框格式 oPath.AddArc...
阅读全文
摘要:1、设置控件toolStrip1属性RenderMode为System2、重绘代码private void toolStrip1_Paint(object sender, PaintEventArgs e)
{ if ((sender as ToolStrip).RenderMode == ToolStripRenderMode.System) { Rectangle rect = new Rectangle(0, 0, this.toolStrip1.Width, this.toolStrip1.Height - 2); e.Graphics.SetClip(rect); } ...
阅读全文
摘要:using System.IO;using System.Diagnostics;ProcessStartInfo pro = new System.Diagnostics.ProcessStartInfo("cmd.exe");pro.UseShellExecute = false;pro.RedirectStandardOutput = true;pro.RedirectStandardError = true;pro.CreateNoWindow = true;pro.Arguments = "/K " + System.Environment.C
阅读全文
摘要:1、下载XML-PRC for .net 包,工程中引用CookComputing.XmlRpcV2.dll2、接口文件using System;
using System.Collections.Generic;
using System.Windows.Forms; using SMSServer;
using CookComputing.XmlRpc; namespace SMSServer.Service
{ #region 测试结构体 //忽略某字段 //public struct SampleStruct //{ // publi...
阅读全文
摘要:Win7 + VS2005C#引用 VLC,运行错误:System.Runtime.InteropServices.COMException VLC HRESULT:0x80040154 (REGDB_E_CLASSNOTREG)解决办法:在项目属性里设置“生成”=>“目标平台”为x86而不是默认的ANY CPU.
阅读全文
摘要:转自论坛:http://topic.csdn.net/u/20100603/13/ef349c6e-66ee-4129-a884-61c9091a9a99.htmlusing System.Net.NetworkInformation;/// <summary>/// 获取第一个可用的端口号/// </summary>/// <returns></returns>public static int GetFirstAvailablePort(){ int MAX_PORT = 6000; //系统tcp/udp端口数最大是65535 int BE
阅读全文
摘要:在C#中,其实没有OCX控件一说,相对应的只是COM组件,编译后也是.DLL,而不是.ocx.所以在C#中,在创建项目时只能创建类库项目。 然后就是具体的代码开发。(略) 要使组件成为能被网页脚本调用的OCX控件,在开发时,要注意以下几点: 1、必须要为将发布OCX控件的主类设置GUID码。该码在创建类库时,C#会自动生成一个(你可以使用,也可以重新生成),并存储在AssemblyInfo.cs中。设置GUID的代码参照以下:namespace xxxx { [Guid("8d7d8518-ca58-4863-b94d-3c616fda7b35")]//从AssemblyI
阅读全文