顯示具有 C# 標籤的文章。 顯示所有文章
顯示具有 C# 標籤的文章。 顯示所有文章

2012年9月9日 星期日

.net Color table

說著也怪, .net class裡有兩個color class, 一個是在namespace “System.Drawing”, 另一個是在 namespace “System.Windows.Media”, 雖說這也沒什麼大不了, 但說真的相同的值還是可以拿出來, 不過MS常做這種事, 看他以前的win api就知道了, 重複的功能一堆。
下面是color table, 方便大家手動打入一些color, 或是查詢, 真的想知道color class做什麼, 還是上去MSDN查吧
Predefined colors

2011年8月26日 星期五

C# high resolution/performance counter/timer

The codes show that by using the QueryPerformanceCounter, to implement hight performance/resolution timer and counter. I have tried the from WinForm UI and CLI. The resolution can be 1ms. Of course, this will satisfy us for our normal using.

The code is blow. Enjoy it.

2009年9月21日 星期一

c#聊天室(チャットルーム)

C#聊天室(Chatroom)

編譯環境:Visual Studio 2008 C#
程式碼(ソースコード):在這裡(here)
說明:

使用TcpClient實作的chatroom,目前已完成多人連線版本,只要再做修改,就可以實際使用於很多場合。我相信這是很多人的作業,所以就放上原始碼讓大家參考了,如果有任何問題也觀迎在我的blog上留言。

2009年9月13日 星期日

Jubeat Score Editor (Jubeat譜面編輯器)

System Requirment:
Windows XP sp2 or sp3, .Net framework 3.5 or later. Windows Vista, Windows 7.

Release Note:
[2009.09.14]1.0版完成。發佈..
[2009.10.01]1.1版完成,更新按鈕圖示、新增刪除譜面功能及一些bugs...發佈..

已經完成了,操作如下:

1.0 Download
1.1 Download

  1. 打開程式
    畫面如下
  2. 按下左上方的小圖示

    按下後畫面會多出現一個譜面編輯
  3. 在16格上面按下任何一個,就會出現編輯畫面,完成後記得按下Enter


  4. 按下存檔就可以存成像這下這樣的格式


  5. 開檔就選擇存好,或是手動編好的檔案就可以了。
  6. 程式如果還有任何問題,請和我說,我會再修改。

PS: 下一版發行可以存成譜面表示機可以讀取的檔案。

 

2009年8月31日 星期一

C# Bezier Curve


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CSharpBezierCurve
{
    public partial class Form1 : Form
    {
        private Point[] controlPoint = new Point[4];
        private int controlPointCount = 0;
        public Form1()
        {
            InitializeComponent();
        }


        private void drawControlLine(Graphics g) {
            Pen p = new Pen(Color.Green);
            if (!controlPoint[0].IsEmpty && !controlPoint[1].IsEmpty)
                g.DrawLine(p, controlPoint[0], controlPoint[1]);
            if (!controlPoint[1].IsEmpty && !controlPoint[2].IsEmpty)
                g.DrawLine(p, controlPoint[1], controlPoint[2]);
            if (!controlPoint[2].IsEmpty && !controlPoint[3].IsEmpty)
                g.DrawLine(p, controlPoint[2], controlPoint[3]);
        }

        private void drawBezierCurve(Graphics g) {
            Pen p = new Pen(Color.Aqua);
            g.DrawBezier(p, controlPoint[0], controlPoint[1], controlPoint[2], controlPoint[3]);
        }

        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            if (controlPointCount == 4) return;
            controlPoint[controlPointCount++] = new Point(e.X, e.Y);
            Pen p = new Pen(Color.Red);
            Panel panel = (Panel)sender;
            Graphics g = panel.CreateGraphics();
            g.DrawRectangle(p, e.X, e.Y, 2, 2);
            drawControlLine(g);
            if (controlPointCount == 4) drawBezierCurve(g);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            controlPoint = null;
            controlPoint = new Point[4];
            controlPointCount = 0;
            panel1.Invalidate();

        }

    }
}

2009年8月27日 星期四

SMS PDU Decoder and Encoder

Now you can use these 2 programs to encode and decode SMS PDU. SMS is the Sort Message Service for the mobile user equipment. Please use the encoder to encode the message that you want to send. And use the decoder to decode the message that you just encoded.

source code:

This is the screenshot of encoder.

This is the screenshot of decoder.

If there is any problem, please leave you message to me.