Oct 12, 2007

SVN Server Setup

Source Control Subversion Server Setup Under Windows

Get SVN Server Tools
http://subversion.tigris.org/ ( original subversion )
http://www.collab.net/products/subversion/ ( CollabNet Subversion)

Get SVN Client Tools
http://tortoisesvn.net/

Get Visual Studio Intergration Add-On
http://www.VisualSvn.com/
http://ankhsvn.tigris.org/


A) Download Subversion

You'll need the latest version of..

B) Install Subversion

  1. Unzip the Windows binaries to a folder of your choice. I chose c:\program files\subversion\ as my path.
  2. Now, add the subversion binaries to the path environment variable for the machine. I used %programfiles%\subversion\bin\

  3. You'll also need another environment variable, SVN_EDITOR, set to the text editor of your choice. I used c:\windows\notepad.exe

C) Create a Repository

  1. Open a command prompt and type
    svnadmin create "c:\Documents and Settings\Subversion Repository"
  2. Navigate to the folder we just created. Within that folder, uncomment the following lines in the /conf/svnserve.conf file:
    [general]
    anon-access = read
    auth-access = write
    password-db = passwd

    Next, uncomment these lines in the /conf/passwd file:

    [users]
    harry = harryssecret
    sally = sallyssecret

D) Verify that everything is working

  1. Start the subversion server by issuing this command in the command window:
    svnserve --daemon --root "C:\Documents and Settings\Subversion Repository"

    You can create shortcut and set the target
    "C:\Program Files\CollabNet Subversion Server\svnserve.exe" -d -r
    C:\Documents and Settings\Subversion Repository
  2. Create a project by opening a second command window and entering this command:

    svn mkdir svn://localhost/myproject

    It's a standard Subversion convention to have three folders at the root of a project:

    /trunk
    /branches
    /tags

  3. At this point, Notepad should launch:

    Enter any comment you want at the top of the file, then save and exit.
  4. You'll now be prompted for credentials. In my case I was prompted for the administrator credentials as well:

    Authentication realm:  0f1a8b11-d50b-344d-9dc7-0d9ba12e22df
    Password for 'Administrator': *********

    Authentication realm: 0f1a8b11-d50b-344d-9dc7-0d9ba12e22df
    Username: sally
    Password for 'sally': ************

    Committed revision 1.

    Congratulations! You just checked a change into Subversion!

E) Start the server as a service

  1. Stop the existing command window that's running svnserve by pressing CTRL+C.
  2. Copy the file SVNService.exe from the zip file of the same name to the subversion\bin folder.
  3. Install the service by issuing the following commands:
    svnservice -install --daemon --root "C:\Documents and Settings\Subversion Repository"
    sc config svnservice start= auto
    net start svnservice
  4. Test the new service by listing all the files in the repository:
    svn ls svn://localhost/

    You should see the single project we created earlier, myproject/

F) Set up the shell extension

  1. Run the TortoiseSVN installer. It will tell you to restart, but you don't need to.
  2. Create a project folder somewhere on your hard drive. Right click in that folder and select "SVN Checkout..."



    type svn://localhost/myproject/ for the repository URL and click OK.


  3. Create a new file in that directory. Right click the file and select "TortoiseSVN, Add"


  4. The file hasn't actually been checked in yet. Subversion batches any changes and commits them as one atomic operation. To send all your changes to the server, right click and select "SVN Commit":



And we're done! You now have a networked Subversion server and client set up on your machine. Note that the default port for svnserve is 3690.


Extra Command:
SVN Client Command: svn
-----------------------
add
blame (praise, annotate, ann)
cat
changelist (cl)
checkout (co)
cleanup
commit (ci) -m "my log message"
copy (cp)
delete (del, remove, rm)
diff (di)
export
help (?, h)
import
info
list (ls) -v
lock
log -v
merges
mergeinfo
mkdir
move (mv, rename, ren)
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
resolved
revert
status (stat, st) -u -v
switch (sw)
unlock
update (up)


SVN Admin Command: svnadmin
-----------------------------
crashtest
create
deltify
dump
help (?, h)
hotcopy
list-dblogs
list-unused-dblogs
load
lslocks
lstxns
recover
rmlocks
rmtxns
setlog
setrevprop
verify



