本文整理匯總了C#中Test2d.Record類的典型用法代碼示例。如果您正苦於以下問題:C# Record類的具體用法?C# Record怎麽用?C# Record使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Record類屬於Test2d命名空間,在下文中一共展示了Record類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Bind
/// <summary>
///
/// </summary>
/// <param name="r"></param>
public override void Bind(Record r)
{
base.Bind(r ?? this.Record);
}
示例2: Draw
/// <summary>
///
/// </summary>
/// <param name="gfx"></param>
/// <param name="qbezier"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public void Draw(object gfx, XQBezier qbezier, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var _gfx = gfx as Graphics;
Brush brush = ToSolidBrush(qbezier.Style.Fill);
Pen pen = ToPen(qbezier.Style, _scaleToPage);
double x1 = qbezier.Point1.X;
double y1 = qbezier.Point1.Y;
double x2 = qbezier.Point1.X + (2.0 * (qbezier.Point2.X - qbezier.Point1.X)) / 3.0;
double y2 = qbezier.Point1.Y + (2.0 * (qbezier.Point2.Y - qbezier.Point1.Y)) / 3.0;
double x3 = x2 + (qbezier.Point3.X - qbezier.Point1.X) / 3.0;
double y3 = y2 + (qbezier.Point3.Y - qbezier.Point1.Y) / 3.0;
double x4 = qbezier.Point3.X;
double y4 = qbezier.Point3.Y;
if (qbezier.IsFilled)
{
var path = new GraphicsPath();
path.AddBezier(
_scaleToPage(x1 + dx),
_scaleToPage(y1 + dy),
_scaleToPage(x2 + dx),
_scaleToPage(y2 + dy),
_scaleToPage(x3 + dx),
_scaleToPage(y3 + dy),
_scaleToPage(x4 + dx),
_scaleToPage(y4 + dy));
_gfx.FillPath(brush, path);
}
if (qbezier.IsStroked)
{
_gfx.DrawBezier(
pen,
_scaleToPage(x1 + dx),
_scaleToPage(y1 + dy),
_scaleToPage(x2 + dx),
_scaleToPage(y2 + dy),
_scaleToPage(x3 + dx),
_scaleToPage(y3 + dy),
_scaleToPage(x4 + dx),
_scaleToPage(y4 + dy));
}
brush.Dispose();
pen.Dispose();
}
示例3: Draw
/// <summary>
///
/// </summary>
/// <param name="gfx"></param>
/// <param name="text"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public void Draw(object gfx, XText text, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var _gfx = gfx as Graphics;
var tbind = text.BindToTextProperty(db, r);
if (string.IsNullOrEmpty(tbind))
return;
var brush = ToSolidBrush(text.Style.Stroke);
var fontStyle = Eto.Drawing.FontStyle.None;
if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Bold))
{
fontStyle |= Eto.Drawing.FontStyle.Bold;
}
if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Italic))
{
fontStyle |= Eto.Drawing.FontStyle.Italic;
}
var fontDecoration = Eto.Drawing.FontDecoration.None;
if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Underline))
{
fontDecoration |= Eto.Drawing.FontDecoration.Underline;
}
if (text.Style.TextStyle.FontStyle.Flags.HasFlag(Test2d.FontStyleFlags.Strikeout))
{
fontDecoration |= Eto.Drawing.FontDecoration.Strikethrough;
}
var font = new Font(
text.Style.TextStyle.FontName,
(float)(text.Style.TextStyle.FontSize * _textScaleFactor),
fontStyle,
fontDecoration);
var rect = CreateRect(
text.TopLeft,
text.BottomRight,
dx, dy);
var srect = new RectangleF(
_scaleToPage(rect.X),
_scaleToPage(rect.Y),
_scaleToPage(rect.Width),
_scaleToPage(rect.Height));
var size = _gfx.MeasureString(font, tbind);
var origin = GetTextOrigin(text.Style, ref srect, ref size);
_gfx.DrawText(
font,
brush,
origin,
tbind);
brush.Dispose();
font.Dispose();
}
示例4: TryToBind
/// <summary>
///
/// </summary>
/// <param name="bindings"></param>
/// <param name="r"></param>
/// <param name="propertyNameX"></param>
/// <param name="propertyNameY"></param>
private void TryToBind(
ImmutableArray<ShapeBinding> bindings,
Record r,
string propertyNameX,
string propertyNameY)
{
if (r == null || bindings == null || bindings.Length <= 0)
return;
if (r.Columns == null || r.Values == null || r.Columns.Length != r.Values.Length)
return;
foreach (var binding in bindings)
{
if (string.IsNullOrEmpty(binding.Property) || string.IsNullOrEmpty(binding.Path))
continue;
if (binding.Property == propertyNameX)
{
BindToDouble(binding, r, ref _x);
}
else if (binding.Property == propertyNameY)
{
BindToDouble(binding, r, ref _y);
}
}
}
示例5: Bind
/// <summary>
///
/// </summary>
/// <param name="r"></param>
public override void Bind(Record r)
{
var record = r ?? this.Data.Record;
var bindings = this.Data.Bindings;
string propertyNameX = "X";
string propertyNameY = "Y";
TryToBind(bindings, record, propertyNameX, propertyNameY);
}
示例6: BindToDouble
/// <summary>
///
/// </summary>
/// <param name="binding"></param>
/// <param name="r"></param>
/// <param name="value"></param>
private static void BindToDouble(ShapeBinding binding, Record r, ref double value)
{
var columns = r.Columns;
for (int i = 0; i < columns.Length; i++)
{
if (columns[i].Name != binding.Path)
continue;
double result;
bool success = double.TryParse(
r.Values[i].Content,
NumberStyles.Any, CultureInfo.InvariantCulture,
out result);
if (success)
{
value = result;
break;
}
}
}
示例7: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Data.Record;
if (_shape != null)
{
if (State.Flags.HasFlag(ShapeStateFlags.Visible))
{
_shape.Draw(dc, renderer, X + dx, Y + dy, db, record);
}
}
}
示例8: Bind
/// <summary>
///
/// </summary>
/// <param name="r"></param>
public override void Bind(Record r)
{
var record = r ?? this.Record;
_point1.TryToBind("Point1", this.Bindings, record);
_point2.TryToBind("Point2", this.Bindings, record);
_point3.TryToBind("Point3", this.Bindings, record);
_point4.TryToBind("Point4", this.Bindings, record);
}
示例9: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Record;
if (State.HasFlag(ShapeState.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
base.Draw(dc, renderer, dx, dy, db, record);
}
}
示例10: DropAsShapeAndBind
/// <summary>
///
/// </summary>
/// <param name="record"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public void DropAsShapeAndBind(Record record, double x, double y)
{
switch (_editor.CurrentTool)
{
case Tool.Point:
{
var point = XPoint.Create(x, y, _editor.Project.Options.PointShape);
point.Record = record;
if (record.Columns.Length >= 2)
{
point.Bindings = point.Bindings.Add(ShapeBinding.Create("X", record.Columns[0].Name));
point.Bindings = point.Bindings.Add(ShapeBinding.Create("Y", record.Columns[1].Name));
}
_editor.AddWithHistory(point);
}
break;
case Tool.Line:
{
var line = XLine.Create(
x, y,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape);
line.Record = record;
if (record.Columns.Length >= 2)
{
line.Bindings = line.Bindings.Add(ShapeBinding.Create("Start.X", record.Columns[0].Name));
line.Bindings = line.Bindings.Add(ShapeBinding.Create("Start.Y", record.Columns[1].Name));
}
if (record.Columns.Length >= 4)
{
line.Bindings = line.Bindings.Add(ShapeBinding.Create("End.X", record.Columns[2].Name));
line.Bindings = line.Bindings.Add(ShapeBinding.Create("End.Y", record.Columns[3].Name));
}
_editor.AddWithHistory(line);
}
break;
case Tool.Rectangle:
{
var rectangle = XRectangle.Create(
x, y,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape);
rectangle.Record = record;
if (record.Columns.Length >= 2)
{
rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("TopLeft.X", record.Columns[0].Name));
rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("TopLeft.Y", record.Columns[1].Name));
}
if (record.Columns.Length >= 4)
{
rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("BottomRight.X", record.Columns[2].Name));
rectangle.Bindings = rectangle.Bindings.Add(ShapeBinding.Create("BottomRight.Y", record.Columns[3].Name));
}
_editor.AddWithHistory(rectangle);
}
break;
case Tool.Ellipse:
{
var ellipse = XEllipse.Create(
x, y,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape);
ellipse.Record = record;
if (record.Columns.Length >= 2)
{
ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("TopLeft.X", record.Columns[0].Name));
ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("TopLeft.Y", record.Columns[1].Name));
}
if (record.Columns.Length >= 4)
{
ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("BottomRight.X", record.Columns[2].Name));
ellipse.Bindings = ellipse.Bindings.Add(ShapeBinding.Create("BottomRight.Y", record.Columns[3].Name));
}
_editor.AddWithHistory(ellipse);
}
break;
case Tool.Arc:
{
var arc = XArc.Create(
x, y,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape);
arc.Record = record;
//.........這裏部分代碼省略.........
示例11: Bind
/// <summary>
///
/// </summary>
/// <param name="r"></param>
public override void Bind(Record r)
{
var record = r ?? this.Record;
_start.TryToBind("Start", this.Bindings, record);
_end.TryToBind("End", this.Bindings, record);
}
示例12: DropAsGroup
/// <summary>
///
/// </summary>
/// <param name="record"></param>
/// <param name="x"></param>
/// <param name="y"></param>
public void DropAsGroup(Record record, double x, double y)
{
var g = XGroup.Create("g");
g.Record = record;
double sx = _editor.Project.Options.SnapToGrid ? Editor.Snap(x, _editor.Project.Options.SnapX) : x;
double sy = _editor.Project.Options.SnapToGrid ? Editor.Snap(y, _editor.Project.Options.SnapY) : y;
var length = record.Values.Length;
double px = sx;
double py = sy;
double width = 150;
double height = 15;
for (int i = 0; i < length; i++)
{
var column = record.Columns[i];
if (column.IsVisible)
{
var text = XText.Create(
px, py,
px + width, py + height,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape, "");
var binding = ShapeBinding.Create("Text", record.Columns[i].Name);
text.Bindings = text.Bindings.Add(binding);
g.AddShape(text);
py += height;
}
}
var rectangle = XRectangle.Create(
sx, sy,
sx + width, sy + (double)length * height,
_editor.Project.CurrentStyleLibrary.CurrentStyle,
_editor.Project.Options.PointShape);
g.AddShape(rectangle);
double ptx = sx + width / 2;
double pty = sy;
double pbx = sx + width / 2;
double pby = sy + (double)length * height;
double plx = sx;
double ply = sy + ((double)length * height) / 2;
double prx = sx + width;
double pry = sy + ((double)length * height) / 2;
var pt = XPoint.Create(ptx, pty, _editor.Project.Options.PointShape);
var pb = XPoint.Create(pbx, pby, _editor.Project.Options.PointShape);
var pl = XPoint.Create(plx, ply, _editor.Project.Options.PointShape);
var pr = XPoint.Create(prx, pry, _editor.Project.Options.PointShape);
g.AddConnectorAsNone(pt);
g.AddConnectorAsNone(pb);
g.AddConnectorAsNone(pl);
g.AddConnectorAsNone(pr);
_editor.AddWithHistory(g);
}
示例13: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Record;
if (State.HasFlag(ShapeState.Visible))
{
renderer.Draw(dc, this, dx, dy, db, record);
}
if (renderer.State.SelectedShape != null)
{
if (this == renderer.State.SelectedShape)
{
_start.Draw(dc, renderer, dx, dy, db, record);
_end.Draw(dc, renderer, dx, dy, db, record);
}
else if (_start == renderer.State.SelectedShape)
{
_start.Draw(dc, renderer, dx, dy, db, record);
}
else if (_end == renderer.State.SelectedShape)
{
_end.Draw(dc, renderer, dx, dy, db, record);
}
}
if (renderer.State.SelectedShapes != null)
{
if (renderer.State.SelectedShapes.Contains(this))
{
_start.Draw(dc, renderer, dx, dy, db, record);
_end.Draw(dc, renderer, dx, dy, db, record);
}
}
}
示例14: Bind
/// <summary>
///
/// </summary>
/// <param name="r"></param>
public override void Bind(Record r)
{
var record = r ?? this.Data.Record;
foreach (var shape in Shapes)
{
shape.Bind(record);
}
foreach (var connector in Connectors)
{
connector.Bind(record);
}
}
示例15: Draw
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="renderer"></param>
/// <param name="dx"></param>
/// <param name="dy"></param>
/// <param name="db"></param>
/// <param name="r"></param>
public override void Draw(object dc, IRenderer renderer, double dx, double dy, ImmutableArray<ShapeProperty> db, Record r)
{
var record = r ?? this.Data.Record;
if (State.Flags.HasFlag(ShapeStateFlags.Visible))
{
foreach (var shape in Shapes)
{
shape.Draw(dc, renderer, dx, dy, db, record);
}
}
if (renderer.State.SelectedShape != null)
{
if (this == renderer.State.SelectedShape)
{
foreach (var connector in Connectors)
{
connector.Draw(dc, renderer, dx, dy, db, record);
}
}
else
{
foreach (var connector in Connectors)
{
if (connector == renderer.State.SelectedShape)
{
connector.Draw(dc, renderer, dx, dy, db, record);
}
}
}
}
if (renderer.State.SelectedShapes != null)
{
if (renderer.State.SelectedShapes.Contains(this))
{
foreach (var connector in Connectors)
{
connector.Draw(dc, renderer, dx, dy, db, record);
}
}
}
}