
c#
文章平均质量分 80
a771948524
My name is developer
展开
-
我的优快云(三):怎么禁止别人调用我的程序
我编写的是window应用程序 比如说 编写的程序是AAA.EXE 在E盘学习文件夹中别人想调用我的程序 一般这样写 process.start(@"E:\学习\AAA.exe")我不想让别人调用我的程序 如果别人调用时弹出messageBOX .show("不容许外部程序调用 ");绝不是在主窗口中跳出textbox然后输入密码,密码正确,程序运行 否则close ,我只转载 2013-07-11 20:38:51 · 1274 阅读 · 0 评论 -
C#获取mp3 Tag信息
using System; using System.Collections.Generic; using System.Text; using System.IO; namespace Foxer_Player_1._1 { public struct Mp3Info { public string identify原创 2013-08-21 22:38:02 · 1397 阅读 · 0 评论 -
用C#实现生成PDF文档
using System;using System.IO;using System.Text;using System.Collections;namespace PDFGenerator{ public class PDFGenerator { static float pageWidth = 594.0f; static float原创 2013-08-21 22:25:12 · 1334 阅读 · 0 评论 -
如何用C#把Doc文档转换成rtf格式
先在项目引用里添加上对Microsoft Word 9.0 object library的引用 using System; namespace DocConvert { class DoctoRtf { static void Main() { //创建一个word的实例 Word.application newApp = new Word.Ap原创 2013-08-21 22:19:43 · 2495 阅读 · 0 评论 -
非常简单的语音朗读功能
不知道大家有没有发现,在System.Speech.Synthesis命名空间下有一个SpeechSynthesizer类,它可以指定的文本内容进行语音朗读,而且,这个类用起来也严重简单,简单到什么程度? 试试看。首先,新建一个项目,随便你建什么项目,反正能测试即可。然后,添加对System.Speech程序集的引用,这个不用我教你了,你再菜,只要用VS都不可能不懂这个。引入Syste原创 2013-08-22 08:57:39 · 1826 阅读 · 0 评论 -
用C#编写网页小应用程序(Applet)
学过Java的朋友可能都听说过Java的历史:当初Java是为机顶盒设备和手持设备设计的,可惜理念在当时太朝前,结果没有被人所接受,于是Java的创始人James Gosling想到在网络上碰碰运气,当时吸引大家眼球的就是用Java编写的一个Applet,早期Java的应用很多时用来编写Applet,后来慢慢发展到J2ME/J2SE/J2EE三个分支。现在RIA(Rich Internet转载 2013-08-27 19:53:39 · 1911 阅读 · 0 评论 -
C#项目引用完全相同dll文件的问题解决方法(反射)
今天有开发人员问我一个问题,他的项目中要引用两个类库,这两个类库命名居然完全相同,而且更有戏剧性的是,命名空间以及命名空间下的类也是相同的,并且这两个类库不是一个公司的产品。当对一个dll文件添加引用后,vs就不允许再次添加另一个dll的引用了。 如果两个类库命名完全相同,可以把他们同时保存到GAC是可以的,因为他们的签名文件不同。但是要简单的添加引用是无法办到了。GAC:Globa转载 2013-08-30 10:54:36 · 2147 阅读 · 0 评论 -
C# 开发 Win 7下应用程序所需的管理员身份运行问题
如果程序不是以管理员身份运行,操作本地文件会提示:System.UnauthorizedAccessException异常Vista 和 Windows 7 操作系统为了加强安全,增加了 UAC(用户账户控制) 的机制,如果 UAC 被打开,用户即使是以管理员权限登录,其应用程序默认情况下也无法对系统目录,系统注册表等可能影响系统运行的设置进行写操作。这个机制大大增强了系统转载 2013-09-11 13:07:45 · 1394 阅读 · 0 评论 -
WPF FlowDocument 读取和保存
code:mainwindow.xmal<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/原创 2013-09-11 13:30:33 · 6290 阅读 · 0 评论 -
c# 获取全屏 中鼠标焦点的位置坐标
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;using System.Threading;namespace ConsoleApplication1{ class Program { st原创 2013-09-15 19:26:50 · 2472 阅读 · 0 评论 -
c# 滚动网页截图
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Windo原创 2013-10-01 21:23:47 · 1760 阅读 · 0 评论 -
C#统计文件夹内的文件和隐藏文件
C#统计文件夹内的文件,包括隐藏文件,显示那个隐藏文件...隐藏的..为什么别人要隐藏呢..将程序放在任何文件夹内,点击“当前文件夹”,可以获取文件夹所在的路径,也可以直接输入路径,再点击“显示文件”,就可以看到效果了,下面的状态栏实现统计功能using System;using System.Collections.Generic;using System.Compon转载 2013-08-21 22:51:49 · 1221 阅读 · 0 评论 -
C#读取excel中的数据
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Dat原创 2013-07-26 23:19:51 · 977 阅读 · 0 评论 -
BarCode条形码基于C# GDI+ 的实现.
条形码在生活中的应用非常广泛,具体的条形码知识大家自行百度,了解条形码知识对理解下面的代码是必要的。如果只是应用的话,直接拿去就可以用了。废话不多说,上代码public Bitmap GetCode39(string sourceCode) { int leftMargin = 5; int topMargin = 0;转载 2013-07-12 13:18:30 · 1352 阅读 · 0 评论 -
winform状态栏跑马灯的效果
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;name原创 2013-07-12 13:34:19 · 2417 阅读 · 0 评论 -
C#实现具有Aero效果的窗体
using System.Runtime.InteropServices;//引用,放在哪不用说了吧....[DllImport("dwmapi.dll")]public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarinset);[StructLayout(LayoutKin原创 2013-06-29 14:20:10 · 1969 阅读 · 1 评论 -
c# 实现 圆形的pictureBox1
通过鼠标移动测试圆角外部不受pictureBox1 控制using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using S原创 2013-06-30 17:57:00 · 7386 阅读 · 0 评论 -
C#的true运算符和false运算符重载
从微软官网找到的例子。true false重载 // dbbool.cs using System; public struct DBBool { // The three possible DBBool values: public static readonly DBBool dbNull = new DBBool转载 2013-07-01 10:31:05 · 4095 阅读 · 1 评论 -
ObservableCollection的泛型查找功能
1.使用Any方法查询 //在数组中查找Name和Age为指定条件的项,只要数组中有一项符合即返回true ObservableCollection lstData = new ObservableCollection() { new MyTest(){Name="Limin",Age=32转载 2013-07-16 20:01:35 · 2893 阅读 · 0 评论 -
如何让Label的背景透明(小技巧)
问题很简单不是吗,把Label的BackColor设置成Color.Transparent,然后它就成透明了!表面上看是这样的,但实际上是让它的背景与它的Parent控件的背景一样,这样看上去就是透明的了,实际在它的OnPaintBackGround中,还是完成了一样的绘图工作。而它这个Label在一个图片上时,你会发现它又变得不透明了,它的背景颜色与PictureBox的背景颜色是一样的。原创 2013-07-03 10:17:04 · 13680 阅读 · 0 评论 -
C#根据屏幕大小设置窗体
//根据屏幕大小设置窗体初始大小//Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;Rectangle rect = SystemInformation.WorkingArea;this.Height = rect.Height;this.Width = rect.Width;//根据屏原创 2013-07-03 09:41:55 · 2251 阅读 · 2 评论 -
背景透明的ListBox(C#.WinForm)
不知道大家有没有遇到过这种问题,C#中希望搞一个背景透明的ListBox,且文本居中,却发现VS里面自带的ListBox控件不支持背景透明,怎么办?我们可以做一个自定义控件,重载里面的OnPaint函数,使ListBox支持背景透明 /// /// 实现背景透明的ListBox,且文本居中 /// 编写人:涂剑凯 /// public转载 2013-07-03 09:52:28 · 3407 阅读 · 0 评论 -
c# 读取 xml
1 XiaoA 59 2 XiaoB 29 3 XiaoC 103 4 XiaoD 59 Code:说明都在注释里。 ?public void TestXML(){ XmlDo转载 2013-07-26 09:36:31 · 1023 阅读 · 0 评论 -
ListView Control in C#.Net
A ListView control allows to display a list of items. ListView is very similar to windows explorer. In ListView you can list the items in list view, icon view, detail view.How to use ListView Contro转载 2013-09-19 16:09:30 · 1165 阅读 · 0 评论 -
在C#中加入InputBox
今天写代码时,需要用到VB中InputBox的功能,这才发现C#没有提供这个功能,于是自己动手写了一个。using System;using System.Windows.Forms;using System.Drawing; class InputBox : Form { private Label labelText=new Label()转载 2013-09-23 17:48:42 · 3662 阅读 · 0 评论 -
c# excel导入到sql中
建立一个excel 命名为zxl.xlszxlxxcc111111212112313113414114创建一个数据库文件建立一个表 名为Table3code:using System;using System.Collections.原创 2013-09-23 18:19:19 · 1188 阅读 · 0 评论 -
c# 备份还原 例子 sql
//记得加 folderBrowserDialog1 openFileDialog1 控件using System.Data.SqlClient; //连接数据库 公共变量namespace WindowsApplication1.GoodMenhod{class getSqlConnection{ string sql = "Data Source=win7-pc转载 2013-11-20 10:20:00 · 1061 阅读 · 0 评论 -
c# checkedListBox1控件链接数据库
在数据库中创建三个表: 学生信息表 爱好表 学生爱好表结果让学生的信息和爱好同时显示到C#窗体上面using System;using System.Collections;using System.Collections.Generic;using System.Data;using System.Diagnostics;using System.Data原创 2013-11-23 01:45:19 · 1881 阅读 · 0 评论 -
c# console move string
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) {原创 2013-11-13 18:54:24 · 1396 阅读 · 0 评论 -
c# 操作xml题目
1、新建一个文本文件,命名为:projects.txt。2、将后缀名改为projects.xml。 3、用记事本编辑该文件。使用utf-8编码。内容如下: 项目1 http://baidu.com/ mysql root pwd 2013-01-01 项目2原创 2013-11-14 16:37:57 · 1215 阅读 · 0 评论 -
C# 粘连窗体效果(窗体连动 类似千千静听播放器的)
两个窗体分别是FormMain FormList第1个窗体:FormMain :public partial class FormMain : Form{FormList formlist=null ;public FormMain(){FormMain fm = this; formlist = new FormList(ref fm);//传到第转载 2013-12-20 21:52:46 · 1586 阅读 · 0 评论 -
DateTime类型
DateTime dt = DateTime.Now;dt.ToString();//2005-11-5 13:21:25dt.ToFileTime().ToString();//127756416859912816dt.ToFileTimeUtc().ToString();//127756704859912816dt.ToLocalTime().ToString();//2005-11-原创 2014-01-08 09:57:47 · 1301 阅读 · 0 评论 -
c#一道面试题类
using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){ Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}结果 x=1,y原创 2014-03-28 20:43:04 · 997 阅读 · 0 评论 -
c#操作word VBA简单应用
对word,excel等offfice软件进行操作,是我们大多数人再也熟悉不过的事情了。但是,如何在代码中对这些软件进行操作呢?对不同的软件操作,代码差距会很大吗?为了解决这些问题,VBA技术产生了。 Visual Basic for Applications(VBA)是一种Visual Basic的一种宏语言,主要能用来扩展Windows的应用程式功能,特别是Micros转载 2014-03-28 19:50:33 · 1654 阅读 · 0 评论 -
C#获取相对路径的八种方法
C#获取相对路径1. 获取和设置当前目录的完全限定路径。 string str = System.Environment.CurrentDirectory; Result: C:xxxxxx C#获取相对路径2. 获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。 string str = System.转载 2014-07-23 10:28:19 · 1911 阅读 · 1 评论 -
c# sqlserver操作类
using System;using System.Collections.Generic;using System.Web;using System.Data.OleDb;using System.Data;using System.Data.SqlClient;/// ///SqlConnDb类,适用于Sql数据库操作/// public class SqlConnDb原创 2014-07-08 08:59:33 · 2288 阅读 · 0 评论 -
c#关于委托和事件(一)(介绍的很详细)
引言委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易。它们就像是一道槛儿,过了这个槛的人,觉得真是太容易了,而没有过去的人每次见到委托和事件就觉得心里别(biè)得慌,混身不自在。本文中,我将通过两个范例由浅入深地讲述什么是委托、为什么要使用委托、事件的由来、.Net Framework中的委托和事件、委托和事件对转载 2013-11-15 22:09:40 · 913 阅读 · 0 评论 -
c#关于委托和事件(二)(介绍的很详细)
using System;using System.Collections.Generic;using System.Text;namespace Delegate { // 热水器 public class Heater { private int temperature; public delegate void BoilHandler(int转载 2013-11-15 22:06:01 · 1071 阅读 · 0 评论 -
C#判断是否为数字的两个函数
public static bool IsNum_Positive(String sNum)//判断sNum是否为数字,只能为正数 { int isDec = 0; for (int i = 0; i { if (sNum[i] == '.') isDec++; if ((!cha原创 2013-09-23 18:22:42 · 1654 阅读 · 0 评论 -
c#验证身份证号
using System;using System.Collections.Generic;using System.Text;namespace IDprocess{ class Program { static void Main(string[] args) { Console.Write("请输入身份证号:"原创 2013-09-25 21:06:48 · 1662 阅读 · 0 评论