SVN Look Command: svnlook
--------------------------
author
cat
changed
date
diff
dirs-changed
help (?, h)
history
info
lock
log
propget (pget, pg)
proplist (plist, pl)
tree
uuid
youngest


SVN Dump Fileter Command: svndumpfilter
----------------------------------------
exclude
include
help (?, h)


SVNServe Daemon: svnserve
---------------------------
svnserve -d -r /path/to/repo

SVN Windows Service
---------------------------
sc create svn
binpath= "C:\svn\bin\svnserve.exe --service -r C:\repos"
displayname= "Subversion Server"
depend= Tcpip
start= auto

C:\> sc create svn
binpath= "\"C:\program files\svn\bin\svnserve.exe\" --service -r C:\repo
displayname= "Subversion Server"
depend= Tcpip
start= auto


C:\> net stop svn
C:\> net start svn







error C4430: missing type specifier - int assumed. Note: C++ does not

Compile error with Visual C++ 2005 / Orcas : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Solution:
Compiler expect (const int) not (const).

Oct 11, 2007

ASCII/Multibyte to Unicode conversion

 
ASP.NET, All Topics, C# , .NET >> C# Database >> Unedited Reader Contributions
http://www.codeproject.com/useritems/ASCIIMB2UnicodeTSQL.asp

ASCII/Multibyte to Unicode conversion
By carlop().

An article about converting ASCII/Multibyte to unicode using C# and SQL/CLR Integration
C# (C# 2.0), SQL
Windows (WinXP), .NET (.NET 2.0)
Win32, SQL (SQL 2005), VS
DB, Dev
Posted: 8 Feb 2007
Updated: 16 Feb 2007
Views: 15,212
Note: This is an unedited reader contribution  

7 votes for this article.
Popularity: 2.62. Rating: 3.1 out of 5.

Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report this article.

Sample image

Introduction

A common problem when converting legacy database applications is that our customers have a lot of data and they don't want to loose it. Probably data strings are encoded in ASCII / Multibyte but our new system uses NVARCHAR fields. So the problem is that we have to convert old data into Unicode. This is exactly what we'll do.

I have to highlight that the approach I will present is 'oversized' for most cases: in a common scenario you will deal with a single codepage, in that case SQL Server built-in tools are enough. But there are situations that requires a more advanced approach, such as when you have a legacy database that stores strings with different codepages.

As a complete example to show you capabilities of SQL-CLR integration I've also decided to use a Win32 API to perform the conversion, so that you can also see how use P/Invoke from SQL. This can be useful if you have an old DLL and want to use it... but *beware* that it can be really dangerous... if you don't have full knowledge of what you're doing you can keep down the entire SQL Server process !!!

Just a note: I do not provide a test project since the code I will show here is really simple, you can use copy & paste, it's faster !

Solution

The solution I want to show is simple and powerful at the same time. It is made of two logical parts: First we'll build the conversion routine as a standard C# function. Secondly we'll integrate it into SQL Server as a function, so you can use with T-SQL.

Clearly, depending on you application scenario, this may not be the best approach, so once you have the conversion routine you may choose to follow my approach or you may prefer to use it in an external application that performs a batch conversion or you may think of something else.

Part #1: create the conversion routine.

I've used the following well known Win32 API:

int MultiByteToWideChar(
UINT CodePage,
DWORD dwFlags,
LPCSTR lpMultiByteStr,
int cbMultiByte,
LPWSTR lpWideCharStr,
int cchWideChar
);

Here there's the C# signature that can be used for P/Invoking:

  [DllImport("kernel32.dll")]
private static extern int MultiByteToWideChar(
uint CodePage,
uint dwFlags,
[MarshalAs(UnmanagedType.LPArray)] Byte[] lpMultiByteStr,
int cbMultiByte,
[Out, MarshalAs(UnmanagedType.LPArray)] Byte[] lpWideCharStr,
int cchWideChar);

Now it's quite easy to write a class that performs a conversion:

