登录
首页 » C# » C# winform DES加密解密

C# winform DES加密解密

于 2014-09-23 发布
0 114
下载积分: 1 下载次数: 0

代码说明:

C# winform DES加密解密

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • NPOI 项目使示例源码下载
    NPOI 项目使用示例源码下载
    2013-09-29下载
    积分:1
  • C# 获取指定目录下(含子文件夹)指定后缀的所有文件路径 示例源码下载
    调用示例:FileAccess fa = new FileAccess();System.Collections.ArrayList filesPath = fa.GetAllFileName(@"C:inetpubwwwrootwww_baidu002_com",".html");
    2013-11-06下载
    积分:1
  • C# 报表组件设计
    本例说明一种报表组件的实现方法。原理:将各个表格元素,以图像的方式设置、添加到纸张画布上,生成图像,打印图像。功能:1、支持SQL Serrver、Access数据库,如需其他数据库,也可很方便的添加到代码中,自动获取数据表,在元素中可选择添加字段到报表中;2、报表元素可自由拖放、设置大小、内容、字体、字体样式等(元素非PictureBox组件);3、支持全程的“撤销”、“重做”;4、可保存、读取报表文件;5、预览、打印没加上去,原理就是根据元素生成一幅或多幅图像,再输出到打印机,自行修改添加。这里说明一下,这只是个规划草稿,只是描述了一种报表组件的设计方式,所以代码写的较为繁琐、冗余,代码无委托线程等,所以比较容易看明白。 /// /// 剪切复制粘贴组件操作 /// public class OperationObject { public bool isData { get; set; } // 是否有剪切复制粘贴数据 public Rectangle Region { get; set; } // 大小范围 public bool IsDragging { get; set; } // 能否拖动 public Point DraggingPoint { get; set; } // 组件拖动位置 public Bitmap Setimage { get; set; } // 组件图像 public int SetType { get; set; } // 组件类型 public bool isContent { get; set; } // 组件内是否有内容 public int Field_BandType { get; set; } // 栏目类型 public Bitmap Field_Img { get; set; } // 图像组件的图像 public string Field_Text { get; set; } // 文字 public string Field_TextFont { get; set; } // 字体 public int Field_TextFontSize { get; set; } // 字体大小 public FontStyle Field_TextFontStyle { get; set; } // 文字样式 public string Field_Align { get; set; } // 对齐方式 public int Field_ImgZoom { get; set; } // 图像缩放 public bool[] Field_BoxLine { get; set; } // 边框和斜线 public int Field_Shape { get; set; } // 形状的类型 } public static OperationObject operationObject; /// /// 组件操作记录 /// public class RecordObject { public int Num; // 序号 public Rectangle Region; // 大小范围 public bool IsDragging; // 能否拖动 public Point DraggingPoint; // 组件拖动位置 public Bitmap Setimage; // 组件图像 public int SetType; // 组件类型 public bool isContent; // 组件内是否有内容 public int Field_BandType; // 栏目类型 public Bitmap Field_Img; // 图像组件的图像 public string Field_Text; // 文字 public string Field_TextFont; // 字体 public int Field_TextFontSize; // 字体大小 public FontStyle Field_TextFontStyle; // 文字样式 public string Field_Align; // 对齐方式 public int Field_ImgZoom; // 图像缩放 public bool[] Field_BoxLine; // 边框和斜线 public int Field_Shape; // 形状的类型 public RecordObject( int _Num,Rectangle _Region, bool _IsDragging, Point _DraggingPoint, Bitmap _Setimage, int _SetType, bool _isContent, int f_BandType, Bitmap f_Img, string f_Text, string f_TextFont, int f_TextFontSize, FontStyle f_TextFontStyle, string f_Align, int f_ImgZoom, bool[] f_BoxLine, int f_Shape) { Num = _Num; Region = _Region; IsDragging = _IsDragging; DraggingPoint = _DraggingPoint; Setimage = _Setimage; SetType = _SetType; isContent = _isContent; Field_BandType = f_BandType; Field_Img = f_Img; Field_Text = f_Text; Field_TextFont = f_TextFont; Field_TextFontSize = f_TextFontSize; Field_TextFontStyle = f_TextFontStyle; Field_Align = f_Align; Field_ImgZoom = f_ImgZoom; Field_BoxLine = f_BoxLine; Field_Shape = f_Shape; } } public static List recordObject; /// /// 组件移动 /// public abstract class ADraggableGDIObject { public abstract Rectangle Region { get; set; } // 大小范围 public abstract bool IsDragging { get; set; } // 能否拖动 public abstract Point DraggingPoint { get; set; } // 组件拖动位置 public abstract Bitmap Setimage { get; set; } // 组件图像 public abstract int SetType { get; set; } // 组件类型 public abstract void OnPaint(PaintEventArgs e); // 重绘 public abstract bool isContent { get; set; } // 组件内是否有内容 public abstract int Field_BandType { get; set; } // 栏目类型 public abstract Bitmap Field_Img { get; set; } // 图像组件的图像 public abstract string Field_Text { get; set; } // 文字 public abstract string Field_TextFont { get; set; } // 字体 public abstract int Field_TextFontSize { get; set; } // 字体大小 public abstract FontStyle Field_TextFontStyle { get; set; } // 文字样式 public abstract string Field_Align { get; set; } // 对齐方式 public abstract int Field_ImgZoom { get; set; } // 图像缩放 public abstract bool[] Field_BoxLine { get; set; } // 边框和斜线 public abstract int Field_Shape { get; set; } // 形状的类型 } /// /// 组件移动对象定义 /// public class Draggable : ADraggableGDIObject { private bool m_IsDragging; // 能否拖动 private Point m_DraggingPoint; // 组件拖动位置 private Rectangle m_Region; // 大小范围 private Bitmap m_image; // 组件图像 private int m_controlType; // 组件类型 private bool m_isContent; // 组件内是否有内容 private int f_BandType; // 栏目类型 private Bitmap f_Img; // 图像组件的图像 private string f_Text; // 文字 private string f_TextFont; // 字体 private int f_TextFontSize; // 字体大小 private FontStyle f_TextFontStyle; // 文字样式 private string f_Align; // 对齐方式 private int f_ImgZoom; // 图像缩放 private bool[] f_BoxLine = new bool[8] { false, false, false, false, false, false, false, false }; // 边框和斜线 private int f_Shape; // 形状的类型 public Draggable(int startx, int starty, int _settype) { m_Region = new Rectangle(startx, starty, 51, 51); m_controlType = _settype; m_isContent = false; } public override int SetType { get { return m_controlType; } set { m_controlType = value; } } public override Rectangle Region { get { return m_Region; } set { m_Region = value; } } public override Bitmap Setimage { get { return m_image; } set { m_image = value; } } public override void OnPaint(PaintEventArgs e) { e.Graphics.DrawImage(m_image, m_Region); } public override bool IsDragging { get { return m_IsDragging; } set { m_IsDragging = value; } } public override Point DraggingPoint { get { return m_DraggingPoint; } set { m_DraggingPoint = value; } } public override bool isContent { get { return m_isContent; } set { m_isContent = value; } } public override int Field_BandType { get { return f_BandType; } set { f_BandType = value; } } public override Bitmap Field_Img { get { return f_Img; } set { f_Img = value; } } public override string Field_Text { get { return f_Text; } set { f_Text = value; } } public override string Field_TextFont { get { return f_TextFont; } set { f_TextFont = value; } } public override int Field_TextFontSize { get { return f_TextFontSize; } set { f_TextFontSize = value; } } public override FontStyle Field_TextFontStyle { get { return f_TextFontStyle; } set { f_TextFontStyle = value; } } public override string Field_Align { get { return f_Align; } set { f_Align = value; } } public override int Field_ImgZoom { get { return f_ImgZoom; } set { f_ImgZoom = value; } } public override bool[] Field_BoxLine { get { return f_BoxLine; } set { f_BoxLine = value; } } public override int Field_Shape { get { return f_Shape; } set { f_Shape = value; } } } public static List m_DraggableGDIObjects; /// /// 序列化保存读取组件 /// [Serializable] public class SerializerObject { public string Data_Type; // 数据库类型 public string Data_DataName; //数据库名 public string Data_Table; // 数据表 public string Data_UserName; //用户名 public string Data_Password; // 密码 public string Data_ConnectionIP; // 地址 public string Page_TypeFace; public int Page_Direction; public int[] Page_Margin; public int controlNum; public Rectangle Region; // 大小范围 public bool IsDragging; // 能否拖动 public Point DraggingPoint; // 组件拖动位置 public Bitmap Setimage; // 组件图像 public int SetType; // 组件类型 public bool isContent; // 组件内是否有内容 public int Field_BandType; // 栏目类型 public Bitmap Field_Img; // 图像组件的图像 public string Field_Text; // 文字 public string Field_TextFont; // 字体 public int Field_TextFontSize; // 字体大小 public FontStyle Field_TextFontStyle; // 文字样式 public string Field_Align; // 对齐方式 public int Field_ImgZoom; // 图像缩放 public bool[] Field_BoxLine; // 边框和斜线 public int Field_Shape; // 形状的类型 public bool[] Band_Flag; // 栏目只出现一次 public SerializerObject( string _DataType, string _DataName,string _DataTable, string _DataUserName, string _DataPassword, string _DataConnectionIP, string _TypeFace, int _Direction, int[] _Margin, int _Num, Rectangle _Region, bool _IsDragging, Point _DraggingPoint, Bitmap _Setimage, int _SetType, bool _isContent, int f_BandType, Bitmap f_Img, string f_Text, string f_TextFont, int f_TextFontSize, FontStyle f_TextFontStyle, string f_Align, int f_ImgZoom, bool[] f_BoxLine, int f_Shape, bool[] _BandFlag) { Data_Type = _DataType; Data_DataName = _DataName; Data_Table = _DataTable; Data_UserName = _DataUserName; Data_Password = _DataPassword; Data_ConnectionIP = _DataConnectionIP; Page_TypeFace = _TypeFace; Page_Direction = _Direction; Page_Margin = _Margin; controlNum = _Num; Region = _Region; IsDragging = _IsDragging; DraggingPoint = _DraggingPoint; Setimage = _Setimage; SetType = _SetType; isContent = _isContent; Field_BandType = f_BandType; Field_Img = f_Img; Field_Text = f_Text; Field_TextFont = f_TextFont; Field_TextFontSize = f_TextFontSize; Field_TextFontStyle = f_TextFontStyle; Field_Align = f_Align; Field_ImgZoom = f_ImgZoom; Field_BoxLine = f_BoxLine; Field_Shape = f_Shape; Band_Flag = _BandFlag; } } public static List serializerObject = new List(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public static bool Change_Flag = false; // 是否改变了组件 /*窗体定义*/ public static Point screen_Location; // 窗体位置 public static Size screen_Size; //窗体大小 public static bool setFont_Flag = false; // 选择字体窗口打开标志 public static bool setFontSize_Flag = false; // 选择字体大小窗口打开标志 public static bool setDate_Flag = false; // 选择日期窗口打开标志 public static bool setPageCode_Flag = false; // 选择页码窗口打开标志 /*数据库*/ public static string Data_Type = ""; // 数据库类型 public static string Data_DataName = ""; // 数据库名 public static string Data_Table = ""; // 数据表 public static string Data_UserName = ""; //用户名 public static string Data_Password = ""; // 密码 public static string Data_ConnectionIP = ""; // 地址 /*组件区域位置*/ public static PointF[] CursorArea = new PointF[8]; // 鼠标区域 public static Font LabelFont = new Font("微软雅黑", 9, FontStyle.Regular); // label 字体设置 public static bool ShowLine = true; // 是否显示组件标线 /*设计页面*/ public static string Page_TypeFace = "A4"; // 纸张类型 public static int Page_Direction = 0; // 纸张方向 public static Size[] Page_Area = new Size[2] { new Size(789,1136), new Size(1136,789) }; // 横向、纵向纸张大小 public static int[] Page_Margin = new int[4] { 0,0,0,0 }; // 纸张边距 public static PanelEx pageDesing; // 设计框 public static PanelEx pageContainer; // 页面容器 public static PanelEx A4_PageType; // 页面 public static bool controlPlace = false; // 能否放置组件 public static int controlType = -1; // 组件类型 public static int control_Num = -1; // 组件序号 public static int oper_Record = -1; // 操作动作序号 /*底部状态信息栏*/ public static PanelEx statePanel; public static PanelEx[] control_Input = new PanelEx[8]; /*选择形状、栏目标志*/ public static int Select_Shape = 0; public static int Select_Band = 0; public static bool[] Band_Flag = new bool[3] { false,false,false}; // 栏目只出现一次
    2018-09-13下载
    积分:1
  • asp.net mvc ajax get读取服务器数据 ,post检测户名 实例讲解下载
    asp.net mvc ajax 读取服务器两种方式实例以及 ajax post方式检测用户名是否可用实例
    2013-01-01下载
    积分:1
  • c# 读取配置文件例子源码(适合各种config 以及自定义配置)
    适合各种config 以及自定义配置
    2015-03-07下载
    积分:1
  • C#获取本地磁盘目录源代码
    获取本地盘符目录实例
    2013-01-21下载
    积分:1
  • 类似系统文件拖拽的半透明效果
     c#拖拽的时候鼠标效果是很丑陋的,使用这个DEMO,能够实现与拖拽系统文件的一样的半透明效果。代码很详细。
    2014-12-02下载
    积分:1
  • winform DataGridViewRowStyle 实例源码下载 有图
    DataGridViewRowStyle  核心用法 截图: 核心代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace TestDataGridViewRowStyle{ public partial class Form1 : Form { //定义两种行样式 private DataGridViewCellStyle m_RowStyleNormal; private DataGridViewCellStyle m_RowStyleAlternate; //成绩单DataTable private DataTable m_GradeTable; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.dgvGrade.AutoGenerateColumns = false; this.SetRowStyle(); this.BindData(); } /// /// 设置行样式 /// private void SetRowStyle() { //可根据需要设置更多样式属性,如字体、对齐、前景色、背景色等 this.m_RowStyleNormal = new DataGridViewCellStyle(); this.m_RowStyleNormal.BackColor = Color.LightBlue; this.m_RowStyleNormal.SelectionBackColor = Color.LightSteelBlue; this.m_RowStyleAlternate = new DataGridViewCellStyle(); this.m_RowStyleAlternate.BackColor = Color.LightGray; this.m_RowStyleAlternate.SelectionBackColor = Color.LightSlateGray; } /// /// 绑定数据 /// private void BindData() { //建立一个DataTable并填充数据,然后绑定到DataGridView控件上 m_GradeTable = new DataTable(); m_GradeTable.Columns.Add("Class", typeof(string)); m_GradeTable.Columns.Add("Name", typeof(string)); m_GradeTable.Columns.Add("Grade", typeof(int)); m_GradeTable.Rows.Add(new string[] { "Class1", "Jim", "89" }); m_GradeTable.Rows.Add(new string[] { "Class1", "Jack", "77" }); m_GradeTable.Rows.Add(new string[] { "Class1", "Bill", "91" }); m_GradeTable.Rows.Add(new string[] { "Class2", "Tom", "58" }); m_GradeTable.Rows.Add(new string[] { "Class2", "Rose", "95" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Peter", "64" }); m_GradeTable.Rows.Add(new string[] { "Class3", "David", "82" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Eric", "68" }); m_GradeTable.Rows.Add(new string[] { "Class3", "Lily", "79" }); this.bdsGrade.DataSource = m_GradeTable; } private void dgvDataTable_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { //在此对行样式进行设置 if (e.ColumnIndex == this.dgvGrade.Columns["ColumnClass"].Index)//根据班级设置行样式 { DataGridViewRow CurrentRow = this.dgvGrade.Rows[e.RowIndex]; CurrentRow.HeaderCell.Value = Convert.ToString(e.RowIndex 1);//显示行号,也可以设置成显示其他信息 //CurrentRow.HeaderCell.ToolTipText = "当前第" Convert.ToString(e.RowIndex 1) "行";//设置ToolTip信息 //以下为根据上一行内容判断所属组的效果 if (e.RowIndex == 0)//首行必须特殊处理,将其设置为常规样式 { CurrentRow.DefaultCellStyle = this.m_RowStyleNormal; } else { //判断和上一行是否属于同一个班级,如果是则设置相同样式,否则设置另一种样式 //需要定义两个DataGridViewCellStyle,用于交替显示,也可以根据需要隐藏一些和上一行重复的信息 //这里当两行是同一个班级时,将下一行的班级信息隐藏掉,选中时则显示班级信息 if (CurrentRow.Cells[e.ColumnIndex].Value != DBNull.Value && CurrentRow.Cells[e.ColumnIndex].Value != null && CurrentRow.Cells[e.ColumnIndex].Value.ToString() == this.dgvGrade.Rows[e.RowIndex - 1].Cells[e.ColumnIndex].Value.ToString()) { CurrentRow.DefaultCellStyle = this.dgvGrade.Rows[e.RowIndex - 1].DefaultCellStyle;//设置和上一行的样式相同 CurrentRow.Cells[e.ColumnIndex].Style.ForeColor = CurrentRow.DefaultCellStyle.BackColor;//用前景色隐藏信息 //如果需要选中时显示完整信息则注释该下面一行 //CurrentRow.Cells[e.ColumnIndex].Style.SelectionForeColor = CurrentRow.DefaultCellStyle.SelectionBackColor;//选中时也使前景色等于背景色,将文字隐藏掉 } else//当前行和上一行不属于同一个班级时 { if (this.dgvGrade.Rows[e.RowIndex - 1].DefaultCellStyle == this.m_RowStyleNormal)//根据上一行的样式设置当前行的样式 CurrentRow.DefaultCellStyle = this.m_RowStyleAlternate; else CurrentRow.DefaultCellStyle = this.m_RowStyleNormal; } }//if(e.RowIndex == 0) } else if (e.ColumnIndex == this.dgvGrade.Columns["ColumnGrade"].Index)//根据成绩设置单元格样式 { if (this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != DBNull.Value && Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) < 60)//对不及格的成绩设置特殊样式 { this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Red;//设置小于60的数字显示为红色 this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.SelectionForeColor = Color.Red; this.dgvGrade.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.Alignment = DataGridViewContentAlignment.MiddleRight; } } } //根据内容设置行标头 private void dgvDataTable_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { if (this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value == DBNull.Value) return; int intGrade = Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value);//获取成绩 Image RowIcon;//标头图标 string strToolTip;//提示信息 if (intGrade >= 90) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeA;//从资源文件中获取图片 strToolTip = "Grade A"; } else if (intGrade >= 80) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeB; strToolTip = "Grade B"; } else if (intGrade >= 70) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeC; strToolTip = "Grade C"; } else if (intGrade >= 60) { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeD; strToolTip = "Grade D"; } else { RowIcon = TestDataGridViewRowStyle.Properties.Resources.GradeF; strToolTip = "Grade F"; } e.Graphics.DrawImage(RowIcon, e.RowBounds.Left this.dgvGrade.RowHeadersWidth - 20, e.RowBounds.Top 4, 16, 16);//绘制图标 this.dgvGrade.Rows[e.RowIndex].HeaderCell.ToolTipText = strToolTip;//设置提示信息 } private void dgvGrade_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.RowIndex >=0 && e.ColumnIndex == 2) { if (this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value == DBNull.Value) return; int intGrade = Convert.ToInt32(this.dgvGrade.Rows[e.RowIndex].Cells["ColumnGrade"].Value); Image img; if (intGrade >= 90) { img = TestDataGridViewRowStyle.Properties.Resources.high; } else if (intGrade >= 80) { img = TestDataGridViewRowStyle.Properties.Resources.arrow; } else if (intGrade >= 70) { img = TestDataGridViewRowStyle.Properties.Resources.up; } else if (intGrade >= 60) { img = TestDataGridViewRowStyle.Properties.Resources.down; } else { img = TestDataGridViewRowStyle.Properties.Resources.low; } Rectangle newRect = new Rectangle(e.CellBounds.X 3, e.CellBounds.Y 5, e.CellBounds.Height - 15, e.CellBounds.Height - 12); using (Brush gridBrush = new SolidBrush(this.dgvGrade.GridColor), backColorBrush = new SolidBrush(e.CellStyle.BackColor)) { using (Pen gridLinePen = new Pen(gridBrush, 2)) { // Erase the cell. e.Graphics.FillRectangle(backColorBrush, e.CellBounds); //划线 Point p1 = new Point(e.CellBounds.Left e.CellBounds.Width, e.CellBounds.Top); Point p2 = new Point(e.CellBounds.Left e.CellBounds.Width, e.CellBounds.Top e.CellBounds.Height); Point p3 = new Point(e.CellBounds.Left, e.CellBounds.Top e.CellBounds.Height); Point[] ps = new Point[] { p1, p2, p3 }; e.Graphics.DrawLines(gridLinePen, ps); //画图标 e.Graphics.DrawImage(img, newRect); //画字符串 e.Graphics.DrawString(intGrade.ToString(), e.CellStyle.Font, Brushes.Crimson, e.CellBounds.Left 20, e.CellBounds.Top 5, StringFormat.GenericDefault); e.Handled = true; } } } } }}
    2014-08-29下载
    积分:1
  • winform身份证号批量生成器
    winform身份证号批量生成器
    2015-01-24下载
    积分:1
  • Asp.Net 实现与 Ucenter通信,整合后可实现账号同步登陆、登出
    Asp.Net 实现与 Ucenter通信,整合后可实现账号同步登陆、登出
    2014-04-03下载
    积分:1
  • 696518资源总数
  • 105547会员总数
  • 4今日下载