<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>聰明的生活2 &#187; VisualStudio</title>
	<atom:link href="http://blog.yslifes.com/archives/category/program/visualstudio/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yslifes.com</link>
	<description>自己寫java程式的一些筆記</description>
	<lastBuildDate>Wed, 08 Feb 2012 02:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.yslifes.com/?pushpress=hub'/>
		<item>
		<title>CSharp Windows Form 使用圓邊EdgeRounding</title>
		<link>http://blog.yslifes.com/archives/973</link>
		<comments>http://blog.yslifes.com/archives/973#comments</comments>
		<pubDate>Mon, 31 Oct 2011 14:12:04 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/973</guid>
		<description><![CDATA[Windows Form的屬性設定裡並無法直接設定成圓邊，如果需要在FormBoderStyle為none的狀態下讓Form以圓邊的狀態下顯示，如下圖： 只需要把Form的可視範圍畫出成圓邊的路徑就可以了，其它元件也可以那麼做，只是當元件被重畫時，需要重新Repaint圓邊的範圍。 GraphicsPath graphicpath = new GraphicsPath&#40;&#41;; graphicpath.StartFigure&#40;&#41;; graphicpath.AddArc&#40;0, 0, 25, 25, 180, 90&#41;; graphicpath.AddLine&#40;25, 0, this.Width - 25, 0&#41;; graphicpath.AddArc&#40;this.Width - 25, 0, 25, 25, 270, 90&#41;; graphicpath.AddLine&#40;this.Width, 25, this.Width, this.Height - 25&#41;; graphicpath.AddArc&#40;this.Width - 25, this.Height - 25, 25, 25, 0, 90&#41;; graphicpath.AddLine&#40;this.Width - 25, this.Height, 25, this.Height&#41;; graphicpath.AddArc&#40;0, this.Height - 25, [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/973/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Csharp使用ADO.NET操作SQLite</title>
		<link>http://blog.yslifes.com/archives/972</link>
		<comments>http://blog.yslifes.com/archives/972#comments</comments>
		<pubDate>Sun, 30 Oct 2011 02:10:35 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[datasource]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/972</guid>
		<description><![CDATA[SQLite是一個簡易的資料庫系統，開放原始碼，可以直接把SQLite綁在程式裡使用，FireFox及Android等軟體也都有內建SQLite。SQLite不需要安裝，看起來就只是一個檔案而已，也可以使用memory模式，讓它存在記憶體中而不需要建立一個檔案存放。 SQLite支援的SQL指令：http://www.sqlite.org/lang_corefunc.html C#要連接SQLite可以使用open source的System.Data.SQLite，它是一個基於ADO.Net所做與SQLite的溝通介面，目前支援到.net framework 3.5。可於sourceforge下載其dll來使用，就可以了。 下方的範例是介紹如何在Csharp下使用ADO.NET連接與操作SQLite，包含了自動產生SQLite檔案與DataGridView使用class binding datasource方法。 一、建立一個專案，並先將其儲存起來 (需要先建置專案才能使用專案裡的class當做datasource) 二、改變專案使用的Framework 在專案節點上選擇屬性 把目標Framework(G):改成.NET Framework 3.5以下 告知需要重新啟動專案 三、加入System.Data.SQLite的Dll當做參考 在專案裡的參考節點上按右鍵選加入參考(R).... 找到DLL加入 在參考的節點上可以看到System.Data.SQLite已加入成功 因為原本專案為.NET Framework 4被降為3.5，所以會多出一個無法使用的參考Microsoft CSharp，此時可順便移除掉它。 四、建立相容模式 SQLite ADO.NET是建立於版本v2.0.50727，所以在比較高的版本會有相容性問題，所以修改app.config或web.config來使其相容使用。 ps.有一說可以在.NET Framework 4.0修改設定則可以使用SQLite ADO.NET 在startup的tag上加上屬性 &#60;startup useLegacyV2RuntimeActivationPolicy=&#34;true&#34;&#62; &#60;supportedRuntime version=&#34;v2.0.50727&#34;/&#62; &#60;/startup&#62; 在範列裡我們會使用到二種建立SQLite Connection的方法，其中一種為DbProvider，所以需要使用到以下tag內容，放在configuration內就可以了，如果不使用此種DbProvider方法，也可不加。 &#60;system.data&#62; &#60;DbProviderFactories&#62; &#60;remove invariant=&#34;System.Data.SQLite&#34;/&#62; &#60;add name=&#34;SQLite Data Provider&#34; invariant=&#34;System.Data.SQLite&#34; description=&#34;.Net Framework Data Provider for SQLite&#34; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/972/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log4net Visual Studio版的log4j</title>
		<link>http://blog.yslifes.com/archives/941</link>
		<comments>http://blog.yslifes.com/archives/941#comments</comments>
		<pubDate>Mon, 16 May 2011 23:14:00 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/941</guid>
		<description><![CDATA[在撰寫Java程式時很習慣的使用log4j來當程式訊息的輸出記錄，只需要簡單的改變設定檔就可以改變訊息是要顯示於Console、存入資料庫或是存於檔案裡，而且可選擇對於不同層級的記錄，十分方便於開發的Debug。 log4j也有.net版本，就叫log4net，也是由Apache基金會開發維護，在使用上與log4j還蠻相似的，log4j在使用時只需把config檔放置於classes跟目錄就可以了，而log4net則需要手動載入此設定檔，安裝設定的方法如下。 下載log4net的dll檔 解壓縮後,在目錄\log4net-1.2.10\bin\net\2.0\release\取出log4net.dll 加入參考 建立config檔log4net.config level value=&#34;DEBUG&#34;是記錄的層級到Debug層級，appender-ref ref=&#34;stdout&#34;表示使用name為stdout為輸出，而stdout設定的內容為Console輸出，另一appender-ref ref=&#34;APException_Info&#34;則為檔案記錄輸出，詳細的內容可以參考官方的文件。 &#60;?xml version=&#34;1.0&#34;?&#62; &#60;configuration&#62; &#60;configSections&#62; &#60;section name=&#34;log4net&#34; type=&#34;log4net.Config.Log4NetConfigurationSectionHandler, log4net&#34; /&#62; &#60;/configSections&#62; &#160; &#60;log4net&#62; &#60;!-- Setup the root category, add the appenders and set the default level --&#62; &#60;root&#62; &#60;level value=&#34;DEBUG&#34; /&#62; &#60;appender-ref ref=&#34;stdout&#34; /&#62; &#60;appender-ref ref=&#34;APException_Info&#34; /&#62; &#60;/root&#62; &#60;!-- Define some output appenders --&#62; &#60;appender name=&#34;stdout&#34; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/941/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[CSharp]把WebCam當QRCode的DeCode解碼器</title>
		<link>http://blog.yslifes.com/archives/841</link>
		<comments>http://blog.yslifes.com/archives/841#comments</comments>
		<pubDate>Tue, 21 Dec 2010 12:25:00 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Capture]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[qrcode]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[WINDOWS]]></category>
		<category><![CDATA[二維條碼]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/841</guid>
		<description><![CDATA[QRCode的使用可分成編碼EnCode及解碼DeCode二部份，在各種平台上也有需多人依據編碼規則製作了許多可用的解碼與編碼器，之前文章也介紹過 [Java]QRCode產生VCard使用的是swetake這個framework，不過現在已經有統一的單位在研究 ZXing (&#34;Zebra Crossing&#34;) ，而且各種平台上均提供原始碼供大家使用，對於解碼DeCode、解碼EnCode及歪斜辨識效果、速度都讓人滿意。 二維條碼Quick Response Code的發展上大都份落在手機平台上，在桌機上不像是一般的一維條碼有專用的條碼機，所以在就只能利用WebCam的影像解析功能，即時拍照給QRCode解碼器zxing解碼DeCode。 執行畫面： 產生QRCode，使用kayway網站來產生QRCode Start可以開始取得WebCam影像資料，而Stop會停止，Continue其實跟Start功能是一樣的。 解碼成功時會顯示於下方TextBox，並停止再解碼，影像取得並不停止，使用continue會再次開始解碼QRCode。 範例使用的是C#來製作Windows程式，使用的套件有zxing及WebCam_Capture，其中WebCam_Capture會使用到剪貼簿功能，大概是利用此功能來傳遞WebCam與GUI原件間的圖像，如果需要在解碼後複製內容的話，需要把WebCam功能停止，而解碼失敗判定則直接利用zxing解碼失敗會產生Exception，因為解碼速度很快，幾乎不會感覺到delay的狀況。ps.會慢的話是WebCam_Capture在慢。]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/841/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>[C#]簡單的GUI Form時鐘程式</title>
		<link>http://blog.yslifes.com/archives/770</link>
		<comments>http://blog.yslifes.com/archives/770#comments</comments>
		<pubDate>Sun, 31 Oct 2010 14:26:11 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/770</guid>
		<description><![CDATA[這是一個Thread的簡單應用，利用一個Thread在背景執行，每一秒設定Form上的元件來顯示時分秒，因為Form上的元件不能在其它不是Form本身Thread的執行緒上執行，所以要利用Form的invoke來呼叫Delegate Function設定元件值。 Label1是時、Label2是分、Label3秒，然後run這個function每一秒會去加秒數，當為六十秒時自動幫分加一，而秒數變零，當分為六十分時，自動幫時加一，而分變零，當時為二十四時，時變零。 Form的設定如下： 以下是執行畫面： 程式碼重點如下： changeTime Class using System; using System.Collections.Generic; using System.Linq; using System.Text; &#160; namespace WindowsFormsApplication1 &#123; class ChangeTime &#123; &#160; private Form1 form; &#160; private Boolean state = true; &#160; &#160; private int h; private int m; private int s; &#160; public ChangeTime&#40;Form1 form1&#41; &#123; &#160; &#160; this.form = form1; //設定預設的起始時間 [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/770/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[C#]演算法-氣泡排序法(Bubble Sort)</title>
		<link>http://blog.yslifes.com/archives/736</link>
		<comments>http://blog.yslifes.com/archives/736#comments</comments>
		<pubDate>Mon, 18 Oct 2010 12:22:10 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/736</guid>
		<description><![CDATA[這個排序演算法主要是利用二個迴圈，一個是要執行的回合數，另一個是真正比對數列資料，一次比較相臨的二個數，大的放右側，小的放左側，則可得最後一個數為最大數，則此數不再比較，以此類推，可以排出一個左小右大的數列。 演算過程的畫面如下程式畫面： 要排列的數列串是2,3,8,1,5,9,10,12,14 這是執行的過程及結果，一共執行了八回合 其中紅色字為需要交換字、藍色是正在比較的二個數、綠色是已排好的數，不會再進行比較 ps.點擊下圖可以放大 演算法的原始碼如下： using System; using System.Collections.Generic; using System.Linq; using System.Text; &#160; namespace ConsoleApplication1 &#123; class Program &#123; public static void BubbleSort&#40;int&#91;&#93; list&#41; &#123; int len = list.Length; for&#40;int i = 1;i&#60;=len-1;i++&#41;//執行的回數 for &#40;int j = 1; j &#60;= len - i; j++&#41;//執行的次數 &#123; if &#40;list&#91;j&#93; &#60; list&#91;j - 1&#93;&#41; &#123; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/736/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[C#]演算法-二元搜尋法(Binary Search)</title>
		<link>http://blog.yslifes.com/archives/728</link>
		<comments>http://blog.yslifes.com/archives/728#comments</comments>
		<pubDate>Thu, 14 Oct 2010 15:32:42 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/728</guid>
		<description><![CDATA[二元搜尋法需要先把要搜尋的數列先排序，由小到大，規則是先取前後二索引數，相加除二，也就是取中間數當索引值，然後跟要搜尋的數字做比較，如果一樣就是找到了，如果中間的數比要搜尋的數大，代表要搜尋的數在左邊數列，右邊數列則放棄，相反之，如果中間數比要搜尋的數小，代表要搜尋的數在右邊數列，左邊數列則放棄。 演算過程的畫面如下程式畫面： 數列串是1,2,3,4,5,6,7,8,9,10,11,12，然後要查詢4這個數字 演算法程式碼如下： using System; using System.Collections.Generic; using System.Linq; using System.Text; &#160; namespace ConsoleApplication1 &#123; class Program &#123; private static int binarySearch&#40;int&#91;&#93; list,int SearchKey&#41; &#123; int left = 0 ; int right = list.Length; while &#40;left &#60;= right&#41; &#123; int mid = &#40;left + right&#41; / 2;//取中間位子當基準 if &#40;list&#91;mid&#93; == SearchKey&#41; &#123; return mid;//找到的index值 [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/728/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[C#]演算法-循序搜尋法(Linear/Sequential Search)</title>
		<link>http://blog.yslifes.com/archives/727</link>
		<comments>http://blog.yslifes.com/archives/727#comments</comments>
		<pubDate>Wed, 13 Oct 2010 13:33:26 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/727</guid>
		<description><![CDATA[演算法有很多種，包含搜尋、排序等等，很多人都接觸過，在比較龐大的數學運算上真的是十分重要，可以節省很多時間及資源，像是Google、Yahoo 搜尋，都有自行的算法來應付大量的搜尋及資料。 底下先介紹一個常見的搜尋演算法循序搜尋法(Linear/Sequential Search)，觀念十分簡單，也常用到，就是直接用迴圈一個個去比對，找到時就跳出（回傳）。 演算過程的畫面如下程式畫面： 數列串是1,2,3,4,5,6,7，然後要查詢5這個數字 演算法程式碼如下： using System; using System.Collections.Generic; using System.Linq; using System.Text; &#160; namespace ConsoleApplication1 &#123; class Program &#123; public static int linearSearch&#40;int&#91;&#93; list, int item&#41; &#123; int value = -1; for &#40;int i = 0; i &#60; list.Length;i++ &#41; &#123; if &#40;list&#91;i&#93; == item&#41; &#123; value = i; break; &#125; &#125; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/727/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>好用的封裝軟體CreateInstall Free</title>
		<link>http://blog.yslifes.com/archives/359</link>
		<comments>http://blog.yslifes.com/archives/359#comments</comments>
		<pubDate>Wed, 29 Jul 2009 10:49:00 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[安裝]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/359</guid>
		<description><![CDATA[如果使用VisualStudio Express 2008開發軟體的話，想要發佈給其它人使用，這倒是個麻煩， 可以利用內建的OneClick方式封裝，或是利用功能強大的InstallShield Express來做，不過InstallShield並非免費， CreateInstall Free是一套免費的封裝Install的軟體，沒有註冊的狀況下，在安裝時下方有會提示CreateInstall Free字樣， 它不但可以把程式整個封裝進入一個setup.exe的執行檔，還可以對內容進行壓縮、放入startup目錄， 對付一些簡單的程式的封裝是個很好的選擇，不過它也不是完全沒有缺點， 像是沒法子自動檢查是否存在Framework .net 等。]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/359/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# Thread應用</title>
		<link>http://blog.yslifes.com/archives/357</link>
		<comments>http://blog.yslifes.com/archives/357#comments</comments>
		<pubDate>Mon, 27 Jul 2009 13:35:17 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[VisualStudio]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[express]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/357</guid>
		<description><![CDATA[Java的Thread是利用繼承Thread或是實作Runable來實現的，而C#確是不一樣的， C#利用一個new System.Threading.Thread物件，建構時傳入想要在執行緒裡動作的事件， 啟動方法跟Java一樣，利用Start()來開始這個執行序， System.Threading.Thread t = new System.Threading.Thread(要執行的Function名稱); 啟動方式 t.Start(); 那如果有參數要傳入呢？ 可以撰寫一個Class，先建構及設定好需要的參數，再把這個class實作的物件及方法傳入實作的System.Threading.Thread物件裡 就可以啦 Object x = new Object(); System.Threading.Thread t = new System.Threading.Thread(x.方法); 這裡有一個範例可以參考一下 先建立一個Class，名叫thread1 利用無窮迴圈讓內容一直跑，再利用Sleep(毫秒)來使其停一秒再執行。 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { &#160;&#160;&#160; class thread1 &#160;&#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;&#160; private String title; &#160;&#160;&#160;&#160;&#160;&#160;&#160; public thread1(String title) &#160;&#160;&#160;&#160;&#160;&#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.title [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/357/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