namespace ConvUtils {

public static class Unicode {

public static SqlString ConvToUnicode(SqlInt32 codepage , SqlString multibyteString) {
byte[] b = (byte[])iConvToMultibyteArray(multibyteString);
return (SqlString)ToUnicode((uint)(int)codepage, b);
}

private static string ToUnicode(uint codepage, Byte[] lpMultiByteStr) {
Byte[] lpWideCharStr = new Byte[2*lpMultiByteStr.Length];
MultiByteToWideChar(codepage, 0, lpMultiByteStr, lpMultiByteStr.Length, lpWideCharStr, 2*lpMultiByteStr.Length);
return System.Text.Encoding.Unicode.GetString(lpWideCharStr);
}


private static SqlBinary iConvToMultibyteArray(SqlString multibyteString) {
byte[] result = multibyteString.GetUnicodeBytes();
return (SqlBinary)result;
}
}
}

The example is quite easy and does not require any other explanation. The SqlTypes has been used because I will integrate it into SqlServer, but if you don't need it you may replace them with strings and Byte arrays.

I've also decided to let the codepage be a parameter since the codepage on your PC or on SQL Server can be different from the one needed for the conversion.

Part #2: SQL Server code

Ok, now we have a C# code that converts ASCII/Multibyte into Unicode. The next step is to integrate it into SQL Server so that any database user can have access to this conversion routine:

First create a DLL that can be hosted by SQL Server: all we have to do is to add the [SQLFunction] attribute to the ConvToUnicode :

    [SQLFunction] 
public static SqlString ConvToUnicode( …

Finally build the DLL and integrate it into SQL with a script that is like the following one:

use TESTDB 
go
exec sp_configure "clr enabled", '1'
go
reconfigure
go
-- for test purpouses only, not recommended in production environments
ALTER DATABASE TESTDB SET TRUSTWORTHY ON
go

begin try
CREATE ASSEMBLY [asmUni] FROM 'c:\project_output_dir\uniconv.dll' with permission_set=UNSAFE
end try
begin catch
alter assembly [asmUni] FROM 'c:\project_output_dir\uniconv.dll' WITH UNCHECKED DATA
end catch
go

if exists(select name from sys.objects where name = 'csConvToUnicode') drop function [dbo].[csConvToUnicode]
go
CREATE FUNCTION [dbo].[csConvToUnicode] (
@codepage int,
@multibytestr nvarchar(max)
) returns nvarchar(max)
AS EXTERNAL name [asmUni].[ConvUtils.Unicode].[ConvToUnicode]
go

That's all !

Now you can use this function like any other, for example in a classic select statement, to create a view or to create a trigger that automatically keeps your data updated.

Just a final example on how we can use this function in a T-SQL statement (950 is the codepage for traditional chinese):

select 
description,
dbo.csConvToUnicode(950, description) as converted
from testtable

description converted
----------------------- -------------------
¨àµ£ºô¸ô¦w¥þ 兒童網路安全
°ê»Ú¸ê°T °T°T°T°T°T 國際資訊 訊訊訊訊訊
°ê»Ú¸ê°T °T°T°T°T°T 國際資訊 訊訊訊訊訊
a a
Áô¨pÅv¬Fµ¦ 隱私權政策
test c test c

Conclusion

I have shown a really simple but powerful way to leverage the CLR integration provided by SqlServer to convert old ASCII/Multibyte data into Unicode. I Hope that this is a good starting point for your personal solution.

History

February 16th, 2007 - Added more comments on introduction
February 8th, 2007 - First Version

About carlop()


10 years of hard coding... and it's going on !

Click here to view carlop()'s online profile.



Add this article to:

Discussions and Feedback

14 comments have been posted for this article. Visit http://www.codeproject.com/useritems/ASCIIMB2UnicodeTSQL.asp to post and view comments on this article.
Updated: 16 Feb 2007 Article content copyright carlop(), 2007
everything else Copyright © CodeProject, 1999-2007.

Useful Chinese Links

Chinese links

Chinese script, Free Chinese fonts, Writing Chinese, Chinese computing, Chinese radio, Chinese newspapers, Chinese dictionaries, Chinese translation, Chinese courses, Chinese names, Chinese calligraphy, Chinese computing, Chinese philosophy, Chinese forums, Miscellaneous


Chinese script

中国文字研究与应用中心 (Center for the Study of Chinese Characters and Their Applications)
http://www.ideograms.org

A history of written Chinese
http://www.pinyin.info/readings/texts/visible/

Information about and articles on Chinese characters and the Chinese script
http://en.wikipedia.org/wiki/Chinese_character
http://www.chinaorbit.com/china-culture/chinese-characters.html
http://www.chinaknowledge.de/Literature/script.html

Pinyin/Zhuyin Converter - converts Chinese characters to pinyin or zhuyin
http://www.pin1yin1.com

Free Chinese fonts

http://www.sino.uni-heidelberg.de/edv/sinopc/chinese_fonts.htm
http://www.indeed.com.tw/download.html
http://www.yale.edu/chinesemac/pages/fonts.html
http://www.twinbridge.com

Chinese Translation
Chinese Translation
Our Price:$10.00

Writing Chinese

Writing Chinese Characters - and how to count the strokes
http://www.sungwh.freeserve.co.uk/methods/bihua.htm

Animated Chinese characters - shows you how to write individual characters
http://ocrat.com/ocrat/chargif/

Videos showing you how to write Chinese characters stroke by stroke
http://www.chineselearner.com/writing/symbol/

Online Chinese radio

China Radio International - in Mandarin and many other languages
http://www.cri.com.cn

Beijing Music Radio (北京音乐台) - in Mandarin
http://fm974.tom.com

Radio Shanghai (上海人民广播电台) - in Mandarin
http://www.radioshanghai.com

Radio Taiwan International (中央廣播電台) - in Mandarin, Taiwanese, Hakka, Cantonese and various other languages): http://www.cbs.org.tw

BCC (中國廣播電台) - in Mandarin, Taiwanese and Hakka
http://www.bcc.com.tw

Voice of Taipei (台北之聲) - in Mandarin and Taiwanese
http://www.vot.com.tw

RTHK (香港電台) - in Cantonese
http://www.rthk.org.hk

BBC World Service - in Mandarin and Cantonese
http://www.bbc.co.uk/chinese/

Radio Free Asia - in Mandarin and Cantonese
http://www.rfa.org/english/

Melody Studio - Chinese, Taiwanese and Cantonese music
http://www.melodystudio.com/

Online Chinese newspapers

China

People's Daily (人民日报)
http://www.peopledaily.com.cn

Taiwan

China Times (中時電子報)
http://news.chinatimes.com

Hong Kong

Ming Pao News (明報新聞網)
http://www.mingpaonews.com

Apple Daily (蘋果日報)
http://www.appledaily.com

Singapore

Lianhe Zaobao (联合早报)
http://www.zaobao.com

Online Chinese dictionaries

http://www.chinalanguage.com/dictionaries/ccdict/
http://www.yourdictionary.com/languages/sinotibe.html
http://www.mdbg.net/chindict/chindict.php
http://www.mandarintools.com/chardict.html
http://www.pristine.com.tw/resources/lexicon.php
http://zhongwen.com
http://www.tigernt.com/dict.shtml
http://www.chinese-tools.com/tools/dictionary.html
http://www.chinesedic.com
http://www.chinese-dictionary.org
http://www.kanjinetworks.com
http://www.clearchinese.com/chinese-english-dictionary.htm
http://chdw.de
http://app.chinesesavvy.com/services/dictionary/DictionarySearchPO.ot
http://www.ilearnchinesehere.com

Picture-based Chinese character/word dictionary
http://www.vertical-sun.com/hanzi

Speaking Chinese English Dictionaries
http://moosenose.com/speakingpinyin.htm
http://app.chinesesavvy.com/services/dictionary/sentence/DictionarySentencePO.ot

Chinese Electronic talking dictionaries
http://www.ectaco.com

Chinese language resources - information, dictionaries, etc
http://www.chinalanguage.com
http://www.easechinese.com

Online Cantonese dictionary
http://www.cantonese.sheik.co.uk/scripts/wordsearch.php

Online Shanghainese/Wu dictionaries
http://dict.zanhe.com
http://www.glossika.com/en/dict/wudict.php

Online Taiwanese dictionary
http://daiwanway.dynip.com/cgi/tdict.acgi

Photo dictionary of rare Chinese characters (with explanations in Japanese)
http://homepage2.nifty.com/Gat_Tin/kanji/kaindex.htm


