随笔分类 - C#
摘要:喏,计算两个时间的时间差,精确到年月日时分秒 看起来比较笨的方法了,不知道有没有改进
阅读全文
摘要:用于获取MP3内部信息,包括歌曲名,歌手名等…… namespace FileBatchRemaer.domain{ /// /// Mp3信息结构 /// public struct Mp3Info { public string identif...
阅读全文
摘要://全区域移动 const int WM_NCLBUTTONDOWN = 0xA1; const int HT_CAPTION = 0x2; [DllImport("user32.dll")] static exter...
阅读全文
摘要:1、 如何解决单击记录整行选中的问题View->OptionsBehavior->EditorShowMode 设置为:Click2、 如何新增一条记录(1)、gridView.AddNewRow()(2)、实现 gridView_InitNewRow 事件3、如何解决 GridControl 记录...
阅读全文
摘要:一、皮肤的使用拖入defaultLookAndFeel 组件到窗体中拖入ribbonControl 控件到窗体中将窗体继承为 DevExpress.XtraBars.Ribbon.RibbonForm将窗体的AllowFormGlass属性改为 False引用DevExpress.BonusSkin...
阅读全文
摘要:/// /// 边框阴影 /// protected override CreateParams CreateParams { get { ...
阅读全文
摘要://获取系统字体:InstalledFontCollection fc = new InstalledFontCollection(); foreach( FontFamily font in fc.Families ){ ListItem tmp = new ListItem( font...
阅读全文
摘要:private bool IsAllowedExtension(HttpPostedFile hifile) { bool ret = false; System.IO.FileStream fs = new System.IO.F...
阅读全文
摘要:System.Diagnostics.Process.Start(); 能做什么呢?它主要有以下几个功能:1、打开某个链接网址(弹窗)。2、定位打开某个文件目录。3、打开系统特殊文件夹,如“控制面板”等。那么它是怎么实现这几个功能的呢?在讲应用前,我们先来看看Process.Star()的构造方法...
阅读全文
摘要:Image img = Image.FromHbitmap(icon.ToBitmap().GetHbitmap()); Graphics g = Graphics.FromImage(img); g.DrawImage(img, 0, 0, img.Width, img.Height); Font f = new Font("Verdana", 32); Brush b = ne...
阅读全文
摘要:/// /// Converts an image into an icon. /// /// The image that shall become an icon /// The width and height of the icon. Standard /// sizes are 16x16, 32x32, 48x48, 64x64. /// Whether the image should be squashed into a /// square or whether whites...
阅读全文
摘要:常用的绘图函数DrawArc绘制一个弧形示例:graphics.DrawArc(pen,0,0,200,200,90,120)倒数第二个参数,表示起始度数,最后一个参数是弧形的跨越度数。比如起始度数是90,跨越度数是120的弧形如下图:红色的是弧形。类似的方法还有DrawPie绘制一个扇形和FillPie填充一个扇形。都有起始度数,跨越度数。DrawPolygon绘制多边形示例: Point []pt=new Point[]{new Point(0,50),new Point(0,100),new Point(100,100)}; graphics.DrawPolygon...
阅读全文
摘要:1、窗体 1、常用属性 (1)Name属性:用来获取或设置窗体的名称,在应用程序中可通过Name属性来引用窗体。 (2) WindowState属性: 用来获取或设置窗体的窗口状态。 取值有三种: Normal (窗体正常显示)、 Minimized(窗体以最小化形式显示)和 Maximized(窗体以最大化形式显示)。 (3)StartPosition属性:用来获取或设置运行时窗体的起始位置。(4)Text属性:该属性是一个字符串属性,用来设置或返回在窗口标题栏中显示的文字。 (5)Width属性:用来获取或设置窗体的宽度。 (6)Height属性:用来获取或设置窗体的高度。 (7)Left
阅读全文
摘要:防止程序运行多个实例的方法有多种,如:通过使用互斥量和进程名等.而我想要实现的是:在程序运行多个实例时激活的是第一个实例,使其获得焦点,并在前端显示.主要用到两个API 函数:ShowWindowAsync 该函数设置由不同线程产生的窗口的显示状态。SetForegroundWindow 该函数将创建指定窗口的线程设置到前台,并且激活该窗口。键盘输入转向该窗口,并为用户改各种可视的记号。系统给创建前台窗口的线程分配的权限稍高于其他线程。代码如下:引用以下命名空间:using System.Runtime.InteropServices;using System.Diagnostics;usin
阅读全文
摘要:private const uint WS_EX_LAYERED = 0x80000; private const int WS_EX_TRANSPARENT = 0x20; private const int GWL_EXSTYLE = (-20); private string Var_genre = "";//记录当前操作的类型 #region 在窗口结构中为指定的窗口设置信息 /// /// 在窗口结构中为指定的窗口设置信息 /// /// 欲为其取得信息...
阅读全文
摘要:c#中通过FileAttributes枚举来设置文件或文件夹的属性。FileAttributes 枚举 成员名称 说明 Archive 文件的存档状态。应用程序使用此属性为文件加上备份或移除标记。 Compressed 文件已压缩。 Device 保留供将来使用。 Directory 文件为一个目录。 Encrypted 该文件或目录是加密的。对于文件来说,表示文件中的所有数据都是加密的。对于目录来说,表示新创建的文件和目录在默认情况下是加密的。 Hidden 文件是隐藏的,因此没有包括在普通的目录列表中。 Normal 文件正常,没有设置其他的属性。此属性仅在单独使用时有效。 ...
阅读全文
摘要:public class INIClass { public string inipath; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section,string key,string val,string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section,string key,s
阅读全文
摘要:#region 无边框窗体随意移动 /// /// 下面这段代码是用来实现窗体随意移动 /// /// protected override void WndProc(ref Message m) { if (m.Msg == 0x0201) { m.Msg = 0x00A1;//更改消息为非客户区按下鼠标 m.LParam = IntPtr.Zero; m...
阅读全文
摘要:Step 1 : Run visual studio command prompt and go to directory where your DLL located. For Example my DLL located inD:/hiren/Test.dllStep 2 : Now createil file using below command.D:/hiren> ildasm /all /out=Test.il Test.dll (this command generate code library)Step 3 : Generate new Key for sign you
阅读全文
摘要:[DllImport("user32.dll", EntryPoint = "FindWindow")] public static extern int FindWindow( string lpClassName, string lpWindowName );[DllImport("user32.dll", EntryPoint = "SendMessage")] public static extern int SendMessage( int hwnd, i...
阅读全文
浙公网安备 33010602011771号