Time of Update: 2018-12-08
複製代碼 代碼如下: [DllImport("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] static extern IntPtr FindWindowEx(
Time of Update: 2018-12-08
複製代碼 代碼如下: private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { using (FileStream fs = File.OpenRead(openFileDialog1.FileName)) {
Time of Update: 2018-12-08
本篇純屬娛樂,源於整理代碼,發現還曾實現過遍曆二叉樹。雖然.NET/C#中的各種集合類已經實現了最優的排序設計,但瞭解基本的演算法實現有助於軟體開發中的各種權衡和選擇。比如,如果你實現過B+樹排序和尋找,並將樹節點序列化至二進位檔案塊,則你應該已經瞭解了各種資料庫索引的基本設計。什麼是二叉樹?http://en.wikipedia.org/wiki/Binary_tree二叉樹節點類定義複製代碼 代碼如下:View Code /// <summary> /// 二叉樹節點
Time of Update: 2018-12-08
程式碼如下:複製代碼 代碼如下:// BubbleSort.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <cmath>#include <iostream>using namespace std;#define MAXNUM 20template<typename T>void Swap(T& a, T& b){ int t = a; a = b; b =
Time of Update: 2018-12-08
目錄Emit異常處理流程 顯示Exception對象的Message屬性 返回目錄 Emit異常處理流程來看這種C#異常處理代碼:複製代碼 代碼如下: static void doo(Exception e) { try { throw e; } catch (ApplicationException ex) {
Time of Update: 2018-12-08
C#中如何合理的釋放非託管記憶體?在本文中我們將講解使用IDisposable釋放託管記憶體和非託管記憶體。 A.首先需要讓類實現IDisposable介面,然後實現IDispose方法。 A.a核心Disponse(bool
Time of Update: 2018-12-08
複製代碼 代碼如下:protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.List(); }} protected void Button1_Click(object sender, EventArgs e) { if (TextBox2.Text == "") {
Time of Update: 2018-12-08
複製代碼 代碼如下:/// <summary>/// 固定長度的隨機字串/// </summary>/// <param name="length">長度</param>/// <returns>隨機串</returns>public static String getRandStringEx(int length){char[] charList = {'0','1','2','3','4','5','6','7','8'
Time of Update: 2018-12-08
http://stevenkobes.com/ctest.html在這個網站上發現一套很有趣的C語言測試題,如果你招聘C語言相關開發人員,或者正在學習C語言,很值得做一做。如果沒有做,下面內容暫時不要看,最好自己先完成一遍。OK,假設你做的答案沒有完全正確,那你可以繼續看下去了,否則,後面內容對你來說就是小菜一碟,不值得看。第一題:#include <setjmp.h>static jmp_buf buf;int main(void){volatile int b = 3;if
Time of Update: 2018-12-08
下面列出的特性未必奇怪,有的算是有趣。1)a[2] 等價於 2[a]"aabbccdd"[5] 等價於 5["aabbccdd"]這條特性可以用於使用數組、指標、字串,但不能用在變數定義時。K&R C Programming language
Time of Update: 2018-12-08
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;#region #endregionnamespace Find{ public partial class
Time of Update: 2018-12-08
複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace StreamReadWrite{ class Program { static void Main(string[] args) { // Get the directories currently
Time of Update: 2018-12-08
複製代碼 代碼如下: public void CutToF(Stream stream) { Image initImage = Image.FromStream(stream, true); if (initImage.Width <= 480 && initImage.Height <= 480) {
Time of Update: 2018-12-08
複製代碼 代碼如下:// Create a handler for a click event.button1.Click += delegate(System.Object o, System.EventArgs e) { System.Windows.Forms.MessageBox.Show("Click!"); };// Create a delegate.delegate void Del(int x);// Instantiate the
Time of Update: 2018-12-08
複製代碼 代碼如下: /// <summary> /// 合并GridView中某列相同資訊的行(儲存格) /// </summary> /// <param name="GridView1"></param> /// <param name="cellNum"></param> public static void GroupCol(GridView GridView1, int
Time of Update: 2018-12-08
view plaincopy to clipboardprint?複製代碼 代碼如下://手動儲存圖片 private void saveBtn_Click(object sender, System.EventArgs e) { bool isSave = true; SaveFileDialog saveImageDialog = new SaveFileDialog();
Time of Update: 2018-12-08
複製代碼 代碼如下:public static IPAddress GetHostIP(){ IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); IPAddress ip = ipe.AddressList[0]; return ip;}private String GetIPAddress(){ String str;
Time of Update: 2018-12-08
複製代碼 代碼如下:#include<stdio.h>#include<windows.h>void FindFile(char* ,char* );int count=0;//統計檔案數char fname[32];#define BUFSIZE 256int main(int argc,char* argv[]){ char szLogicalDriveStrings[BUFSIZE]; DWORD iLength; int iSub;
Time of Update: 2018-12-08
源碼:複製代碼 代碼如下:[StructLayout(LayoutKind.Explicit)] public struct IP { public IP(UInt32 value) { this._text1 = 0; this._text2 = 0; this._text3 = 0; this._text4 = 0; this._value = value; } public
Time of Update: 2018-12-08
主表單代碼如下:複製代碼 代碼如下:public partial class PrintFileForm : Form { public PrintFileForm() { InitializeComponent(); PrintFile prinFile = new PrintFile(); prinFile.Print(); } }列印檔案類如下:複製代碼