Online Chinese translation

Online translation from English into Chinese (Simplified & Traditional) of websites and text: http://www.readworld.com/tran

Online Chinese courses/lessons

Cantonese
http://www.khuang.com/chinese/cantonese.asp
http://www.chinawestexchange.com/Cantonese/

Mandarin
http://www.csulb.edu/~txie/ccol/content.htm
http://www.chineseon.net
http://www.csulb.edu/~txie/online.htm
http://www.languageguide.org/mandarin/
http://www.chinese-lessons.com
http://www.chinese-outpost.com/language/
http://www.chinese-tools.com/learn/chinese
http://www.zapchinese.com
http://www.sinoling.com
http://learnchinese.elanguageschool.net
http://www.clearchinese.com/learn-chinese/
http://www.effectivelanguage.com/mandarin.html
http://www.chinesepod.com
http://www.clearchinese.com
http://www.activechinese.com
http://www.china-8.com/cms/sites/china-8/section.cfm?id=12
http://parlezchinois.free.fr
http://www.loquella.com/learn-chinese
http://www.echineselearning.com
http://www.chinese-course.com

Mandarin phrases (some with audio)
http://www.bbc.co.uk/languages/chinese/
http://www.wku.edu/~yuanh/AudioChinese/
http://www.chinaadviser.com/useful_chinese_phrases.html
http://www.languageguide.org/mandarin/
http://www.slanguage.com/fun_chinese_mand.html

Shanghainese
http://www.linguasinica.com/Shanghai/
http://www.zanhe.com
http://www.shanghai.or.jp/zw/shanghai/

Taiwanese
http://www.glossika.com/en/dict/
http://www.tacpa.org/wdcts/mtl/intro.html
http://edu.ocac.gov.tw/lang/taiwanese/

Basic lessons in Mandarin, Taiwanese, Shanghainese and Hakka
http://www.hqpin.com/eindex.html

China Online - inlcudes articles, phrases and information about Chinese languages
http://www.chinaonline.cn.com/chinese_language.html

Online resources for learning Mandarin
http://www.chinesetools.eu

HyperChina - an interactive Mandarin Chinese course on CD-ROM http://www.sinologic.com/HyperChina.html

Chinese Phrases for Travellers (with audio)
http://chinese.travel-way.net

Chinese Writing Master - software that helps you learn how to write Chinese characters
http://www.cchar.com

Early Learning - Chinese: Free printable bilingual (English- Mandarin Chinese) materials and tips for parents, homeschoolers, caregivers, daycare/child-care providers, babysitters, or anyone who works with young children who are learning chinese/english
http://www.earlylearning-chinese.com


Chinese names

Your name in Chinese
http://www.mandarintools.com/chinesename.html
http://www.qualitylanguage.com/name_translator.htm
http://www.transname.com
http://www.chinese-tools.com/names
http://www.chinesenames.org
http://www.chine-informations.com/mods/prenoms/
http://definingcharacters.com

Chinese Seals

A guide to the hundred most common Chinese surnames
http://www.geocities.com/Tokyo/3919/hundred.html

An introduction to Chinese names and other interesting facts about Chinese language and culture: http://www.wlu.edu/~hhill/btl.html

Chinese calligraphy, translation and design - get your name in beautiful Chinese calligraphy: http://www.transname.com


Chinese calligraphy

http://www.chinapage.com/callig1.html
http://www.asiawind.com/art/callig/calligal.htm
http://www.tongram.com/gallery/default.asp
http://home.flash.net/~cameron/calligraphy/collection.htm
http://www.rice-paper.com/uses/calligraphy.html

Chinese computing

The Complete Guide to Chinese Computing
http://www.chinesecomputing.com/

An introduction to Chinese Input Methods http://zsigri.tripod.com/fontboard/cjk/input.html#chinese
http://www.nationmaster.com/encyclopedia/Chinese-input-methods-for-computer

The Cangjie Input Method
http://www.sungwh.freeserve.co.uk/methods/cangjie.htm

InputKing - a program for inputting Chinese text online
http://www.inputking.com

Guide to reading Chinese on the internet
http://www.cathay.net/help/read-chn.shtml

