本文整理汇总了C#中fyiReporting.RDL.StyleInfo类的典型用法代码示例。如果您正苦于以下问题:C# StyleInfo类的具体用法?C# StyleInfo怎么用?C# StyleInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StyleInfo类属于fyiReporting.RDL命名空间,在下文中一共展示了StyleInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public List<PageItem> Process(int Flags, byte[] RecordData)
{
MemoryStream _ms = null;
BinaryReader _br = null;
try
{
_ms = new MemoryStream(RecordData);
_br = new BinaryReader(_ms);
Byte[] PrivateData = _br.ReadBytes(RecordData.Length);
//Ok we should have our private data which I am storing my tooltip value in...
//now lets interpret it...
string PData = new System.Text.ASCIIEncoding().GetString(PrivateData);
//If string starts with "ToolTip" then lets do something with it.. otherwise I don't care about it.
if (PData.StartsWith("ToolTip"))
{
PageRectangle pr = new PageRectangle();
StyleInfo si = new StyleInfo();
pr.SI = si;
//si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
string[] ttd = PData.Split('|');
pr.Tooltip = ttd[0].Split(':')[1];
pr.X = X + Single.Parse(ttd[1].Split(':')[1]) * SCALEFACTOR;
pr.Y = Y + Single.Parse(ttd[2].Split(':')[1]) * SCALEFACTOR;
pr.W = Single.Parse(ttd[3].Split(':')[1]) * SCALEFACTOR;
pr.H = Single.Parse(ttd[4].Split(':')[1]) * SCALEFACTOR;
items.Add(pr);
}
else if (PData.StartsWith("PolyToolTip"))
{
PagePolygon pp = new PagePolygon();
StyleInfo si = new StyleInfo();
pp.SI = si;
//si.BackgroundColor = Color.Blue;// Just a test to see where the tooltip is being drawn
string[] ttd = PData.Split('|');
PointF[] pts = new PointF[(ttd.Length - 1) / 2];
pp.Points = pts;
pp.Tooltip = ttd[0].Split(':')[1];
for (int i = 0; i < pts.Length; i++)
{
pts[i].X = X + Single.Parse(ttd[i*2 +1]) * SCALEFACTOR;
pts[i].Y = Y + Single.Parse(ttd[i*2 +2]) * SCALEFACTOR;
}
items.Add(pp);
}
return items;
}
finally
{
if (_br != null)
_br.Close();
if (_ms != null)
_ms.Dispose();
}
}
示例2: AddCurve
//
internal void AddCurve(PointF[] pts, StyleInfo si)
{
if (pts.Length > 2)
{ // do a spline curve
PointF[] tangents = GetCurveTangents(pts);
DoCurve(pts, tangents, si);
}
else
{ // we only have two points; just do a line segment
AddLine(pts[0].X, pts[0].Y, pts[1].X, pts[1].Y, si);
}
}
示例3: GetPdfFont
internal string GetPdfFont(StyleInfo si)
{
string face = FontNameNormalize(si.FontFamily);
if (face == "Times-Roman" &&
(si.IsFontBold() || si.FontStyle == FontStyleEnum.Italic))
face = "Times";
if (si.IsFontBold() &&
si.FontStyle == FontStyleEnum.Italic) // bold and italic?
face = face + "-BoldOblique";
else if (si.IsFontBold()) // just bold?
face = face + "-Bold";
else if (si.FontStyle == FontStyleEnum.Italic)
face = face + "-Oblique";
return GetPdfFont(face);
}
示例4: DrawBackground
private void DrawBackground(Graphics g, System.Drawing.RectangleF rect, StyleInfo si)
{
LinearGradientBrush linGrBrush = null;
SolidBrush sb = null;
HatchBrush hb = null;
try
{
if (si.BackgroundGradientType != BackgroundGradientTypeEnum.None &&
!si.BackgroundGradientEndColor.IsEmpty &&
!si.BackgroundColor.IsEmpty)
{
Color c = si.BackgroundColor;
Color ec = si.BackgroundGradientEndColor;
switch (si.BackgroundGradientType)
{
case BackgroundGradientTypeEnum.LeftRight:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.TopBottom:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical);
break;
case BackgroundGradientTypeEnum.Center:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.DiagonalLeft:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.ForwardDiagonal);
break;
case BackgroundGradientTypeEnum.DiagonalRight:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.BackwardDiagonal);
break;
case BackgroundGradientTypeEnum.HorizontalCenter:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Horizontal);
break;
case BackgroundGradientTypeEnum.VerticalCenter:
linGrBrush = new LinearGradientBrush(rect, c, ec, LinearGradientMode.Vertical);
break;
default:
break;
}
}
if (si.PatternType != patternTypeEnum.None)
{
switch (si.PatternType)
{
case patternTypeEnum.BackwardDiagonal:
hb = new HatchBrush(HatchStyle.BackwardDiagonal, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.CheckerBoard:
hb = new HatchBrush(HatchStyle.LargeCheckerBoard, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.Cross:
hb = new HatchBrush(HatchStyle.Cross, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.DarkDownwardDiagonal:
hb = new HatchBrush(HatchStyle.DarkDownwardDiagonal, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.DarkHorizontal:
hb = new HatchBrush(HatchStyle.DarkHorizontal, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.DiagonalBrick:
hb = new HatchBrush(HatchStyle.DiagonalBrick, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.HorizontalBrick:
hb = new HatchBrush(HatchStyle.HorizontalBrick, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.LargeConfetti:
hb = new HatchBrush(HatchStyle.LargeConfetti, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.OutlinedDiamond:
hb = new HatchBrush(HatchStyle.OutlinedDiamond, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.SmallConfetti:
hb = new HatchBrush(HatchStyle.SmallConfetti, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.SolidDiamond:
hb = new HatchBrush(HatchStyle.SolidDiamond, si.Color, si.BackgroundColor);
break;
case patternTypeEnum.Vertical:
hb = new HatchBrush(HatchStyle.Vertical, si.Color, si.BackgroundColor);
break;
}
}
if (linGrBrush != null)
{
g.FillRectangle(linGrBrush, rect);
linGrBrush.Dispose();
}
else if (hb != null)
{
g.FillRectangle(hb, rect);
hb.Dispose();
}
else if (!si.BackgroundColor.IsEmpty)
{
sb = new SolidBrush(si.BackgroundColor);
g.FillRectangle(sb, rect);
sb.Dispose();
}
//.........这里部分代码省略.........
示例5: iAddLine
/// <summary>
/// Page line element at the X Y to X2 Y2 position
/// </summary>
/// <returns></returns>
private void iAddLine(float x, float y, float x2, float y2, StyleInfo si)
{
iAddLine(x, y, x2, y2, si.BWidthTop, si.BColorTop, si.BStyleTop);
}
示例6: iAddEllipse
//25072008 GJL Draw 4 bezier curves to approximate a circle
private void iAddEllipse(float x, float y, float height, float width, StyleInfo si, string url)
{
if (si.BStyleTop != BorderStyleEnum.None)
{
switch (si.BStyleTop)
{
case BorderStyleEnum.Dashed:
cb.SetLineDash(new float[] { '3', '2' }, 0);
break;
case BorderStyleEnum.Dotted:
cb.SetLineDash(new float[] { '2' }, 0);
break;
case BorderStyleEnum.Solid:
default:
cb.SetLineDash(new float[] { }, 0);
break;
}
cb.SetRGBColorStroke(si.BColorTop.R, si.BColorTop.G, si.BColorTop.B);
}
float RadiusX = (width / 2.0f);
float RadiusY = (height / 2.0f);
cb.Ellipse(x, _pSize.yHeight - y, x + RadiusX, y + RadiusY);
if (!si.BackgroundColor.IsEmpty)
{
cb.SetRGBColorStrokeF(si.BackgroundColor.R, si.BackgroundColor.G, si.BackgroundColor.B);
}
if (si.BackgroundColor.IsEmpty)
cb.ClosePathStroke();
else
cb.ClosePathFillStroke();
}
示例7: iDoCurve
private void iDoCurve(PointF[] points, PointF[] tangents, StyleInfo si)
{
int i;
for (i = 0; i < points.Length - 1; i++)
{
int j = i + 1;
float x0 = points[i].X;
float y0 = points[i].Y;
float x1 = points[i].X + tangents[i].X;
float y1 = points[i].Y + tangents[i].Y;
float x2 = points[j].X - tangents[j].X;
float y2 = points[j].Y - tangents[j].Y;
float x3 = points[j].X;
float y3 = points[j].Y;
iAddCurve(x0, y0, x1, y1, x2, y2, x3, y3, si, null);
}
}
示例8: iAddPolygon
/// <summary>
/// Page Polygon
/// </summary>
/// <param name="pts"></param>
/// <param name="si"></param>
/// <param name="url"></param>
/// <param name="patterns"></param>
internal void iAddPolygon(PointF[] pts, StyleInfo si, string url, PdfPattern patterns)
{
if (si.BackgroundColor.IsEmpty)
return; // nothing to do
// Get the fill color - could be a gradient or pattern etc...
System.Drawing.Color c = si.BackgroundColor;
iAddPoints(pts);
cb.SetRGBColorFill(c.R, c.G, c.B);
cb.ClosePathFillStroke();
//Not sure about iTextSharp Pattern => Need check
if (si.PatternType != patternTypeEnum.None)
{
string p = patterns.GetPdfPattern(si.PatternType.ToString());
StringBuilder elements = new StringBuilder();
c = si.Color;
double red = Math.Round((c.R / 255.0), 3);
double green = Math.Round((c.G / 255.0), 3);
double blue = Math.Round((c.B / 255.0), 3);
elements.AppendFormat("\r\nq");
elements.AppendFormat("\r\n /CS1 cs");
elements.AppendFormat("\r\n {0} {1} {2} /{3} scn", red, green, blue, p);
elements.AppendFormat("\r\n {0} {1} {2} RG", red, green, blue);
elements.AppendFormat("\tQ");
PdfPatternPainter pdfp = cb.CreatePattern(60f, 60f, 60f, 60f);
pdfp.SetLiteral(elements.ToString());
cb.SetPatternFill(pdfp);
iAddPoints(pts);
cb.ClosePathFillStroke();
}
}
示例9: iAddBorder
/// <summary>
/// Add border
/// </summary>
private void iAddBorder(StyleInfo si, float x, float y, float height, float width)
{
// Handle any border required TODO: optimize border by drawing a rect when possible
if (height <= 0 || width <= 0) // no bounding box to use
return;
float ybottom = (y + height);
float xright = x + width;
if (si.BStyleTop != BorderStyleEnum.None && si.BWidthTop > 0)
iAddLine(x, y, xright, y, si.BWidthTop, si.BColorTop, si.BStyleTop);
if (si.BStyleRight != BorderStyleEnum.None && si.BWidthRight > 0)
iAddLine(xright, y, xright, ybottom, si.BWidthRight, si.BColorRight, si.BStyleRight);
if (si.BStyleLeft != BorderStyleEnum.None && si.BWidthLeft > 0)
iAddLine(x, y, x, ybottom, si.BWidthLeft, si.BColorLeft, si.BStyleLeft);
if (si.BStyleBottom != BorderStyleEnum.None && si.BWidthBottom > 0)
iAddLine(x, ybottom, xright, ybottom, si.BWidthBottom, si.BColorBottom, si.BStyleBottom);
return;
}
示例10: DoInstructions
private void DoInstructions(Single recX, Single recY, Single recWidth, Single recHeight, Pen p,Single StartAngle,Single SweepAngle)
{
BorderStyleEnum ls = getLineStyle(p);
switch (p.Brush.GetType().Name)
{
case "SolidBrush":
System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush;
PagePie pl = new PagePie();
pl.StartAngle = StartAngle;
pl.SweepAngle = SweepAngle;
pl.X = X + recX * SCALEFACTOR;
pl.Y = Y + recY * SCALEFACTOR;
pl.W = recWidth * SCALEFACTOR;
pl.H = recHeight * SCALEFACTOR;
StyleInfo SI = new StyleInfo();
SI.Color = theBrush.Color;
SI.BColorTop = SI.BColorBottom = SI.BColorLeft = SI.BColorRight = theBrush.Color;
SI.BStyleTop = SI.BStyleBottom = SI.BStyleLeft = SI.BStyleRight = ls;
SI.BWidthTop = SI.BWidthBottom = SI.BWidthLeft = SI.BWidthRight = p.Width * SCALEFACTOR;
pl.SI = SI;
items.Add(pl);
break;
default:
break;
}
}
示例11: DoInstructions
private void DoInstructions(PointF[] points, Pen p, UInt32 Offset, UInt32 NumberOfPoints, float Tension)
{
BorderStyleEnum ls = getLineStyle(p);
//Well we only draw lines at the moment....
switch (p.Brush.GetType().Name)
{
case "SolidBrush":
System.Drawing.SolidBrush theBrush = (System.Drawing.SolidBrush)p.Brush;
PageCurve pc = new PageCurve();
for (int i = 0; i < points.Length; i++)
{
points[i].X = X + points[i].X * SCALEFACTOR;
points[i].Y = Y + points[i].Y * SCALEFACTOR;
}
pc.Points = points;
pc.Offset = (int) Offset;
pc.Tension = Tension;
StyleInfo SI = new StyleInfo();
SI.Color = theBrush.Color;
SI.BColorTop = theBrush.Color;
SI.BStyleTop = ls;
SI.BWidthTop = p.Width * SCALEFACTOR;
SI.BColorBottom = theBrush.Color;
SI.BStyleBottom = ls;
SI.BWidthBottom = p.Width * SCALEFACTOR;
SI.BColorLeft = theBrush.Color;
SI.BStyleLeft = ls;
SI.BWidthLeft = p.Width * SCALEFACTOR;
SI.BColorRight = theBrush.Color;
SI.BStyleRight = ls;
SI.BWidthRight = p.Width * SCALEFACTOR;
pc.SI = SI;
items.Add(pc);
break;
default:
break;
}
}
示例12: MeasureString
private SizeF MeasureString(string s, StyleInfo si, Graphics g, out float descent)
{
Font drawFont=null;
StringFormat drawFormat=null;
SizeF ms = SizeF.Empty;
descent = 0;
if (s == null || s.Length == 0)
return ms;
try
{
// STYLE
System.Drawing.FontStyle fs = 0;
if (si.FontStyle == FontStyleEnum.Italic)
fs |= System.Drawing.FontStyle.Italic;
// WEIGHT
switch (si.FontWeight)
{
case FontWeightEnum.Bold:
case FontWeightEnum.Bolder:
case FontWeightEnum.W500:
case FontWeightEnum.W600:
case FontWeightEnum.W700:
case FontWeightEnum.W800:
case FontWeightEnum.W900:
fs |= System.Drawing.FontStyle.Bold;
break;
default:
break;
}
try
{
FontFamily ff = si.GetFontFamily();
drawFont = new Font(ff, si.FontSize, fs);
// following algorithm comes from the C# Font Metrics documentation
float descentPixel = si.FontSize * ff.GetCellDescent(fs) / ff.GetEmHeight(fs);
descent = RSize.PointsFromPixels(g, descentPixel);
}
catch
{
drawFont = new Font("Arial", si.FontSize, fs); // usually because font not found
descent = 0;
}
drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Near;
CharacterRange[] cr = {new CharacterRange(0, s.Length)};
drawFormat.SetMeasurableCharacterRanges(cr);
Region[] rs = new Region[1];
rs = g.MeasureCharacterRanges(s, drawFont, new RectangleF(0,0,float.MaxValue,float.MaxValue),
drawFormat);
RectangleF mr = rs[0].GetBounds(g);
ms.Height = RSize.PointsFromPixels(g, mr.Height); // convert to points from pixels
ms.Width = RSize.PointsFromPixels(g, mr.Width); // convert to points from pixels
return ms;
}
finally
{
if (drawFont != null)
drawFont.Dispose();
if (drawFormat != null)
drawFont.Dispose();
}
}
示例13: HandleStyleString
private void HandleStyleString(string style, StyleInfo si)
{
if (style == null || style.Length < 1)
return;
string[] styleList = style.Split(new char[] {';'});
foreach (string item in styleList)
{
string[] val = item.Split(new char[] {':'});
if (val.Length != 2)
continue; // must be illegal syntax
string tval = val[1].Trim();
switch (val[0].ToLower().Trim())
{
case "background":
case "background-color":
si.BackgroundColor = XmlUtil.ColorFromHtml(tval, si.Color);
break;
case "color":
si.Color = XmlUtil.ColorFromHtml(tval, si.Color);
break;
case "font-family":
si.FontFamily = tval;
break;
case "font-size":
HandleStyleFontSize(si, tval);
break;
case "font-style":
if (tval == "italic")
si.FontStyle = FontStyleEnum.Italic;
break;
case "font-weight":
HandleStyleFontWeight(si, tval);
break;
}
}
return;
}
示例14: HandleStyleFontWeight
private void HandleStyleFontWeight(StyleInfo si, string w)
{
try
{
switch (w)
{
case "bold":
si.FontWeight = FontWeightEnum.Bold;
break;
case "bolder":
if (si.FontWeight > FontWeightEnum.Bolder)
{
if (si.FontWeight < FontWeightEnum.W900)
si.FontWeight++;
}
else if (si.FontWeight == FontWeightEnum.Normal)
si.FontWeight = FontWeightEnum.W700;
else if (si.FontWeight == FontWeightEnum.Bold)
si.FontWeight = FontWeightEnum.W900;
else if (si.FontWeight != FontWeightEnum.Bolder)
si.FontWeight = FontWeightEnum.Normal;
break;
case "lighter":
if (si.FontWeight > FontWeightEnum.Bolder)
{
if (si.FontWeight > FontWeightEnum.W100)
si.FontWeight--;
}
else if (si.FontWeight == FontWeightEnum.Normal)
si.FontWeight = FontWeightEnum.W300;
else if (si.FontWeight == FontWeightEnum.Bold)
si.FontWeight = FontWeightEnum.W400;
else if (si.FontWeight != FontWeightEnum.Lighter)
si.FontWeight = FontWeightEnum.Normal;
break;
case "normal":
si.FontWeight = FontWeightEnum.Normal;
break;
case "100":
si.FontWeight = FontWeightEnum.W100;
break;
case "200":
si.FontWeight = FontWeightEnum.W200;
break;
case "300":
si.FontWeight = FontWeightEnum.W300;
break;
case "400":
si.FontWeight = FontWeightEnum.W400;
break;
case "500":
si.FontWeight = FontWeightEnum.W500;
break;
case "600":
si.FontWeight = FontWeightEnum.W600;
break;
case "700":
si.FontWeight = FontWeightEnum.W700;
break;
case "800":
si.FontWeight = FontWeightEnum.W800;
break;
case "900":
si.FontWeight = FontWeightEnum.W900;
break;
}
}
catch {} // lots of user errors will cause an exception; ignore
return;
}
示例15: HandleStyleFontSize
private void HandleStyleFontSize(StyleInfo si, string size)
{
try
{
int i = size.IndexOf("pt");
if (i > 0)
{
size = size.Remove(i, 2);
float n = (float) Convert.ToDouble(size);
if (size[0] == '+')
si.FontSize += n;
else
si.FontSize = n;
return;
}
i = size.IndexOf("%");
if (i > 0)
{
size = size.Remove(i, 1);
float n = (float) Convert.ToDouble(size);
si.FontSize = n*si.FontSize;
return;
}
switch (size)
{
case "xx-small":
si.FontSize = 6;
break;
case "x-small":
si.FontSize = 8;
break;
case "small":
si.FontSize = 10;
break;
case "medium":
si.FontSize = 12;
break;
case "large":
si.FontSize = 14;
break;
case "x-large":
si.FontSize = 16;
break;
case "xx-large":
si.FontSize = 18;
break;
case "1":
si.FontSize = 8;
break;
case "2":
si.FontSize = 10;
break;
case "3":
si.FontSize = 12;
break;
case "4":
si.FontSize = 14;
break;
case "5":
si.FontSize = 18;
break;
case "6":
si.FontSize = 24;
break;
case "7":
si.FontSize = 36;
break;
}
}
catch {} // lots of user errors will cause an exception; ignore
return;
}