文章分类 - WinFrom技术
摘要:最近需要使用C#的DES解密工具类解密字符串,但是要解密的字符串是使用java进行DES加密的,去网上查了关于C#和java关于DES加密解密的资料,发现可以相互加密解密的时候,java进行DES加密一般都会写成如下:public static byte[] encrypt(String message, String key) throws Exception { Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); DESKeySpec desKeySpec = new DESKeySpec(key.ge
阅读全文
摘要:涉及到数据库的编程,经常需要在listview与datatable之间传递数据 sinug System; sinug System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using System.Data.OleDb; using System.Windows.Forms; using System.Drawing; namespace ListViewFill { class ListViewFill { //fill...
阅读全文
摘要:Winform窗口中,控件listview是无法设置行高的,没行之间排得密密麻麻的,很挤,效果很不好! 具体如何设置它的行高呢? 咱们可以加入一个imagelist(图片列表控件)来 撑大 行,实现行高的设置! #region 用图片填充ListView高度ImageList imgList = new ImageList();imgList.ImageSize = new Size(1, 25);//分别是宽和高ProlistView.SmallImageList = imgList; //这里设置listView的SmallImageList ,用imgList将其撑大。#e...
阅读全文
摘要:在写程序时有时会遇到新建一个窗口,填写某些 信息后再刷新原窗口。比如再新窗口添加新管理员,点击确定提交后再刷新原始窗口的管理员列表。听起来貌似是很简单,只要再调用一下绑定管理员列表的函数就 可以了,但在新窗口调用那个函数是不行的,但是用传递委托的方法可以,具体原因不明……,请高手赐教。代码如下:原始窗体:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Tex
阅读全文
摘要:有关LocalReport、DeviceInfo和PrintDocument的内容已经介绍得差不多了,稍后会给出一个继承自 System.Drawing.Printing.PrintDocument的组件EMFStreamPrintDocument。但是现在,来看一下 如何进行自定义纸张票据打印时的页面设置。页面设置窗体如下图所示: 当然还是使用Win32 API,以下是我封装的一个关于打印机控制的类[以前用VB实现过比这个类还要多的关于打印机控制的功能,但是在C#中感到还是挺困难的,所以这次只给出 了够用的功能:获取当前指定打印机的状态、删除已经存在的自定义纸张、指定的打印机设置以mm为单.
阅读全文
摘要:【引言】项目中经常使用DataTable,发现有好多东西,需要整理下.protected void Page_Load(object sender, EventArgs e) { //①Create a DataTable DataTable dt = new DataTable("Table_AX"); //②Add columns for DataTable //Method 1 dt.Columns.Add("column0", System.Type.GetType("System.String")); ...
阅读全文
摘要:其实很简单用 ThreadPool.RegisterWaitForSingleObject方法注册一个定时检查线程池的方法,在检查线程的方法内调用 ThreadPool.GetAvailableThreads与ThreadPool.GetMaxThreads并比较两个方法返回的值是不是相等, 相等表示线池内所有的线程已经完成.//每秒检次一次线程池的状态RegisteredWaitHandle rhw = ThreadPool.RegisterWaitForSingleObject(AutoResetEvent(false), this.CheckThreadPool, null, 1000,
阅读全文

浙公网安备 33010602011771号