Beautiful Chinese wallpaper for your computer
http://www.desktopchina.com/desktopchina/

SIMO - enables you to input Chinese through browsers
http://www.simo.us

Chinese philosophy

The Daodejing (Tao-te-ching) by Laozi (Lao-tzu) in Chinese and English
http://www.chinapage.com/laotze.html

Chinese Text Project - texts of ancient Chinese philosophy online
http://chinese.dsturgeon.net

Chinese forums

http://www.chinese-forums.com
http://www.omnitalk.com
http://www.chinesesavvy.com/savvy/

Miscellaneous

Chinese Tools - online tools to learn chinese or build chinese websites. Includes annotation tools, dictionaries, and converters for pinyin, unicode, traditional and simplified chinese: http://www.chinese-tools.com

Chinesesavvy - a variety of resources for students of Chinese, including an online dictionary, articles on Chinese culture and history, forums, etc/
http://www.chinesesavvy.com/savvy/

Interesting Chinese - information about Chinese language, history and culture
http://www.interestingchinese.com

Free Chinese New Year E-cards
http://www.chinesenewyearecards.com
http://www.123greetings.com/events/chinese_new_year/


Convert Chinese characters to Unicode

This tool will convert Chinese characters (and just about everything else, including Japanese hiragana, katakana, and kanji; tonal Hanyu Pinyin; and Cyrillic script) into the decimal (not hex) form of Unicode numerical character references (NCRs). These NCRs can then be used in Web pages, with greater ease than the Chinese characters themselves for those whose operating systems or other software don't handle double-byte text well.

For example, 台北, the characters for "Taipei" (Táiběi), can also be written as 台北. For this to work, the "charset" of the Web page should be set to Unicode:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

It's generally better, however, to use the characters themselves rather than their Unicode NCRs in cases where a Web page has a lot of Chinese text, because Chinese characters take up less file space than their NCRs.

http://www.pinyin.info/tools/converter/chars2uninumbers.html


Convert Chinese Charactor To Pin Yin

http://www.purpleculture.net/pinyin_old.asp




Information about written and spoken Chinese on this site

Recommended books

Books about Chinese characters and calligraphy
Classical Chinese, Mandarin, Shanghainese, Hokkien, Taiwanese and Cantonese language courses, dictionaries, etc.

Free Chinese Fonts for Win9x/NT/2000/XP

Free Chinese Fonts for Win9x/NT/2000/XP

compiled by olr
Instructions:

Please make sure that in the Start --> Settings --> Control Panel --> Regional Options the default language ("Set default") is "Chinese (VR China)".

1. Please close all word-processing programs.
2. Click on the font you wish to download.
3. Choose a saving location, either "C:/WINNT/fonts" (NT/2000) or "C:/WINDOWS/fonts" (9x/Me/XP).
      OR: save the fonts to a new folder, then open "Fonts" from the "Control Panel";
      select "File" -> "Install New Font";
      open the drive and folder where you saved the new font files,
      the fonts will appear in the "list of fonts";
      select the files you want to install or choose "Select All"; click "OK".
4. Restart your word-processing programs.

   
name: 鼎繁 古印 - HDZB_5.TTF
size: 3.168 kB

download this font
download this font
   
   
name: 鼎繁海报 - HDZB_6.TTF
size: 2.991 kB

download this font
download this font
   
   
name: 鼎繁舒 - HDZB_10.TTF
size: 2.177 kB

download this font
download this font
   
   
name: 鼎繁印篆  - HDZB_25.TTF
size: 4.663 kB

download this font
download this font
   
   
name: 鼎繁 中變 - HDZB_27.TTF
size: 3.256 kB

download this font
download this font
   
   
name: 鼎繁 顏體 - HDZB_24.TTF
size: 3.501 kB

download this font
download this font
   
   
name: 汉鼎简黑变 - HDZB_35.TTF
size: 1.512 kB

download this font
download this font
   
   
name: 汉鼎简楷体 - HDZB_36.TTF
size: 4.573 kB

download this font
download this font
   
   
name: 汉鼎简录变 - HDZB_37.TTF
size: 3.950 kB

download this font
download this font
   
   
name: 汉鼎简舒体 - HDZB_39.TTF
size: 2.622 kB

