本文整理汇总了C#中System.Windows.Size.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Size.ToString方法的具体用法?C# Size.ToString怎么用?C# Size.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Size
的用法示例。
在下文中一共展示了Size.ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeasureOverride
protected override Size MeasureOverride (Size availableSize)
{
Tester.WriteLine ("MeasureOverride input = " + availableSize.ToString ());
Size output = base.MeasureOverride (availableSize);
Tester.WriteLine ("MeasureOverride output = " + output.ToString ());
return output;
}
示例2: ArrangeOverride
protected override Size ArrangeOverride (Size finalSize)
{
Tester.WriteLine ("ArrangeOverride input = " + finalSize.ToString ());
Size output = base.MeasureOverride (finalSize);
Tester.WriteLine ("ArrangeOverride output = " + output.ToString ());
return output;
}
示例3: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
Debug.WriteLine("GanttItemsPresenter.MeasureOverride(" + availableSize.ToString() + ")");
for (int i = 0; i < Children.Count; i++)
{
GanttItem gi = (GanttItem)Children[i];
double x1, x2;
x1 = ParentRow.ParentPanel.ConvertDateToPosition( gi.Section.StartDate );
x2 = ParentRow.ParentPanel.ConvertDateToPosition( gi.Section.EndDate );
double width = x2 - x1;
double x3 = 0d;
//Gap
if (gi.Node.ShowGap && i == Children.Count - 1 && ParentRow.RowIndex < ParentRow.ParentPanel.Nodes.Count - 1)
{
IGanttNode nextNode = ParentRow.ParentPanel.Nodes[ParentRow.RowIndex + 1];
if (nextNode.StartDate > gi.Node.EndDate && nextNode.ParentNode == gi.Node.ParentNode)
{
x3 = ParentRow.ParentPanel.ConvertDateToPosition(nextNode.StartDate);
width += x3 - x2;
}
}
if (width < 0)
width = 0;
gi.Measure(new Size(width, ParentRow.ActualHeight));
}
return base.MeasureOverride(availableSize);
}
示例4: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
Debug.WriteLine("GanttRowsPresenter.ArrangeOverride(" + finalSize.ToString() + ")");
double position = 0d;
Children.OfType<GanttRow>().ToList<GanttRow>().ForEach(g =>
{
if (g.Visibility == Visibility.Visible)
{
g.Arrange(new Rect(0d, position, finalSize.Width, ParentPanel.RowHeight));
position += ParentPanel.RowHeight;
}
else
g.Arrange(new Rect(0d, 0d, 0d, 0d));
}
);
return base.ArrangeOverride(finalSize);
}
示例5: ArrangeOverride
/// <summary>
/// Arrange
/// </summary>
/// <param name="finalSize"></param>
/// <returns></returns>
protected override Size ArrangeOverride(Size finalSize)
{
ModelItem elem = AdornedElement as ModelItem;
if (elem == null)
return finalSize;
Vector offset = new Vector(thumbs[0].ActualWidth / 2, thumbs[0].ActualHeight / 2);
Size size = new Size(thumbs[0].ActualWidth, thumbs[0].ActualHeight);
double halfWidth = elem.Size.Width / 2, halfHeight = elem.Size.Height / 2;
Point center = new Point(halfWidth, halfHeight) - offset; // center point
#if DEBUG_ON
// test value
System.Console.WriteLine("{0} Size - connItem {1} size {2} hWidth {3} hHeight {4}", System.DateTime.Now.Millisecond, drawingConn, size.ToString(), halfWidth, halfHeight);
#endif
thumbs[(int)ConnectorType.Bottom].Arrange(new Rect(center + new Vector(0, halfHeight), size));
thumbs[(int)ConnectorType.Left].Arrange(new Rect(center + new Vector(-halfWidth, 0), size));
thumbs[(int)ConnectorType.Center].Arrange(new Rect(center, size));
thumbs[(int)ConnectorType.Right].Arrange(new Rect(center + new Vector(halfWidth, 0), size));
thumbs[(int)ConnectorType.Top].Arrange(new Rect(center + new Vector(0, -halfHeight), size));
return finalSize;
}
示例6: MeasureOverride
/// <summary>
/// Overrides MeasureOverride().
/// </summary>
/// <param name="availableSize">The available size.</param>
/// <returns>Returns the measured size.</returns>
protected override Size MeasureOverride(Size availableSize)
{
Debug.WriteLine("MeasureOverride(availableSize=" + availableSize.ToString() + " )");
if (childBorder != null)
{
if (sizeOriginal.Width == 0) // Make this measurement only once per instance
{
childBorder.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
sizeOriginal = childBorder.DesiredSize;
}
Size desiredSizeMax = sizeOriginal;
childBorder.Measure(availableSize);
Size desiredSizeFit = childBorder.DesiredSize;
Double scalingFactorX = 1.0;
if (availableSize.Width < desiredSizeFit.Width)
{
scalingFactorX = availableSize.Width / desiredSizeFit.Width;
}
else if (availableSize.Width < desiredSizeMax.Width)
{
scalingFactorX = availableSize.Width / desiredSizeMax.Width;
}
Double scalingFactorY = 1.0;
if (availableSize.Height < desiredSizeFit.Height)
{
scalingFactorY = availableSize.Height / desiredSizeFit.Height;
}
else if (availableSize.Height < desiredSizeMax.Height)
{
scalingFactorY = availableSize.Height / desiredSizeMax.Height;
}
scalingFactor = Math.Min(scalingFactorX, scalingFactorY);
Debug.WriteLine("scalingFactorX:" + scalingFactorX.ToString(CultureInfo.CurrentCulture));
Debug.WriteLine("scalingFactorY:" + scalingFactorY.ToString(CultureInfo.CurrentCulture));
Debug.WriteLine("scalingFactor:" + scalingFactor.ToString(CultureInfo.CurrentCulture));
if (Double.IsPositiveInfinity(availableSize.Width) || Double.IsPositiveInfinity(availableSize.Height))
{
sizeActuallyNeeded = new Size(desiredSizeFit.Width * scalingFactor, desiredSizeFit.Height * scalingFactor);
}
else
{
sizeActuallyNeeded = new Size(availableSize.Width / scalingFactor, availableSize.Height / scalingFactor);
}
}
Debug.WriteLine("MeasureOverride(desiredSize=" + sizeActuallyNeeded.ToString() + " )");
return sizeActuallyNeeded;
}
示例7: ArrangeOverride
/// <summary>
/// Overrides ArrangeOverride().
/// </summary>
/// <param name="finalSize">The final size.</param>
/// <returns>The returned final size.</returns>
protected override Size ArrangeOverride(Size finalSize)
{
Debug.WriteLine("ArrangeOverride(finalSize=" + finalSize.ToString() + " )");
if (childBorder != null)
{
ScaleTransform st = new ScaleTransform();
st.ScaleX = scalingFactor;
st.ScaleY = scalingFactor;
st.CenterX = 0;
st.CenterY = 0;
childBorder.RenderTransform = st;
childBorder.Arrange(new Rect(0, 0, sizeActuallyNeeded.Width, sizeActuallyNeeded.Height));
Debug.WriteLine("ArrangeOverride(scalingFactor=" + scalingFactor.ToString(CultureInfo.CurrentUICulture) + " )");
}
return finalSize;
}
示例8: AlertAboutMeasure
private void AlertAboutMeasure(Size size)
{
Msg = string.Format("{0}", size.ToString());
}
示例9: PerformOperation
public void PerformOperation(object sender, RoutedEventArgs e)
{
RadioButton li = sender as RadioButton;
// Strings used to display results
String syntaxString, resultType, operationString;
///The local variables point1, point2, vector2, etc are defined in each
///case block for readability reasons. Each variable is contained within
///the scope of each case statement.
switch (li.Name)
{ //begin switch
case "rb1":
{
// Translates a Point by a Vector using the overloaded + operator.
System.Windows.Point point1 = new System.Windows.Point(10, 5);
Vector vector1 = new Vector(20, 30);
System.Windows.Point pointResult = new System.Windows.Point();
pointResult = point1 + vector1;
// pointResult is equal to (-10,-25)
// Displaying Results
syntaxString = "pointResult = point1 + vector1;";
resultType = "Point";
operationString = "Translating a Point by a Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb2":
{
// Adds a Vector to a Vector using the overloaded + operator.
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
Vector vectorResult = new Vector();
// vectorResult is equal to (65,100)
vectorResult = vector1 + vector2;
// Displaying Results
syntaxString = "vectorResult = vector1 + vector2;";
resultType = "Vector";
operationString = "Adding a Vector to a Vector";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb3":
{
// Adds a Vector to a Vector using the static Add method.
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
Vector vectorResult = new Vector();
vectorResult = Vector.Add(vector1, vector2);
// vectorResult is equal to (65,100)
// Displaying Results
syntaxString = "vectorResult = Vector.Add(vector1, vector2);";
resultType = "Vector";
operationString = "Adding a Vector to a Vector";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb4":
{
// Translates a Point by a Vector using the static Add method.
Vector vector1 = new Vector(20, 30);
System.Windows.Point point1 = new System.Windows.Point(10, 5);
System.Windows.Point pointResult = new System.Windows.Point();
pointResult = Vector.Add(vector1, point1);
// vectorResult is equal to (30,35)
// Displaying Results
syntaxString = "pointResult = Vector.Add(vector1, point1);";
resultType = "Point";
operationString = "Translating a Point by a Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb5":
{
// Subtracts a Vector from a Vector using the overloaded - operator.
Vector vector1 = new Vector(20, 30);
Vector vector2 = new Vector(45, 70);
//.........这里部分代码省略.........
示例10: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
Debug.WriteLine("GanttPanel.ArrangeOverride(" + finalSize.ToString() + ")");
RectangleGeometry r = new RectangleGeometry();
r.Rect = new Rect(0, 0, finalSize.Width - BorderThickness.Left - BorderThickness.Right,
finalSize.Height - BorderThickness.Top - BorderThickness.Bottom);
MainElement.Clip = r;
if (UIHelpers.IsInDesignModeStatic)
{
return base.ArrangeOverride(finalSize);
}
GenerateRows(finalSize);
Size result = base.ArrangeOverride(finalSize);
return result;
}
示例11: PerformOperation
// This method performs the Point operations
public void PerformOperation(object sender, RoutedEventArgs e)
{
RadioButton li = sender as RadioButton;
// Strings used to display the results
String syntaxString, resultType, operationString;
// The local variables point1, point2, vector2, etc are defined in each
// case block for readability reasons. Each variable is contained within
// the scope of each case statement.
switch (li.Name)
{ //begin switch
case "rb1":
{
// Translates a Point by a Vector using the overloaded + operator.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = point1 + vector1;
// pointResult is equal to (30, 35)
// Note: Adding a Point to a Point is not a legal operation
// Displaying Results
syntaxString = "pointResult = point1 + vector1;";
resultType = "Point";
operationString = "Adding a Point and Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb2":
{
// Translates a Point by a Vector using the static Add method.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = Point.Add(point1, vector1);
// pointResult is equal to (30, 35)
// Displaying Results
syntaxString = "pointResult = Point.Add(point1, vector1);";
resultType = "Point";
operationString = "Adding a Point and Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb3":
{
// Subtracts a Vector from a Point using the overloaded - operator.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = point1 - vector1;
// pointResult is equal to (-10, -25)
// Displaying Results
syntaxString = "pointResult = point1 - vector1;";
resultType = "Point";
operationString = "Subtracting a Vector from a Point";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb4":
{
// Subtracts a Vector from a Point using the static Subtract method.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = Point.Subtract(point1, vector1);
// pointResult is equal to (-10, -25)
// Displaying Results
syntaxString = "pointResult = Point.Subtract(point1, vector1);";
resultType = "Point";
operationString = "Subtracting a Vector from a Point";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb5":
{
// Subtracts a Point from a Point using the overloaded - operator.
// Returns a Vector.
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
Vector vectorResult = new Vector();
//.........这里部分代码省略.........
示例12: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
Debug.WriteLine("MeasureOverride (ListBox): " + availableSize.ToString());
return base.MeasureOverride(availableSize);
}
示例13: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
Debug.WriteLine("GanttRow.ArrangeOverride(" + finalSize.ToString() + ")");
if (_oldSize != finalSize || _sameSizeCnt != 0)
{
if (_oldSize != finalSize)
_sameSizeCnt = 1;
else
_sameSizeCnt--;
_oldSize = finalSize;
if (Node != null)
GenerateItems();
else
ItemsPresenter.Children.Clear();
ItemsPresenter.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
_oldRetSize = base.ArrangeOverride(finalSize);
return _oldRetSize;
}
return _oldRetSize;
}
示例14: MeasureOverride
protected override Size MeasureOverride(Size constraint)
{
Debug.WriteLine("MeasureOverride (VirtualizingStackPanel): " + constraint.ToString());
return base.MeasureOverride(constraint);
}