2013年8月23日
摘要: 这个是子窗体的代码: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 WindowsFormsApplication1{ public partial class MyDialog : Form { public event EventHandler ... 阅读全文
posted @ 2013-08-23 10:21 雪山飞石 阅读(181) 评论(0) 推荐(0) 编辑
摘要: VS2012中对C#的支持度非常好,不管是编写方便程度(不需要插件就能高亮代码及代码自动提示功能),还对MFC的一些功能优化很多。我们可以修改两个工程文件来把VS2012的工程文件移植到VS2010中去。1、修改解决方案文件(.sln文件)。使用记事本打开,把里面的Microsoft Visual Studio Solution File, Format Version 12.00# Visual Studio 2012改成Microsoft Visual Studio Solution File, Format Version 11.00# Visual Studio 20102、修改工程文 阅读全文
posted @ 2013-08-23 09:38 雪山飞石 阅读(1075) 评论(1) 推荐(0) 编辑
  2013年8月21日
摘要: 登录查询语句最好不要用连接字符串查询,防止sql注入。1‘or’1‘=’1stringusername="admin";stringpassword="123";stringstr="连接字符串";using(sqlconnectioncnn=newsqlconnection(str)){using(sqlcommandcmd=cnn.createcommand()){cmd.commandtext="selectcount(*)fromloginwhereusername='"+username+&quo 阅读全文
posted @ 2013-08-21 15:43 雪山飞石 阅读(362) 评论(0) 推荐(1) 编辑
摘要: 对于button的ItemShortcut属性。 阅读全文
posted @ 2013-08-21 14:11 雪山飞石 阅读(163) 评论(0) 推荐(0) 编辑
摘要: XtraGrid的关键类就是:GridControl和GridView。GridControl本身不显示数据,数据都是显示在GridView/CardView/XXXXView中。GridControl是各种View的容器。所以要控制显示,要从GridView这些类入手。关于GridControl与GridView的关系,我不说了。下面给出一段代码。实际使用中常用到。public Form2(){InitializeComponent();//不显示内置的导航条。gc1.UseEmbeddedNavigator = false;//不显示分组的面板gv1.OptionsView.ShowGro 阅读全文
posted @ 2013-08-21 10:14 雪山飞石 阅读(1106) 评论(0) 推荐(0) 编辑
  2013年8月19日
摘要: //C# 图片与byte[]之间以及byte[]与string之间的转换 using System; using System.IO; using System.Drawing; using System.Windows.Forms; using System.Drawing.Imaging; public class ImageConvert { //主要通过Stream作为中间桥梁 public static Image ByteArrayToImage(byte[] iamgebytes) { MemoryStream ms = new MemoryStream(iamgebytes); 阅读全文
posted @ 2013-08-19 17:23 雪山飞石 阅读(946) 评论(0) 推荐(0) 编辑
摘要: private void layoutView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) { Hashtable Images = new Hashtable(); if (e.Column.FieldName == "Image" && e.IsGetData) { DevExpress.XtraGrid.Views.Grid... 阅读全文
posted @ 2013-08-19 15:36 雪山飞石 阅读(222) 评论(0) 推荐(0) 编辑