download this font
download this font
   
   
name: 鼎繁 綠變 - HDZB_7.TTF
size: 4.866 kB

download this font
download this font
   
   
name: 汉鼎特粗黑 - HDZB_70.TTF
size: 1.683 kB

download this font
download this font
   
   
name: 鼎繁 中楷 - HDZB_74.TTF
size: 6.152 kB

download this font
download this font
   
   
name: 汉鼎简中楷 - HDZB_75.TTF
size: 5.528 kB

download this font
download this font
   
   
name: 鼎繁琥珀  - HDZB_86.TTF
size: 5.027 kB

download this font
download this font
   
   
name: 鼎繁勘亭 - HDZB_9.TTF
size: 2.931 kB

download this font
download this font
   
   
name: 鼎繁特 - HDZB_96.TTF
size: 2.923 kB

download this font
download this font
 
 
Even more fonts at http://www.sj00.com/ (be aware that not all fonts are real True Types).

original source: http://www.sino.uni-heidelberg.de/edv/sinopc/chinese_fonts.htm

WinForm : Using the World Transformation

Windows Forms Programming 
Using the World Transformation

Dim rect As New Rectangle(0, 0, 50, 50)
Dim pen As New Pen(Color.FromArgb(128, 200, 0, 200), 2)
e.Graphics.DrawRectangle(pen, rect)

e.Graphics.ScaleTransform(1.75F, 0.5F)
e.Graphics.DrawRectangle(pen, rect)

e.Graphics.ResetTransform()
e.Graphics.RotateTransform(28) ' 28 degrees
e.Graphics.DrawRectangle (pen, rect)

e.Graphics.ResetTransform()
e.Graphics.TranslateTransform(150, 150)
e.Graphics.DrawRectangle(pen, rect)



Oct 10, 2007

Mouse Event

Handling Mouse Events in Forms

We can handle mouse events such as mouse pointer movements in Forms. The mouse events supported by VB .NET are as follows:

MouseDown: This event happens when the mouse pointer is over the form/control and is pressed
MouseEnter: This event happens when the mouse pointer enters the form/control
MouseUp: This event happens when the mouse pointer is over the form/control and the mouse button is released
MouseLeave: This event happens when the mouse pointer leaves the form/control
MouseMove: This event happens when the mouse pointer is moved over the form/control
MouseWheel: This event happens when the mouse wheel moves while the form/control has focus
MouseHover: This event happens when the mouse pointer hovers over the form/control

The properties of the MouseEventArgs objects that can be passed to the mouse event handler are as follows:

Button: Specifies that the mouse button was pressed
Clicks: Specifies number of times the mouse button is pressed and released
X: The X-coordinate of the mouse click
Y: The Y-coordinate of the mouse click
Delta: Specifies a count of the number of detents (rotation of mouse wheel) the mouse wheel has rotated

Working with an Example

We will work with an example to check the mouse events in a form. We will be working with MouseDown, MouseEnter and MouseLeave events in this example. Drag three TextBoxes (TextBox1, TextBox2, TextBox3) onto the form. The idea here is to display the results of these events in the TextBoxes.

Code 

Public Class Form1 Inherits System.Windows.Forms.Form
'Windows Form Designer Generated Code
Private Sub Form1_Mousedown(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
TextBox1.Text = "Mouse down at" + CStr(e.X) + " :" + CStr(e.Y)
'displaying the coordinates in TextBox1 when the mouse is pressed on the form
End If
End Sub

Private Sub Form1_MouseEnter(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles MyBase.MouseEnter
TextBox2.Text = "Mouse Entered"
'displaying "mouse entered" in TextBox2 when the mouse pointer enters the form
End Sub

Private Sub Form1_MouseLeave(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles MyBase.MouseLeave
TextBox3.Text = "Mouse Exited"
'displaying "mouse exited" in Textbox3 when the mouse pointer leaves the form
End Sub

End Class

The image below displays the output.

Beep Function

The Beep Function in VB.NET can be used to make the computer emit a beep. To see how this works, drag a Button onto the form and place the following code in it's click event:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles Button1.Click
Beep()
End Sub

When you run the code and click the button your computer emits a beep.