2011年7月29日

[茶包]魔獸世界戰網卡無法儲值以及儲值後無法新增遊戲時間之問題解法

battle.net 合併魔獸帳號之後,第一次儲值就遇到兩大問題 orz

首先是儲值:

2011年7月22日

[筆記]解決XP無法執行.NET應用程式的問題

某個使用 C#.NET 4.0 撰寫的 Windows Form 應用程式

在 Vista / Win7 的電腦都能正常運行,唯獨 XP 電腦無法執行

已經確認正常安裝,只是在執行後(點兩下)就直接關閉

2011年7月4日

[筆記]How to get string width by different font style

Try to use this method :

Graphics.MeasureString(String, Font)

Example :

private void MeasureStringMin(PaintEventArgs e)
{
    // Set up string.
    string measureString = "Measure String";
    Font stringFont = new Font("Arial", 16);

    // Measure string.
    SizeF stringSize = new SizeF();
    stringSize = e.Graphics.MeasureString(measureString, stringFont);

    // Draw rectangle representing size of string.
    e.Graphics.DrawRectangle(new Pen(Color.Red, 1), 0.0F, 0.0F, stringSize.Width, stringSize.Height);

    // Draw string to screen.
    e.Graphics.DrawString(measureString, stringFont, Brushes.Black, new PointF(0, 0));
}

this is also useful in game :)

[筆記]How to prevent C# controls flickering when resizing

Just add this below your Form constructor :

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.ExStyle |= 0x02000000;   // WS_EX_COMPOSITED. Prevents flickering.
        //cp.ExStyle |= 0x00080000; // WS_EX_LAYERED. Transparency key.
        return cp;
    }
}

wish this would help you :)