|
Sorry, I posted on the wrong question!!!
|
|
|
|
|
Yes,I'm lazy...what's the most straightforward way for vertical text?
|
|
|
|
|
If you want to display it in textbox, just split the string in it's characters and write one by one proceeded by new line.
|
|
|
|
|
Check this
string txt = textBox1.Text;
string outb = "";
for(int i=0;i outb +=txt[i]+"\n";
|
|
|
|
|
Use Matrix class to rotate by 90 and draw your text some thing like
Matrix matrix = new Matrix();
Point p=new Point(100,100);
matrix.RotateAt(90,p);
g.Transform = matrix;
SizeF size=g.MeasureString("Vertical String",this.Font);
RectangleF rect=new RectangleF(0,0,size.Width,size.Height);
g.DrawString("Vertical String",this.Font,new SolidBrush(Color.Blue),rect);
g.Dispose();
MCAD
-- modified at 20:12 Friday 9th September, 2005
|
|
|
|
|
Mohamad-- many thanks....
|
|
|
|
|
I'm using the following so I can format all my dates relvant to the current culture of the OS. The app is for global use
private DateTimeFormatInfo dtFormatInfo;
this.dtFormatInfo = Thread.CurrentThread.CurrentUICulture.DateTimeFormat;
I have then created a property to format any dates in ShortDatePattern
public string ShortDateFmt
{
get
{
return this.dtFormatInfo.ShortDatePattern;
}
}
Every time I run my application and process a date it returns in the format mm\dd\yyyy when running on an OS with United Kingdom setup (en-GB). en-GB date format should be dd/mm/yyyy
I have even created the follwing property so as to debug and check the CurrentUICulture
public string CurrentUICultureName
{
get
{
return Thread.CurrentThread.CurrentUICulture.Name;
}
}
and this is returning en-GB.
Any suggestions as to why the date is not formatting for en-GB
|
|
|
|
|
The ShortDatePattern does not specify the date separator, so when you use a pattern from a culture other than the current culture, the separator will still be taken from the current culture.
Use the CultureInfo object or DateTimeFormat object to format the date instead. They also contain information about the date separator.
---
b { font-weight: normal; }
|
|
|
|
|
okay I got my COM port settings being saved using XMLserializer but I cannot figure out how to get my settings to load from the XML file. Any help with this?
I'm using a class I found on Microsoft's website called CommBase. Here is my code to get the settings:
<br />
public bool LoadXMLSettings()<br />
{<br />
String XMLFileName = "Settings.xml";<br />
<br />
if (File.Exists(XMLFileName))<br />
{<br />
using(FileStream fs = new FileStream(XMLFileName, FileMode.Open))<br />
{<br />
miniterminal.CommBaseTermSettings ss = miniterminal.CommBaseTermSettings.LoadFromXML(fs);<br />
if (ss != null)<br />
{<br />
miniterminal.CommBaseTermSettings s = miniterminal.settings;<br />
MessageBox.Show(s.port);<br />
PortCombo.Text = s.port;<br />
fs.Close();<br />
return true;<br />
}<br />
fs.Close();<br />
}<br />
}<br />
return false;<br />
}<br />
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Rather than manually using the file stream to serialize bits and pieces of data, it may prove easier to simply throw the data you want saved into a class, then use System.Xml.Serialization.XmlSerializer to .Serialize() and .Deserialize() the class for you.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
|
Ok then, chances are you've got an invalid xml file (did you change the class since it was last serialized?). See if an error is being thrown in your catch clause.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Okay on exception I get "There is an error in xml document (2,2)".
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Sounds like the xml file is corrupted. Try deleting the existing (possibly old) xml file, save a new one, and try loading it. Do you still get the error?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Hey my parents live in chaska, and my sisters in Eden Praire
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
I am doing this:
<br />
public class CommBaseSettings <br />
{<br />
public string port = "COM1:";<br />
public int baudRate = 2400;<br />
public Parity parity = Parity.none;<br />
public int dataBits = 8;<br />
..........<br />
public void SaveAsXML(Stream s)<br />
{<br />
XmlSerializer sr = new XmlSerializer(this.GetType());<br />
sr.Serialize(s, this);<br />
}<br />
<br />
public static CommBaseSettings LoadFromXML(Stream s)<br />
{<br />
return LoadFromXML(s, typeof(CommBaseSettings));<br />
}<br />
<br />
protected static CommBaseSettings LoadFromXML(Stream s, Type t)<br />
{<br />
XmlSerializer sr = new XmlSerializer(t);<br />
try<br />
{<br />
return (CommBaseSettings)sr.Deserialize(s);<br />
}<br />
catch<br />
{<br />
return null;<br />
}<br />
}<br />
}<br />
But it returns null even though I know the file exists
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
it's up above
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am trying to implement a generic class, where the Generic type is a primitive type (uint, double, etc.). The class has a member variable that is an array of the generic type. In a member method, I want to access the array using pointers, but the compiler gives me the error:
Cannot take the address of, get the size of, or declare a pointer to a managed type ('T')
Is there any way to constrain the generic to be for a primitive type? Or is there any other workaround to accomplish this goal?
Below is the pseudo-code.
Thanks in advance!
class Image<T><br />
{<br />
T _pixels[];<br />
<br />
public Image<T> Cut(int top, int left, int width, int height)<br />
{<br />
unsafe<br />
{<br />
fixed(T* p = _pixels)
{<br />
...<br />
}<br />
}<br />
}<br />
}
Kim
|
|
|
|
|
Due to a limitation of the current generics implementation: there's no way to tell you're dealing with primitives. This may prove difficult for you, because you'll get this error as long as the compiler doesn't know you're dealing with primitives. It maybe be better to simply create specialized classes that contains integer, double, and so on.
I know there are some articles on this limitation, perhaps those will give you some insight.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Hi,
I have a statusbar with text. What I'm trying to do is make the text appear in the form of a tooltip whever text is too large to fit into the length of the statusbar panel. How can I accomplish that?
Thank you in advance.
|
|
|
|
|
Where do you want to display the ToolTip? Do you need the ToolTip on the mouse hover event of the statusbar panel?
|
|
|
|
|
Yes, just a basic tooltip unless there is a better way of displaying the text that is not completely visible in the statusbar.
|
|
|
|
|
All you need is drag drop a ToolTip object from the toolbox.
this.toolTip1.SetToolTip(this.StatusBarPanel1, "hello");
|
|
|
|