This commit is contained in:
2010-07-22 14:19:45 +00:00
parent 40a0cd2d24
commit 6fb88b406b
5 changed files with 388 additions and 178 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
namespace VEPROMS.CSLA.Library
{
@@ -82,6 +83,32 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Printing_Length");
}
}
[Category("Printing")]
[DisplayName("Color")]
[Description("Color of Document Text")]
public Color Printing_Color
{
get
{
string sColor = _Xp["Printing", "Color"];
if (sColor == string.Empty) sColor = "Transparent";
if (sColor[0] == '[')
{
string[] parts = sColor.Substring(1, sColor.Length - 2).Split(",".ToCharArray());
return Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
}
else return Color.FromName(sColor);
}
set
{
if (value.IsNamedColor) _Xp["Printing", "Color"] = value.Name;
else
{
_Xp["Printing", "Color"] = string.Format("[{0},{1},{2}]", value.R, value.G, value.B);
}
OnPropertyChanged("Printing_Color");
}
}
#endregion
#region ToString
public override string ToString()

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.ComponentModel;
using System.Text.RegularExpressions;
namespace VEPROMS.CSLA.Library
{
@@ -774,5 +775,30 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region FortranFormat
public static string ConvertFortranFormatToScienctificNotation(string str)
{
// Convert E style numbers to RTF with \super and \nosupersub
string retval = Regex.Replace(str, "([+-]?)([0-9]+)[.]([0-9]*?)0*E([+-]?[0-9]+)", new MatchEvaluator(FixFortranNumber));
//retval = Regex.Replace(retval, "[#](.*?)[#]", "\\super $1\\nosupersub ");// DOS Superscript
//retval = Regex.Replace(retval, "[~](.*?)[~]", "\\sub $1\\nosupersub ");// DOS Subscript
retval = Regex.Replace(retval, "[#](.*?)[#]", "\\up3 $1\\up0 ");// DOS Superscript
retval = Regex.Replace(retval, "[~](.*?)[~]", "\\dn3 $1\\dn0 ");// DOS Subscript
return retval;
}
private static string FixFortranNumber(Match match)
{
StringBuilder sb = new StringBuilder(match.Groups[1].Value);
if (match.Groups[3].Length == 0) // Nothing to the right of the decimal
if (match.Groups[2].Value != "1") // Other than "1", multiply it times 10 raised to a power
sb.Append(match.Groups[2].Value + "x10");
else // The number is simply 1 so it can be ignored and 10 can be raised to a power
sb.Append("10");
else // A number with a decimal point
sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10");
// Add the exponent as superscript
return sb.ToString() + "\\up3 " + match.Groups[4].Value + "\\up0 ";
}
#endregion
}
}