|
Hello,
I'm playing around with Shripad Kulkarni's C# TELNET Client - mostly refactoring what he had done and expanding it out to support ANSI (and maybe VT-100 emulation). I've just finished implementing the rest of the telnet protocol.
However, I'm having problems with the font selection.
I'm trying to select a font that will display the original 8-bit OEM/IBM-PC8 font (with all the line characters, etc).
Here is the font I'm using:
System.Drawing.Font( "Lucinda Console",
10.2F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
( ( System.Byte )( 255 ) ) );
I've tried both 0 (ANSI) and 255 (OEM) for the last argument.
The text buffers go through a few Encoding.ASCII.GetString() calls too.
Thanks for your help.
Dale Thompson
|
|
|
|
|
Dale Thompson wrote:
I'm trying to select a font that will display the original 8-bit OEM/IBM-PC8 font (with all the line characters, etc).
Here is the font I'm using:
System.Drawing.Font( "Lucinda Console",
10.2F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
( ( System.Byte )( 255 ) ) );
I've tried both 0 (ANSI) and 255 (OEM) for the last argument.
The text buffers go through a few Encoding.ASCII.GetString() calls too.
If anyone is interested, I found (guessed) the answer to this question.
Unrelated to the problem - my code snippet had an error, it is "Lucida Console" (not Lucinda).
But the key to the problem has to do with the "Encoding.ASCII.GetString()" calls
The provided ASCII encoding only support 7 bit ASCII. This is where the translation from 16 bit Unicode to what is displayed happens - anything that is 128 or above isn't supported by the supplied ASCII encoding.
The trick is to use the right codepage for the encoding. In this case, after a little research, I found that I needed to use the old IBM Codepage 437!
So - using "Encoding.GetEncoding( 437 ).GetString()" corrects the problem and displays
PC graphics characters!
Hope this info is of use to someone out there!
Dale Thompson
|
|
|
|
|
Hi!
There is two schema here, one refer another's attribute definition.
test.xsd
===========================================
<schema targetnamespace="http://www.nope.org/nope" xmlns:xlink="http://www.nope.org/nope" xmlns="http://www.w3.org/2001/XMLSchema" elementformdefault="qualified">
<attribute name="role" type="string">
=============================================
user.xsd
=============================================
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.nope.org/nope" elementformdefault="qualified" attributeformdefault="unqualified">
<xs:import namespace="http://www.nope.org/nope" schemalocation="D:\vcnet_proj\test.xsd">
<xs:element name="Root">
<xs:complextype>
<xs:attribute ref="test:role">
==============================================
.Net provided a fairly good tool call xsd, which can transfer xml schema definition into C#'s class definition. By this tool we can easily couple with data's serialization.
but this time xsd can't do it.
I typed:
xsd user.xsd /c
xsd tell me that http://www.nope.org/nope:role doesn't declared. But when i examine it in the famouse xml editor xmlspy 4.2 it validates it without any complain.
Where is the fault i made?
|
|
|
|
|
sorry, i dont know why the code between "=" is missing. I repaste it here.
test.xsd
<schema targetnamespace="http://www.nope.org/nope" xmlns:xlink="http://www.nope.org/nope" xmlns="http://www.w3.org/2001/XMLSchema" elementformdefault="qualified">
<attribute name="role" type="string">
user.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.nope.org/nope" elementformdefault="qualified" attributeformdefault="unqualified">
<xs:import namespace="http://www.nope.org/nope" schemalocation="D:\vcnet_proj\test.xsd">
<xs:element name="Root">
<xs:complextype>
<xs:attribute ref="test:role">
|
|
|
|
|
test.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.nope.org/nope" xmlns:xlink="http://www.nope.org/nope" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<attribute name="role" type="string"/>
</schema>
user.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.nope.org/nope" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.nope.org/nope" schemaLocation="D:\vcnet_proj\test.xsd"/>
<xs:element name="Root">
<xs:complexType>
<xs:attribute ref="test:role"/>
</xs:complexType>
</xs:element>
</xs:schema>
|
|
|
|
|
Ive used tlbimp.exe to generate an assembly .DLL from a COM object's .TLB file, which seems to work fine. I've added a reference to it into a C# project, now I'm running into a simple interop problem that I just can't seem to get thru my head.
I've got a method on the COM object that did take a OLECHAR* pointer as a parameter, but the wrapper class lists this as a "ref ushort" parameter. I've been looking at what should be done here for marshalling the data, seems like it should be easy - but it's not clear. Can someone hit me on the head & make me understand?
Thanks,
JC
|
|
|
|
|
Dan I was wondering how long it would take you to find this?
|
|
|
|
|
We're pleased to announce that we at C# Corner have launched a .Net book
store. Now buy recommended books and products almost half off (at least 40%
off) the cover price. Source code updated to the final .NET release.
http://www.c-sharpcorner.com/store.asp
Thanks
C# Corner
|
|
|
|
|
I just would like to know if this is possible and is there any example to do it.
I have multiple form (MDI) which have a method that i would like to call from the parent MDI.
So I would like to click on a button in the parent MDI and the code will call the a specific method that is in the activeChild.
Does anyone have any ideal?
|
|
|
|
|
Hi all,
I am having problems with web services. I've read tons of articles and im still stuck!
I have Visual Studio.NET (VS) installed and Personal Web Server (PWS) and have created a c# web service and built it. However when I attempt to look at the .asmx file I do not get the *user friendly* description of the web service and option to invoke it - Instead I get the raw text from the .asmx file!
I'm sure this is something simple but what?
Thanks in advance!
Dave
|
|
|
|
|
Hi Dave,
I think your problem is that you want to be running IIS on your web server with your .asmx web service file. As stated in VS.NET help if you bypass IIS and ASP.NET "you will just see the plain text in the .asmx file" when viewing a .asmx file in a browser/VS.NET.
Hope this helps,
Paul
Paul Hutchinson
IT Consultant/Analyst Programmer
|
|
|
|
|
Hi all,
I'm writing a notepad-like program using C#
I want to use the Popup event of the Edit menu to disable the paste menu command when the clipboard does not contain any text.
can any one help?
also how to get the Ascii code for a character and vise-vesa?
|
|
|
|
|
You would need to add this code to disable a menu item:
MenuItem.Enabled = false;
And check out the Clipboard subtopics in the index of the .NET Framework SDK Documentation for clipboard info.
hspc wrote:
also how to get the Ascii code for a character and vise-vesa?
I also would like to know this
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
if your text is stored in single-byte strings you can convert a character to a byte and the value will be the ASCII code. By default strings are stored as Unicode and the char type is two bytes instead of one to reflect this.
You can convert a string to ASCII bytes by using byte [] bytes = System.Text.ASCIIEncoding.ASCII.GetBytes(myString);
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thank you!
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
thanx all for assisstance
|
|
|
|
|
Hi,
I've been looking over the Collection classes available through the .NET framework and it seems that LinkedList hasn't been provided (Unless it is in some other namespace which I haven't checked - If so could you point it out - Thanks!).
Any ideas as to why they haven't included it in the Framework? It is a very useful data structure and has many uses just as ArrayList does.
Actually... it would be a good article to compare the Collections framework that .NET and Java provide. Cause I know that the Java Collections framework is heavily based on inheritance and abstract classes. It would be an interesting article to see the differences between them.
As a side question - Are the .NET Enumerators the same as the Java Iterators?
Thanks very much.
Mohnish
|
|
|
|
|
mohn3310 wrote:
Any ideas as to why they haven't included it in the Framework?
Good question, it does seem odd that it isn't there. You could easily create your own version of it though. If you don't know how to create a linked list there are many places on the web that will give you code for doing it
mohn3310 wrote:
Are the .NET Enumerators the same as the Java Iterators?
Enumerators in .NET are used to go through a collection an element at a time.
IEnumerator ie = myCollection.GetEnumerator();
while(ie.MoveNext) {
System.Console.WriteLine("object: " + ie.Current.ToString());
} or if you are using C# you can use foreach
foreach(object foo in myCollection) {
System.Console.WriteLine("object: " + foo.ToString();
} Simple, eh?
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thanks James!
Yes, LinkedLists are relatively simple to create and there are lots of examples on the web, but I was just wondering why they didn't include it since it's such a generic data structure.
Normally we would create wrappers to ArrayLists or LinkedLists to make them typesafe (using our own classes) rather than using Objects.
Yeah, enumerators do seem to act like iterators in java.
Cool... thnx again
Mohnish
|
|
|
|
|
mohn3310 wrote:
Normally we would create wrappers to ArrayLists or LinkedLists to make them typesafe (using our own classes) rather than using Objects.
Microsoft has made that part easier on us developers
Collection Generator for .NET 1.0 creates a collection based on ArrayLists to store objects of a specified type.
Until .NET supports generics this is the best solution to it.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I learned in some articles here describing using DHTML new feature in MFC7.
Will it be possible to use such a control in windows forms (not web form)? I hope it will ease the maintainment of the user interface, and maybe provide a way that user can custom his favourite dialog.
and another question is there in any corner of visual studio .net that two columns list control which studio used to edit properties provided? does microsoft kind enough to provide us a such powerful control? I wanna use it to set some object's properties in my form.
|
|
|
|
|
Chen, Fu wrote:
Will it be possible to use such a control in windows forms (not web form)?
You'll have to look at using hosting the web browser control on your form to use anything with DHTML. I'm not sure if it supports DHTML by default or if you have to do some coding to add that functionality.
Chen, Fu wrote:
and another question is there in any corner of visual studio .net that two columns list control which studio used to edit properties provided? does microsoft kind enough to provide us a such powerful control? I wanna use it to set some object's properties in my form.
Look for the PropertyGrid, right click on the toolbox and choose "customize toolbox" then goto the .NET Framework Controls tab, you should find the PropertyGrid there.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
yeah, i find the PropertyGrid now! it's very helpful to change the control's property at runtime.
Thanks!
|
|
|
|
|
C#'s compiled result is a exe in CLR code.
it said required JIT run.
does it mean compile to native code once software is deployed?
or compile each time we used it?
will it be a burden when we develop a fairly big application?
|
|
|
|
|
The JIT compiles each method as it is executed for the first time while running. This is why startup time for a .NET program is so long. You can get rid of the JIT by performing an install time JIT, ngen <assembly> will pre-JIT the code.
There is no guarantee the code won't be JITted again later. However I think it is a safe bet that won't happen since a reason to JIT is when the underlying IL has changed or it has been requested (usually for the above reason).
HTH,
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|