473,395 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Displaying semi graphic caracters

Hi,

I'm looking for a way to display semi graphic characters in a multi line
text control or in a rich text control.
I've tried with all the characters of the extended ASCII table (code page
437), they appear correctly except the semi graphic ones.

Please help ...

Thanks a lot
David
Nov 20 '05 #1
2 3685
These are known as "glyph characters". They are not in ASCII (certainly not
in the misnamed "extended ASCII") as they are only a part of a single OEM
code page. The only way to get them to display:

1) Have the text in cp437.

2) PInvoke to MultiByteToWideChar, with a CodePage of 437 and a dwFlags of
MB_USEGLYPHCHARS.

3) You the resultant string in your display.
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"David Scemama" <da***********@wanadoo.fr> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi,

I'm looking for a way to display semi graphic characters in a multi line
text control or in a rich text control.
I've tried with all the characters of the extended ASCII table (code page
437), they appear correctly except the semi graphic ones.

Please help ...

Thanks a lot
David

Nov 20 '05 #2
Hello, David:

I suggest you use System.Drawing to draw boxes because most of the fonts don't support the graphic characters, some support them through char sets (like Microsoft Sans Serif) and few support it directly (like Arial)

You can learn how to use codepages in the internationalization documentation.

Anyway, here is an example. Create a form with a button and two textboxes. Set the Font property of TextBox1 to Arial and of TextBox2 to Microsoft Sans Serif. Leave the Font.GDICharSet property at the default value of zero for both TextBoxes. Past this code:

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
'We need encoding for working with codepages:
Dim enc As System.Text.Encoding = System.Text.Encoding.GetEncoding(437)

'TextBox1 uses Arial font.
'TextBox2 was assigned Microsoft Sans Serif with GDICharSet=0 at design time.
'TextBox1 is OK, but we must correct the font for TextBox2:
Me.TextBox2.Font = New Font(Me.TextBox2.Font.FontFamily, _
Me.TextBox2.Font.SizeInPoints, _
Me.TextBox2.Font.Style, _
GraphicsUnit.Point, _
255)
'Now the fonts are ready and both TextBoxes display correctly:
'We set from unicode (ChrW),
' from codepage 437 (enc.GetString)
' and inline ("┼═║") (keyboard: Alt+2501, Alt+2509, Alt+2490).
Me.TextBox1.Text = ChrW(&H255E) & ChrW(&H256A) & ChrW(&H256C) & ChrW(&H2563) _
& enc.GetString(New Byte() {32, &HC6, &HD8, &HCE, &HB9}) _
& " ─│┌┐└┘├┤┬┴┼═║╒╓╔ ╖╗╘╙╚╛╜╝╞╟*╡╢╣╤╥ ╧╨╩╪╫╬▀▄█▌▐░▒▓"
Me.TextBox2.Text = ChrW(&H255E) & ChrW(&H256A) & ChrW(&H256C) & ChrW(&H2563) _
& enc.GetString(New Byte() {32, &HC6, &HD8, &HCE, &HB9}) _
& " ─│┌┐└┘├┤┬┴┼═║╒╓╔ ╖╗╘╙╚╛╜╝╞╟*╡╢╣╤╥ ╧╨╩╪╫╬▀▄█▌▐░▒▓"
End Sub

Now, if you delete the "Me.TextBox2.Font = ..." statement, you will see that TextBox2 displays only empty boxes.
Of course, you can set Font.GDICharSet to 255 at design time.

You can use the charmap to see the codes corresponding to the graphic characters and if a font of your system supports them.

Note that this message has been coded with UTF-8 in order to keep the graphic characters. When you use special characters inline, you must save the code file (*.vb) encoding it, for example, with UTF-8, or other coding that supports the special characters.

Note also that Windows 98 and Me TextBoxes are not fully compatible with Unicode and "┼═║" might be displayed as "+-|"

Regards.
"David Scemama" <da***********@wanadoo.fr> escribió en el mensaje news:%2***************@TK2MSFTNGP10.phx.gbl...
| Hi,
|
| I'm looking for a way to display semi graphic characters in a multi line
| text control or in a rich text control.
| I've tried with all the characters of the extended ASCII table (code page
| 437), they appear correctly except the semi graphic ones.
|
| Please help ...
|
| Thanks a lot
| David

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steven | last post by:
Hi there, I have a list of values that I am displaying in a table (Not using a loop) I want to be able to put a graphic next to the item with the hightest price. I have all of the prices in...
0
by: api | last post by:
I'm using XSL stylesheets and XML documents to generate PDF files with xsltproc, then fop. The problem is, I can't get images to show up in the PDF (the text showing up in the fo file, though). ...
0
by: David | last post by:
I am using CGI.pm and GD to make a page that generates a diagram based on some form input. The problem I have is under IE (Netscape seems to work correctly) the new graphic that is generated is not...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
13
by: Aladdin | last post by:
I have an MS Access form on which I have a listbox listing tables in that database. I want to be able to click on any of those tables and view its contents on the same form using subforms or any...
2
by: pei_world | last post by:
Hi I want to create a image with multiple layers on top. the background color of each layer should be transparent except the last one, hence I can only see the drawed items on such layers. can...
2
by: alain.hogue | last post by:
I have a table "tblCards" with a field "Titre" that contain french words (Hbert, Gagn, Hlne, etc....) in an database with SQLEXPRESS 2005. I have used the asp:SqlDataSource to filter the...
0
by: anjachow | last post by:
The system generated email that are automatically sent displaying well in any web-based mail systems (yahoo, msn, etc...). The foreign characters (vowels with accents and the ) aren't displaying...
1
by: natural | last post by:
Good Day. I am currently via Form send data to a word template.. I have about 150 bookmarks in a word document which was previously imported via a simular document. and appended into my DB. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.