本文整理汇总了C#中DoubleCollection类的典型用法代码示例。如果您正苦于以下问题:C# DoubleCollection类的具体用法?C# DoubleCollection怎么用?C# DoubleCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DoubleCollection类属于命名空间,在下文中一共展示了DoubleCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DifficultyMVVM
public DifficultyMVVM(string uid, string name, double minValue, double avgValue, double maxValue)
{
Name = name;
UID = uid;
MinValue = Math.Min(maxValue, minValue);
MaxValue = Math.Max(minValue, maxValue);
SelectedValue = avgValue;
Ticks = new DoubleCollection();
double stepValue = (avgValue - Math.Min(maxValue, minValue)) / 3;
for (double tick = Math.Min(maxValue, minValue); tick < avgValue; tick += stepValue)
{
Ticks.Add(tick);
}
stepValue = (Math.Max(maxValue, minValue) - avgValue) / 3;
for (double tick = avgValue; tick <= Math.Max(maxValue, minValue); tick += stepValue)
{
Ticks.Add(tick);
}
Reversed = minValue > maxValue;
}
示例2: Draw
public void Draw(
GridRange range,
IPoints points) {
DrawingContext drawingContext = RenderOpen();
DoubleCollection xCollection = new DoubleCollection();
DoubleCollection yCollection = new DoubleCollection();
try {
// vertical line
double renderHeight = points.yPosition[range.Rows.Start + range.Rows.Count] - points.yPosition[range.Rows.Start];
Rect verticalLineRect = new Rect(new Size(GridLineThickness, renderHeight));
foreach (int i in range.Columns.GetEnumerable()) {
verticalLineRect.X = points.xPosition[i + 1] - GridLineThickness;
drawingContext.DrawRectangle(GridLineBrush, null, verticalLineRect);
xCollection.Add(verticalLineRect.X);
}
// horizontal line
double renderWidth = points.xPosition[range.Columns.Start + range.Columns.Count] - points.xPosition[range.Columns.Start];
Rect horizontalLineRect = new Rect(new Size(renderWidth, GridLineThickness));
foreach (int i in range.Rows.GetEnumerable()) {
horizontalLineRect.Y = points.yPosition[i + 1] - GridLineThickness;
drawingContext.DrawRectangle(GridLineBrush, null, horizontalLineRect);
yCollection.Add(horizontalLineRect.Y);
}
XSnappingGuidelines = xCollection;
YSnappingGuidelines = yCollection;
} finally {
drawingContext.Close();
}
}
示例3: PollIntervalSlider
/// <summary>
/// Constructor.
/// </summary>
public PollIntervalSlider()
{
this.IsSnapToTickEnabled = true;
this.Minimum = 5;
this.Maximum = 60 * 60 * 24;
this.TickPlacement = TickPlacement.BottomRight;
this.AutoToolTipPlacement = AutoToolTipPlacement.BottomRight;
// Add ticks to the slider.
DoubleCollection tickMarks = new DoubleCollection();
tickMarks.Add(5); // 5 seconds
tickMarks.Add(60);
tickMarks.Add(60 * 2); // 2 minutes
tickMarks.Add(60 * 3);
tickMarks.Add(60 * 5);
tickMarks.Add(60 * 10);
tickMarks.Add(60 * 15);
tickMarks.Add(60 * 30);
tickMarks.Add(60 * 60);
tickMarks.Add(60 * 60 * 2); // 2 hours
tickMarks.Add(60 * 60 * 4);
tickMarks.Add(60 * 60 * 8);
tickMarks.Add(60 * 60 * 12);
tickMarks.Add(60 * 60 * 24);
this.Ticks = tickMarks;
}
示例4: ResizingAdorner
/// <summary>
/// Constructor
/// </summary>
/// <param name="adornedElement"></param>
public ResizingAdorner(UIElement adornedElement)
: base(adornedElement)
{
visualChildren = new VisualCollection(this);
mainrec = new Rectangle();
SolidColorBrush brush = new SolidColorBrush(Colors.DimGray);
mainrec.Stroke = Brushes.Firebrick;
DoubleCollection col = new DoubleCollection();
col.Add(5.0);
col.Add(2.30);
mainrec.StrokeDashArray = col;
visualChildren.Add(mainrec);
// Call a helper method to initialize the Thumbs
// with a customized cursors.
BuildAdornerCorner(ref topLeft, Cursors.SizeNWSE);
BuildAdornerCorner(ref topRight, Cursors.SizeNESW);
BuildAdornerCorner(ref bottomLeft, Cursors.SizeNESW);
BuildAdornerCorner(ref bottomRight, Cursors.SizeNWSE);
// Add handlers for resizing.
bottomLeft.DragDelta += new DragDeltaEventHandler(HandleBottomLeft);
bottomRight.DragDelta += new DragDeltaEventHandler(HandleBottomRight);
topLeft.DragDelta += new DragDeltaEventHandler(HandleTopLeft);
topRight.DragDelta += new DragDeltaEventHandler(HandleTopRight);
this.MinWidth = 50;
}
示例5: PollIntervalSlider
/// <summary>
/// Constructor.
/// </summary>
public PollIntervalSlider(TextBlock sliderLabel, int defaultValue = 7)
{
this.sliderLabel = sliderLabel;
this.IsSnapToTickEnabled = true;
this.Minimum = LogScaleConverter.Convert(1000 * 5);
this.Maximum = LogScaleConverter.Convert(1000 * 60 * 60 * 24);
this.TickPlacement = TickPlacement.BottomRight;
// Add ticks to the slider.
DoubleCollection tickMarks = new DoubleCollection();
tickMarks.Add(LogScaleConverter.Convert(1000 * 5)); // 5 seconds.
tickMarks.Add(LogScaleConverter.Convert(1000 * 15));
tickMarks.Add(LogScaleConverter.Convert(1000 * 30));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 3)); // 3 minutes.
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 10));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 30));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 60));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 60 * 3)); // 3 hours.
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 60 * 8));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 60 * 12));
tickMarks.Add(LogScaleConverter.Convert(1000 * 60 * 60 * 24));
this.Ticks = tickMarks;
// Show current value in UI.
ShowCurrentValue();
}
示例6: DrawLine
internal static void DrawLine(PdfRenderContext context, double x1, double y1, double x2, double y2, double strokeThickness, Brush stroke, DoubleCollection dashArray)
{
using (context.drawingSurface.SaveGraphicProperties())
{
if (x1 == x2 && System.Math.Abs(y1 - y2) > 10)
{
if (y2 < y1)
{
double max = y1;
y1 = y2;
y2 = max;
}
// offset the start position of the line to resolve a visual bug in Adobe Reader, where the axis line seems to continue after the last tick
y1 += 0.5;
}
SetStroke(context, strokeThickness, stroke, Math.Abs(x2 - x1), Math.Abs(y2 - y1));
if (context.drawingSurface.GraphicProperties.IsStroked)
{
context.drawingSurface.GraphicProperties.StrokeDashArray = dashArray;
context.drawingSurface.DrawLine(new Point(x1, y1), new Point(x2, y2));
}
}
}
示例7: SetAnimDash
public void SetAnimDash(PointCollection pc, ShapeLayer layer)
{
MapPolyline animDashLine = new MapPolyline()
{
MapStrokeThickness = 20,
Points = pc,
ScaleFactor = 0.2
};
animDashLine.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromArgb(128, 255, 255, 255));
animDashLine.StrokeLineJoin = PenLineJoin.Round;
animDashLine.StrokeStartLineCap = PenLineCap.Flat;
animDashLine.StrokeEndLineCap = PenLineCap.Triangle;
animDashLine.StrokeDashCap = PenLineCap.Triangle;
var dc = new DoubleCollection { 2, 2 };
animDashLine.IsHitTestVisible = false;
animDashLine.StrokeDashArray = dc;
DoubleAnimation animation = new DoubleAnimation
{
From = 4,
To = 0,
FillBehavior = System.Windows.Media.Animation.FillBehavior.HoldEnd,
RepeatBehavior = RepeatBehavior.Forever
};
var strokeStoryboard = new Storyboard();
strokeStoryboard.Children.Add(animation);
Storyboard.SetTargetProperty(animation, new PropertyPath("(Line.StrokeDashOffset)"));
Storyboard.SetTarget(animation, animDashLine);
strokeStoryboard.Begin();
layer.Shapes.Add(animDashLine);
}
示例8: moveMoldPart
public moveMoldPart()
{
InitializeComponent();
valmoWin.dv.MldPr[621].addHandle(refush);
valmoWin.dv.SysPr[109].addHandle(MoldChanged);
LineRef = new Line();
LineRef.Stroke = new SolidColorBrush(Colors.Red);
LineRef.X1 = 0;
LineRef.X2 = 400;
LineRef.Y1 = 400;
LineRef.SnapsToDevicePixels = true;
LineRef.ClipToBounds = true;
LineRef.StrokeThickness = 1;
DoubleCollection DashArray = new DoubleCollection();
DashArray.Add(2);
DashArray.Add(2);
LineRef.StrokeDashArray = DashArray;
cvsCurve.Children.Add(LineRef);
for (int i = 0; i < 11; i++)
{
Rectangle rec = new Rectangle();
rec.Height = 6;
rec.Width = 6;
rec.Fill = new SolidColorBrush(Colors.Black);
cvsCurve.Children.Add(rec);
lstRec.Add(rec);
Canvas.SetLeft(rec, i * 40 - 3);
Canvas.SetBottom(rec, -3);
}
for (int i = 0; i < 10; i++)
{
Line line = new Line();
line.Stroke = new SolidColorBrush(Colors.Black);
line.X1 = i * 40;
line.X2 = (i + 1) * 40;
line.SnapsToDevicePixels = true;
line.ClipToBounds = true;
line.StrokeThickness = 1;
lstLine.Add(line);
cvsCurve.Children.Add(line);
}
lstLine[0].Y1 = 400;
valmoWin.dv.MldPr[170].addHandle(refushPoint1);
valmoWin.dv.MldPr[171].addHandle(refushPoint2);
valmoWin.dv.MldPr[172].addHandle(refushPoint3);
valmoWin.dv.MldPr[173].addHandle(refushPoint4);
valmoWin.dv.MldPr[174].addHandle(refushPoint5);
valmoWin.dv.MldPr[175].addHandle(refushPoint6);
valmoWin.dv.MldPr[176].addHandle(refushPoint7);
valmoWin.dv.MldPr[177].addHandle(refushPoint8);
valmoWin.dv.MldPr[178].addHandle(refushPoint9);
valmoWin.dv.MldPr[179].addHandle(refushPoint10);
}
示例9: SingleBand
public SingleBand(float value, float maxValue, float minValue, DoubleCollection ticks, string label)
{
MaxValue = maxValue;
MinValue = minValue;
TickFrequency = 0;
Ticks = ticks;
Value = value;
Label = label;
}
示例10: OverlayedSlider
public OverlayedSlider(string overlayText, DoubleCollection ticks)
{
InitializeComponent();
tbOverlay.Text = overlayText;
slValue.Minimum = ticks.First();
slValue.Maximum = ticks.Last();
slValue.Ticks = ticks;
}
示例11: DashStyle
/// <summary>
/// Constructor from an array and offset
/// <param name="dashes">
/// The array of lengths of dashes and gaps, measured in Thickness units.
/// If the value of dashes is null then the style will be solid
/// </param>
/// <param name="offset">
/// Determines where in the dash sequence the stroke will start
/// </param>
/// </summary>
public DashStyle(IEnumerable<double> dashes, Double offset)
{
Offset = offset;
if (dashes != null)
{
Dashes = new DoubleCollection(dashes);
}
}
示例12: Pen
public Pen()
{
Thickness = 1;
DashArray = new DoubleCollection();
StartLineCap = PenLineCap.Flat;
EndLineCap = PenLineCap.Flat;
DashCap = PenLineCap.Flat;
LineJoin = PenLineJoin.Miter; // TODO: check default values
MiterLimit = 10; // TODO: check default values
}
示例13: dynConnector
public dynConnector(dynPort port, Canvas workBench, Point mousePt)
{
//don't allow connections to start at an input port
if (port.PortType != PortType.INPUT)
{
//get start point
//this.workBench = workBench;
pStart = port;
pStart.Connect(this);
//Create a Bezier;
connector = new Path();
connector.Stroke = Brushes.Black;
connector.StrokeThickness = STROKE_THICKNESS;
connector.Opacity = .8;
DoubleCollection dashArray = new DoubleCollection();
dashArray.Add(5); dashArray.Add(2);
connector.StrokeDashArray = dashArray;
PathGeometry connectorGeometry = new PathGeometry();
connectorPoints = new PathFigure();
connectorCurve = new BezierSegment();
connectorPoints.StartPoint = new Point(pStart.Center.X, pStart.Center.Y);
connectorCurve.Point1 = connectorPoints.StartPoint;
connectorCurve.Point2 = connectorPoints.StartPoint;
connectorCurve.Point3 = connectorPoints.StartPoint;
connectorPoints.Segments.Add(connectorCurve);
connectorGeometry.Figures.Add(connectorPoints);
connector.Data = connectorGeometry;
workBench.Children.Add(connector);
isDrawing = true;
//set this to not draggable
Dynamo.Controls.DragCanvas.SetCanBeDragged(this, false);
Dynamo.Controls.DragCanvas.SetCanBeDragged(connector, false);
//set the z order to the front
Canvas.SetZIndex(this, 300);
//register an event listener for the start port update
//this will tell the connector to set the elements at either
//end to be equal if pStart and pEnd are not null
//pStart.Owner.Outputs[pStart.Index].dynElementUpdated += new Dynamo.Elements.dynElementUpdatedHandler(StartPortUpdated);
}
else
{
throw new InvalidPortException();
}
}
示例14: GuidelineSet
/// <summary>
/// Constructs a new GuidelineSet object.
/// </summary>
/// <param name="guidelinesX">Array of X coordinates that defines a set of vertical guidelines.</param>
/// <param name="guidelinesY">Array of Y coordinates that defines a set of horizontal guidelines.</param>
public GuidelineSet(double[] guidelinesX, double[] guidelinesY)
{
if (guidelinesX != null)
{
GuidelinesX = new DoubleCollection(guidelinesX);
}
if (guidelinesY != null)
{
GuidelinesY = new DoubleCollection(guidelinesY);
}
}
示例15: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ((bool)value)
{
var dc = new DoubleCollection();
dc.Add(1);
dc.Add(3);
return dc;
}
else
return null;
}