本文整理汇总了C#中DoubleCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleCollection.Add方法的具体用法?C# DoubleCollection.Add怎么用?C# DoubleCollection.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleCollection
的用法示例。
在下文中一共展示了DoubleCollection.Add方法的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: 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;
}
示例3: 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);
}
示例4: 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();
}
}
示例5: 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;
}
示例6: AddSelectionRectangle
protected void AddSelectionRectangle()
{
selection = new Rectangle() { Visibility = Visibility.Visible, ClipToBounds = true, Width = 0, Height = 0,
VerticalAlignment = VerticalAlignment.Top };
SolidColorBrush selectionBrush = new SolidColorBrush() { Color = Brushes.Aquamarine.Color, Opacity = 0.5 };
selection.Fill = selectionBrush;
selection.StrokeDashOffset = 5; selection.StrokeThickness = 0.99;
SolidColorBrush selectionBrush2 = new SolidColorBrush() { Color = Color.FromArgb(255, 0, 0, 0) };
selection.Stroke = selectionBrush2;
selection.HorizontalAlignment = HorizontalAlignment.Left;
DoubleCollection strokeDashArray1 = new DoubleCollection(2);
strokeDashArray1.Add(3); strokeDashArray1.Add(3);
selection.StrokeDashArray = strokeDashArray1;
Canvas.Children.Add(selection);
selection.SetValue(Canvas.ZIndexProperty, 1000);
}
示例7: 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();
}
}
示例8: ScreenBrightInfo
public ScreenBrightInfo()
{
DoubleCollection collection = new DoubleCollection();
collection.Add(3000);
collection.Add(5000);
collection.Add(6500);
collection.Add(9300);
ColorTempTicksCollection = collection;
#region 命令绑定
CmdSetDefaultColorTemp = new RelayCommand<double>(OnCmdSetDefaultColorTemp);
CmdSetGamma = new RelayCommand<int>(OnCmdSetGamma);
CmdSetGlobalBright = new RelayCommand<int>(OnCmdSetGlobalBright);
CmdSetRedBright = new RelayCommand<int>(OnCmdSetRedBright);
CmdSetGreenBright = new RelayCommand<int>(OnCmdSetGreenBright);
CmdSetBlueBright = new RelayCommand<int>(OnCmdSetBlueBright);
CmdSetCurrentGain = new RelayCommand(OnCmdSetCurrentGain);
CmdSetSyncBright = new RelayCommand<bool>(OnCmdSetSyncBright);
CmdSetSyncGain = new RelayCommand<bool>(OnCmdSetSyncGain);
CmdSetColorTemp = new RelayCommand<int>(OnCmdSetColorTemp);
CmdReadScanBdProp = new RelayCommand(OnCmdReadScanBdProp);
CmdSetDefalutCurGain = new RelayCommand(OnCmdSetDefalutCurGain);
CmdAddTimingAdjustData = new RelayCommand(OnAddTimingAdjustData);
CmdEditTimingAdjustData = new RelayCommand(OnEditSmartBrightItemData, CanEditTimingAdjustData);
CmdDeleteSelectedTimingAdjustData = new RelayCommand(OnDeleteSelectedTimingAdjustData, CanDeleteSelectedTimingAdjustData);
CmdClearTimingAdjustData = new RelayCommand(OnClearTimingAdjustData, CanClearTimingAdjustData);
CmdOK = new RelayCommand<string>(OnOk);
CmdReadFromDB = new RelayCommand<string>(OnCmdReadFromDB);
CmdPeripheralsSetting = new RelayCommand(OnCmdPeripheralsSetting);
CmdBrightAdjustModeClick = new RelayCommand(OnCmdBrightAdjustModeClick);
#endregion
#region 初始化
if (!this.IsInDesignMode)
{
_colorTempRGBMapDict = _globalParams.ColorTempRGBMappingDict;
//SelectedBrightAdjustMode = BrightAdjustMode.SmartBright;
}
#endregion
}
示例9: InkCanvasFeedbackAdorner
/// <summary>
/// InkCanvasFeedbackAdorner Constructor
/// </summary>
/// <param name="inkCanvas">The adorned InkCanvas</param>
internal InkCanvasFeedbackAdorner(InkCanvas inkCanvas)
: base(( inkCanvas != null ? inkCanvas.InnerCanvas : null ))
{
if ( inkCanvas == null )
throw new ArgumentNullException("inkCanvas");
// Initialize the internal data
_inkCanvas = inkCanvas;
_adornerBorderPen = new Pen(Brushes.Black, 1.0);
DoubleCollection dashes = new DoubleCollection( );
dashes.Add(4.5);
dashes.Add(4.5);
_adornerBorderPen.DashStyle = new DashStyle(dashes, 2.25);
_adornerBorderPen.DashCap = PenLineCap.Flat;
}
示例10: DrawLine
private void DrawLine( double x1, double y1, double x2, double y2, bool dotted )
{
Line line = new Line();
line.X1 = x1;
line.Y1 = y1;
line.X2 = x2;
line.Y2 = y2;
line.Stroke = Brushes.Red;
line.StrokeThickness = 1.0;
if ( dotted )
{
DoubleCollection collection = new DoubleCollection();
collection.Add( 3 );
collection.Add( 3 );
line.StrokeDashArray = collection;
}
screen.Children.Add( line );
}
示例11: OnClickNonUniform
void OnClickNonUniform(object sender, RoutedEventArgs e)
{
Slider hslider = new Slider();
hslider.Orientation = Orientation.Horizontal;
hslider.Width = 100;
hslider.IsMoveToPointEnabled = false;
DoubleCollection tickMarks = new DoubleCollection();
tickMarks.Add(1.1);
tickMarks.Add(1.3);
tickMarks.Add(2.0);
tickMarks.Add(7.0);
tickMarks.Add(10.0);
hslider.Ticks = tickMarks;
hslider.TickPlacement = TickPlacement.BottomRight;
hslider.AutoToolTipPlacement =
AutoToolTipPlacement.TopLeft;
hslider.AutoToolTipPrecision = 2;
hslider.IsSnapToTickEnabled = true;
cv2.Children.Add(hslider);
}
示例12: ChartCanvas
public ChartCanvas()
{
RebuildDisabled = true;
//Background = new SolidColorBrush(Color.FromArgb(0xf0, 0x3f, 0x3f, 0x3f));
GradientStopCollection gradient = new GradientStopCollection();
gradient.Add(new GradientStop(Color.FromRgb(203, 231, 227), 0));
gradient.Add(new GradientStop(Color.FromRgb(241, 230, 168), 0.6));
gradient.Add(new GradientStop(Color.FromRgb(236, 213, 186), 1));
LinearGradientBrush back = new LinearGradientBrush(gradient, new Point(0,0), new Point(0, 1));
Background = back;
Offset = 0;
XRange = 50;
CandleWidth = 9;
CandleSpacing = 3;
YMin = 0;
YMax = 100;
LeftMargin = 10;
RightMargin = 40;
TopMargin = 10;
BottomMargin = 10;
_gridPattern = new DoubleCollection(2);
_gridPattern.Add(5);
_gridPattern.Add(5);
ShowGridLines();
this.PreviewMouseLeftButtonDown += CustomCanvas_PreviewMouseLeftButtonDown;
this.PreviewMouseLeftButtonUp += CustomCanvas_PreviewMouseLeftButtonUp;
this.PreviewMouseMove += CustomCanvas_PreviewMouseMove;
this.SizeChanged += ChartCanvas_SizeChanged;
RebuildDisabled = false;
}
示例13: Convert
/// <summary>${WP_utility_DoubleCollectionConverter_method_Convert_D}</summary>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
if (targetType != typeof(DoubleCollection))
{
throw new NotSupportedException();
}
DoubleCollection doubles = (DoubleCollection)value;
DoubleCollection doubles2 = new DoubleCollection();
foreach (double num in doubles)
{
doubles2.Add(num);
}
return doubles2;
}
示例14: To2dCurve
public static Curve2dCollection To2dCurve(this Grevit.Types.Component curve)
{
Curve2dCollection curveArray = new Curve2dCollection();
if (curve.GetType() == typeof(Grevit.Types.Line))
{
Grevit.Types.Line baseline = (Grevit.Types.Line)curve;
curveArray.Add(new Line2d(baseline.from.ToPoint2d(), baseline.to.ToPoint2d()));
}
else if (curve.GetType() == typeof(Grevit.Types.Arc))
{
Grevit.Types.Arc baseline = (Grevit.Types.Arc)curve;
curveArray.Add(new CircularArc2d(baseline.center.ToPoint2d(), baseline.radius, baseline.start, baseline.end, Vector2d.XAxis, true));
}
else if (curve.GetType() == typeof(Grevit.Types.Curve3Points))
{
Grevit.Types.Curve3Points baseline = (Grevit.Types.Curve3Points)curve;
curveArray.Add(new CircularArc2d(baseline.a.ToPoint2d(), baseline.c.ToPoint2d(), baseline.b.ToPoint2d()));
}
else if (curve.GetType() == typeof(Grevit.Types.PLine))
{
Grevit.Types.PLine baseline = (Grevit.Types.PLine)curve;
for (int i = 0; i < baseline.points.Count - 1; i++)
{
curveArray.Add(new Line2d(baseline.points[i].ToPoint2d(), baseline.points[i + 1].ToPoint2d()));
}
}
else if (curve.GetType() == typeof(Grevit.Types.Spline))
{
Grevit.Types.Spline s = (Grevit.Types.Spline)curve;
Point2dCollection points = new Point2dCollection();
foreach (Grevit.Types.Point p in s.controlPoints) points.Add(p.ToPoint2d());
DoubleCollection dc = new DoubleCollection();
foreach (double dbl in s.weights) dc.Add(dbl);
NurbCurve2d sp = new NurbCurve2d(s.degree, new KnotCollection(), points, dc, s.isPeriodic);
curveArray.Add(sp);
}
return curveArray;
}
示例15: PollIntervalSlider
public PollIntervalSlider()
{
this.IsSnapToTickEnabled = true;
this.Minimum = 15;
//this.Minimum = 1; //testing
this.Maximum = 1440;
this.TickPlacement = TickPlacement.BottomRight;
this.AutoToolTipPlacement = AutoToolTipPlacement.BottomRight;
// Manually add ticks to the slider.
DoubleCollection tickMarks = new DoubleCollection();
//tickMarks.Add(1); //testing
//tickMarks.Add(2); //testing
//tickMarks.Add(5); //testing
tickMarks.Add(15);
tickMarks.Add(30);
tickMarks.Add(60);
tickMarks.Add(120);
tickMarks.Add(240);
tickMarks.Add(480);
tickMarks.Add(720);
tickMarks.Add(1440);
this.Ticks = tickMarks;
}