随笔分类 -  C# Winform

摘要:服务器端:[csharp]view plaincopyprint?usingSystem;usingSystem.Windows.Forms;usingSystem.Net.Sockets;usingSystem.Net;//IPAddress,IPEndPoint(ip和端口)类usingSystem.Threading;usingSystem.Collections.Generic;usingSystem.IO;namespaceMyChatRoomServer{publicpartialclassServer:Form{publicServer(){InitializeComponent 阅读全文
posted @ 2013-08-08 18:30 蓬莱仙羽 阅读(470) 评论(0) 推荐(0)
摘要:ASP.NET+Access一、登入部分主界面 Fm = new 主界面(); string s1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb"; string s2 = "select*from 登录信息表 where 用户名='" + this.ttbName.Text + "' and 密码 ='" + ttbPwd.Text + "'and 身份='" + cbbId.Text + " 阅读全文
posted @ 2013-06-25 20:32 蓬莱仙羽 阅读(422) 评论(0) 推荐(0)
摘要:如何实现语音和朗诵的功能:using System;using System.Windows.Forms;using System.IO;using System.Media;using System.Runtime.InteropServices;namespace 播放TTS{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //根目录 string address = System.AppDomain.CurrentDomain.BaseDirectory; private voi 阅读全文
posted @ 2013-02-24 21:20 蓬莱仙羽 阅读(206) 评论(0) 推荐(0)
摘要:如何添加数据库中的信息加载到树形控件中?如何遍历控件中的信息?如何对控件中的信息进行增删查改?数据库设计:主界面:代码:using System;using System.Collections.Generic;using System.Windows.Forms;using TreeSolution.BLL;using TreeSolution.Model;namespace 树型测试{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //当窗体加载时,加载树形节点 private v 阅读全文
posted @ 2013-02-22 11:33 蓬莱仙羽 阅读(233) 评论(0) 推荐(0)
摘要:Winform特有的功能如何保存当前窗口中所填的信息,方便下次打开 还是这样的,实现如下:首先,在当前项目中打开Properties——Settings.settings,然后点击,添加字段;其次,再点击界面中控件的属性,然后选择ApplicationSettings属性,选Text属性,选择刚刚设置的字段最后,用一个事件来实现数据保存,代码:Settings.Default.Save();实现了需要的功能 阅读全文
posted @ 2013-02-21 16:49 蓬莱仙羽 阅读(353) 评论(0) 推荐(0)
摘要:using System;using System.Windows.Forms;namespace TreeView控件{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { treeView1.Nodes.Clear(); //每一个节点都是一个TreeNode的一个对象 TreeNode nodeChina = new TreeNode(); nodeChina.Text = 阅读全文
posted @ 2013-02-20 22:31 蓬莱仙羽 阅读(147) 评论(0) 推荐(0)
摘要:/// <summary> /// 复合查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCheck_Click(object sender, EventArgs e) { //方法一 //StringBuilder sb = new StringBuilder(); //sb.Append("select * from T_Cus 阅读全文
posted @ 2013-02-20 16:30 蓬莱仙羽 阅读(162) 评论(0) 推荐(0)
摘要:当我们遇到要处理汉字和拼音之间的转化关系怎么办?如和用程序来实现?我搜索到一个ChineseChar开发包,然后实现了这一难题using System;using Microsoft.International.Converters.PinYinConverter;namespace 拼音基础{ class Program { static void Main(string[] args) { #region 判断是否为同音字 ChineseChar chineseChar = new ChineseChar('微'); Console.WriteLine("Stro 阅读全文
posted @ 2013-02-19 14:55 蓬莱仙羽 阅读(210) 评论(0) 推荐(0)
摘要:using System;using System.Windows.Forms;using System.Security.Cryptography;using System.IO;namespace 计算文件的MD5{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //创建与服务器的连接 FtpClient fc = new FtpClient("127.0.0 阅读全文
posted @ 2013-02-17 21:27 蓬莱仙羽 阅读(528) 评论(0) 推荐(0)
摘要:1.通过构造函数特点:传值是单向的(不可以互相传值),实现简单实现代码如下:在窗体Form2中int value1;string value2;public Form2 ( int value1 , string value2 ){ InitializeComponent ( ); this.value1 = value1; this.value2 = value2;}在窗体Form1中这样调用new Form2 ( 111 , "222" ).Show ( ); //这样就把111,"222",这2个值传送给了Form22.通过静态变量特点:传值是双向 阅读全文
posted @ 2013-01-27 21:52 蓬莱仙羽 阅读(151) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;namespace SocketTest{ class Program { static void Main(string[] args) { int length; byte[] bytes = new byte[1024]; //创建一个Socket对象 Socket socketSend = new Socket(AddressFamily.I 阅读全文
posted @ 2012-10-13 16:58 蓬莱仙羽 阅读(173) 评论(0) 推荐(0)
摘要:对话框中我们常用了以下几种:1、文件对话框(FileDialog)它又常用到两个: 打开文件对话框(OpenFileDialog) 保存文件对话(SaveFileDialog)2、字体对话框(FontDialog)3、颜色对话框(ColorDialog)4、打印预浏对话框(PrintPreviewDialog)5、页面设置(PrintDialog)6、打印对话框(PrintDialog) 还有更多,有时间的网友可以看看MSDN。下面我们一个个来介绍。在介绍的过程中我用到了一个自己开发的类:File,主要是文件操作的。 文件对话框(FileDialog) 一、打开文件对话框(Ope... 阅读全文
posted @ 2012-07-12 16:42 蓬莱仙羽 阅读(220) 评论(0) 推荐(0)