本文整理汇总了C#中fyiReporting.RDL.List.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToArray方法的具体用法?C# List.ToArray怎么用?C# List.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fyiReporting.RDL.List
的用法示例。
在下文中一共展示了List.ToArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HighlightString
private void HighlightString(Graphics g, PageText dtext, RectangleF r, Font f, StringFormat sf)
{
if (_HighlightText == null || _HighlightText.Length == 0)
return; // nothing to highlight
bool bhighlightItem = dtext == _HighlightItem ||
(_HighlightItem != null && dtext.HtmlParent == _HighlightItem);
if (!(_HighlightAll || bhighlightItem))
return; // not highlighting all and not on current highlight item
string hlt = _HighlightCaseSensitive ? _HighlightText : _HighlightText.ToLower();
string text = _HighlightCaseSensitive ? dtext.Text : dtext.Text.ToLower();
if (text.IndexOf(hlt) < 0)
return; // string not in text
StringFormat sf2 = null;
try
{
// Create a CharacterRange array with the highlight location and length
// Handle multiple occurences of text
List<CharacterRange> rangel = new List<CharacterRange>();
int loc = text.IndexOf(hlt);
int hlen = hlt.Length;
int len = text.Length;
while (loc >= 0)
{
rangel.Add(new CharacterRange(loc, hlen));
if (loc + hlen < len) // out of range of text
loc = text.IndexOf(hlt, loc + hlen);
else
loc = -1;
}
if (rangel.Count <= 0) // we should have gotten one; but
return;
CharacterRange[] ranges = rangel.ToArray();
// Construct a new StringFormat object.
sf2 = sf.Clone() as StringFormat;
// Set the ranges on the StringFormat object.
sf2.SetMeasurableCharacterRanges(ranges);
// Get the Regions to highlight by calling the
// MeasureCharacterRanges method.
if (r.Width <= 0 || r.Height <= 0)
{
SizeF ts = g.MeasureString(dtext.Text, f);
r.Height = ts.Height;
r.Width = ts.Width;
}
Region[] charRegion = g.MeasureCharacterRanges(dtext.Text, f, r, sf2);
// Fill in the region using a semi-transparent color to highlight
foreach (Region rg in charRegion)
{
Color hl = bhighlightItem ? _HighlightItemColor : _HighlightAllColor;
g.FillRegion(new SolidBrush(Color.FromArgb(50, hl)), rg);
}
}
catch { } // if highlighting fails we don't care; need to continue
finally
{
if (sf2 != null)
sf2.Dispose();
}
}
示例2: MeasureString
//.........这里部分代码省略.........
if (ptWidth <= 0)
ptWidth = 1;
foreach (string tfl in flines)
{
string fl;
if (tfl.Length > 0 && tfl[tfl.Length-1] == ' ')
fl = tfl.TrimEnd(' ');
else
fl = tfl;
// Check if entire string fits into a line
ms = MeasureString(fl, g, drawFont, drawFormat);
float tw = RSize.PointsFromPixels(g, ms.Width);
if (tw <= ptWidth)
{ // line fits don't need to break it down further
lines.Add(fl);
lineWidths.Add(tw);
continue;
}
// Line too long; need to break into multiple lines
// 1) break line into parts; then build up again keeping track of word positions
string[] parts = fl.Split(wordBreak); // this is the maximum split of lines
StringBuilder sb = new StringBuilder(fl.Length);
CharacterRange[] cra = new CharacterRange[parts.Length];
for (int i = 0; i < parts.Length; i++)
{
int sc = sb.Length; // starting character
sb.Append(parts[i]); // endding character
if (i != parts.Length - 1) // last item doesn't need blank
sb.Append(" ");
int ec = sb.Length;
CharacterRange cr = new CharacterRange(sc, ec - sc);
cra[i] = cr; // add to character array
}
// 2) Measure the word locations within the line
string wfl = sb.ToString();
WordStartFinish[] wordLocations = MeasureString(wfl, g, drawFont, drawFormat, cra);
if (wordLocations == null)
continue;
// 3) Loop thru creating new lines as needed
int startLoc = 0;
CharacterRange crs = cra[startLoc];
CharacterRange cre = cra[startLoc];
float cwidth = wordLocations[0].end; // length of the first
float bwidth = wordLocations[0].start; // characters need a little extra on start
string ts;
bool bLine = true;
for (int i=1; i < cra.Length; i++)
{
cwidth = wordLocations[i].end - wordLocations[startLoc].start + bwidth;
if (cwidth > ptWidth)
{ // time for a new line
cre = cra[i-1];
ts = wfl.Substring(crs.First, cre.First + cre.Length - crs.First);
lines.Add(ts);
lineWidths.Add(wordLocations[i-1].end - wordLocations[startLoc].start + bwidth);
// Find the first non-blank character of the next line
while (i < cra.Length &&
cra[i].Length == 1 &&
fl[cra[i].First] == ' ')
{
i++;
}
if (i < cra.Length) // any lines left?
{ // yes, continue on
startLoc = i;
crs = cre = cra[startLoc];
cwidth = wordLocations[i].end - wordLocations[startLoc].start + bwidth;
}
else // no, we can stop
bLine = false;
// bwidth = wordLocations[startLoc].start - wordLocations[startLoc - 1].end;
}
else
cre = cra[i];
}
if (bLine)
{
ts = fl.Substring(crs.First, cre.First + cre.Length - crs.First);
lines.Add(ts);
lineWidths.Add(cwidth);
}
}
// create the final array from the Lists
string[] la = lines.ToArray();
width = lineWidths.ToArray();
return la;
}
finally
{
if (drawFont != null)
drawFont.Dispose();
if (drawFormat != null)
drawFont.Dispose();
}
}
示例3: BuildContextMenus
private void BuildContextMenus()
{
// EDIT MENU
menuCopy = new MenuItem("&Copy", new EventHandler(this.menuCopy_Click));
menuPaste = new MenuItem("Paste", new EventHandler(this.menuPaste_Click));
menuDelete = new MenuItem("&Delete", new EventHandler(this.menuDelete_Click));
menuFSep1 = new MenuItem("-");
menuSelectAll = new MenuItem("Select &All", new EventHandler(this.menuSelectAll_Click));
menuFSep2 = new MenuItem("-");
List<MenuItem> insertItems = new List<MenuItem>();
insertItems.Add(new MenuItem("&Chart...", new EventHandler(this.menuInsertChart_Click)));
insertItems.Add(new MenuItem("&Image", new EventHandler(this.menuInsertImage_Click)));
insertItems.Add(new MenuItem("&Line", new EventHandler(this.menuInsertLine_Click)));
insertItems.Add(new MenuItem("&List", new EventHandler(this.menuInsertList_Click)));
insertItems.Add(new MenuItem("&Matrix...", new EventHandler(this.menuInsertMatrix_Click)));
insertItems.Add(new MenuItem("&Rectangle", new EventHandler(this.menuInsertRectangle_Click)));
insertItems.Add(new MenuItem("&Subreport", new EventHandler(this.menuInsertSubreport_Click)));
insertItems.Add(new MenuItem("Ta&ble...", new EventHandler(this.menuInsertTable_Click)));
insertItems.Add(new MenuItem("&Textbox", new EventHandler(this.menuInsertTextbox_Click)));
// Now add any CustomReportItems
BuildContextMenusCustom(insertItems);
menuInsert = new MenuItem("&Insert");
menuInsert.MenuItems.AddRange(insertItems.ToArray());
menuProperties = new MenuItem("&Properties...", new EventHandler(this.menuProperties_Click));
//
// Create chart context menu and add array of sub-menu items
menuPropertiesLegend = new MenuItem("Legend...", new EventHandler(this.menuPropertiesLegend_Click));
menuPropertiesCategoryAxis = new MenuItem("Category (X) Axis...", new EventHandler(this.menuPropertiesCategoryAxis_Click));
menuPropertiesValueAxis = new MenuItem("Value (Y) Axis...", new EventHandler(this.menuPropertiesValueAxis_Click));
menuPropertiesCategoryAxisTitle = new MenuItem("Category (X) Axis Title...", new EventHandler(this.menuPropertiesCategoryAxisTitle_Click));
menuPropertiesValueAxisTitle = new MenuItem("Value (Y) Axis Title...", new EventHandler(this.menuPropertiesValueAxisTitle_Click));
menuPropertiesChartTitle = new MenuItem("Title...", new EventHandler(this.menuPropertiesChartTitle_Click));
}
示例4: MatchFuncIDent
//.........这里部分代码省略.........
List<IExpr> largs = new List<IExpr>();
while(true)
{
if (curToken.Type == TokenTypes.RPAREN)
{ // We've got our function
curToken = tokens.Extract();
break;
}
if (argCount == 0)
{
// don't need to do anything
}
else if (curToken.Type == TokenTypes.COMMA)
{
curToken = tokens.Extract();
}
else
throw new ParserException("Invalid function arguments. Found '" + curToken.Value + "' At column " + Convert.ToString(curToken.StartCol));
MatchExprAndOr(out e);
if (e == null)
throw new ParserException("Expecting ',' or ')'. Found '" + curToken.Value + "' At column " + Convert.ToString(curToken.StartCol));
largs.Add(e);
argCount++;
}
if (_InAggregate)
{
ResolveFields(method, this._FieldResolve, largs);
_FieldResolve = null;
_InAggregate = false;
}
IExpr[] args = largs.ToArray();
object scope;
bool bSimple;
if (!bOnePart)
{
result = (firstPart == "Parameters")?
ResolveParametersMethod(method, thirdPart, args):
ResolveMethodCall(fullname, args); // throw exception when fails
}
else switch(method.ToLower())
{
case "iif":
if (args.Length != 3)
throw new ParserException("iff function requires 3 arguments." + " At column " + Convert.ToString(curToken.StartCol));
// We allow any type for the first argument; it will get converted to boolean at runtime
// if (args[0].GetTypeCode() != TypeCode.Boolean)
// throw new ParserException("First argument to iif function must be boolean." + " At column " + Convert.ToString(curToken.StartCol));
result = new FunctionIif(args[0], args[1], args[2]);
break;
case "choose":
if (args.Length <= 2)
throw new ParserException("Choose function requires at least 2 arguments." + " At column " + Convert.ToString(curToken.StartCol));
switch (args[0].GetTypeCode())
{
case TypeCode.Double:
case TypeCode.Single:
case TypeCode.Int32:
case TypeCode.Decimal:
case TypeCode.Int16:
case TypeCode.Int64:
break;
default:
示例5: MatchFuncIDent
//.........这里部分代码省略.........
List<IExpr> largs = new List<IExpr>();
while(true)
{
if (curToken.Type == TokenTypes.RPAREN)
{ // We've got our function
curToken = tokens.Extract();
break;
}
if (argCount == 0)
{
// don't need to do anything
}
else if (curToken.Type == TokenTypes.COMMA)
{
curToken = tokens.Extract();
}
else
throw new ParserException(Strings.Parser_ErrorP_Invalid_function_arguments + GetLocationInfoWithValue(curToken));
MatchExprAndOr(out e);
if (e == null)
throw new ParserException(Strings.Parser_ErrorP_ExpectingComma + GetLocationInfoWithValue(curToken));
largs.Add(e);
argCount++;
}
if (_InAggregate)
{
inAggregateDataSet = null;
_InAggregate = false;
}
IExpr[] args = largs.ToArray();
object scope;
bool bSimple;
if (!bOnePart)
{
result = (firstPart == "Parameters")?
ResolveParametersMethod(method, thirdPart, args):
ResolveMethodCall(fullname, args); // throw exception when fails
}
else switch(method.ToLower())
{
case "iif":
if (args.Length != 3)
throw new ParserException(Strings.Parser_ErrorP_iff_function_requires_3_arguments + GetLocationInfo(curToken));
// We allow any type for the first argument; it will get converted to boolean at runtime
// if (args[0].GetTypeCode() != TypeCode.Boolean)
// throw new ParserException("First argument to iif function must be boolean." + GetLocationInfo(curToken));
result = new FunctionIif(args[0], args[1], args[2]);
break;
case "choose":
if (args.Length <= 2)
throw new ParserException(Strings.Parser_ErrorP_ChooseRequires2Arguments + GetLocationInfo(curToken));
switch (args[0].GetTypeCode())
{
case TypeCode.Double:
case TypeCode.Single:
case TypeCode.Int32:
case TypeCode.Decimal:
case TypeCode.Int16:
case TypeCode.Int64:
case TypeCode.UInt16:
case TypeCode.UInt32: