本文整理汇总了C#中Windows.Foundation.Size类的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Size类属于Windows.Foundation命名空间,在下文中一共展示了Size类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Arrange
public override void Arrange(Size finalSize)
{
base.Arrange(DesiredSize);
// Call method to arrange the marker
SetIndicatorTransforms();
PositionMarker();
}
示例2: GetEffectInternalAsync
protected override MaybeTask<IImageProvider> GetEffectInternalAsync(IImageProvider source, Size sourceSize, Size renderSize)
{
m_radialGradient.CenterPoint = new Point(m_centerX, m_centerY);
m_radialGradient.EllipseRadius = new EllipseRadius(m_radiusX, m_radiusY);
return new MaybeTask<IImageProvider>(m_gradientImageSource);
}
示例3: DataContext
/// <summary>
/// Private contructor.
/// </summary>
private DataContext()
{
PreviewResolutionStream = new MemoryStream();
FullResolutionStream = new MemoryStream();
FullResolution = new Size(DefaultPreviewResolutionWidth, DefaultPreviewResolutionHeight);
PreviewResolution = new Size(DefaultPreviewResolutionWidth, DefaultPreviewResolutionHeight);
}
示例4: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
var panel = ItemsPanelRoot as ItemsWrapGrid;
if (panel != null)
{
if (MinItemWidth == 0)
{
throw new ArgumentException("You need to set MinItemHeight and MinItemWidth to a value greater than 0");
}
var availableWidth = finalSize.Width - (Padding.Right + Padding.Left);
var numColumns = Math.Floor(availableWidth / MinItemWidth);
numColumns = numColumns == 0 ? 1 : numColumns;
//Not used yet (for horizontal scrolling scenarios)
//var numRows = Math.Ceiling(this.Items.Count / numColumns);
var itemWidth = availableWidth / numColumns;
panel.ItemWidth = itemWidth;
panel.ItemHeight = 120;
}
return base.ArrangeOverride(finalSize);
}
示例5: GetNewFrameAndApplyEffect
public async Task GetNewFrameAndApplyEffect(IBuffer frameBuffer, Size frameSize)
{
if (_semaphore.WaitOne(500))
{
var scanlineByteSize = (uint)frameSize.Width * 4; // 4 bytes per pixel in BGRA888 mode
var bitmap = new Bitmap(frameSize, ColorMode.Bgra8888, scanlineByteSize, frameBuffer);
if (_filterEffect != null)
{
var renderer = new BitmapRenderer(_filterEffect, bitmap);
await renderer.RenderAsync();
}
else if (_customEffect != null)
{
var renderer = new BitmapRenderer(_customEffect, bitmap);
await renderer.RenderAsync();
}
else
{
var renderer = new BitmapRenderer(_cameraPreviewImageSource, bitmap);
await renderer.RenderAsync();
}
_semaphore.Release();
}
}
示例6: ThumbnailRenderer
public ThumbnailRenderer(Size thumbnailSize, Action<IImageProcessor, SoftwareBitmap> thumbnailCompleteAction)
{
m_thumbnailSize = thumbnailSize;
m_thumbnailCompleteAction = thumbnailCompleteAction;
m_bitmapRenderer = new SoftwareBitmapRenderer();
m_bitmapRenderer.Size = thumbnailSize;
}
示例7: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
// Get the collection of children
UIElementCollection mychildren = Children;
// Get total number of children
int count = mychildren.Count;
// Arrange children
// We're only allowing 9 children in this panel. More children will get a 0x0 layout slot.
int i;
for (i = 0; i < count; i++)
{
// Get (left, top) origin point for the element in the 3x3 block
Point cellOrigin = GetOrigin(i, 12, new Size(50, 50));
// Arrange child
// Get desired height and width. This will not be larger than 100x100 as set in MeasureOverride.
// var cellViewModel = contentPresenter.DataContext as CellViewModel;
double dw = mychildren[i].DesiredSize.Width;
double dh = mychildren[i].DesiredSize.Height;
mychildren[i].Arrange(new Rect(cellOrigin.X, cellOrigin.Y, dw, dh));
}
// Return final size of the panel
return finalSize;
}
示例8: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
this.availableSize = availableSize;
// Children[0] is the outer ScrollViewer
this.Children[0].Measure(availableSize);
return this.Children[0].DesiredSize;
}
示例9: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
Clip = new RectangleGeometry { Rect = new Rect(0, 0, finalSize.Width, finalSize.Height) };
double positionLeft = 0d;
foreach (var item in Children)
{
if (item != null)
{
Size desiredSize = item.DesiredSize;
if (!double.IsNaN(desiredSize.Width) && !double.IsNaN(desiredSize.Height))
{
var rect = new Rect(positionLeft, 0, desiredSize.Width, desiredSize.Height);
item.Arrange(rect);
item.RenderTransform = new TranslateTransform();
positionLeft += desiredSize.Width;
}
}
}
_templateApplied = true;
return finalSize;
}
示例10: InternalMeasure
private Size InternalMeasure(
Size availableSize,
Func<UIElement, Size, Size> childMesaureCallback,
Func<Size, Size> finalSize) {
double requiredHeight = 0;
double requiredWidth = 0;
var availableHeight = double.IsInfinity(availableSize.Height)
? Window.Current.Bounds.Height
: availableSize.Height;
var availableWidth = double.IsInfinity(availableSize.Width)
? Window.Current.Bounds.Width
: availableSize.Width;
foreach (var child in Children) {
var childMeasure = childMesaureCallback(child, new Size(requiredWidth, requiredHeight));
requiredHeight = childMeasure.Height;
requiredWidth = childMeasure.Width;
}
requiredHeight = Math.Max(requiredHeight, 1);
requiredWidth = Math.Max(requiredWidth, 1);
scale = Math.Min(availableWidth / requiredWidth, availableHeight / requiredHeight);
foreach (var child in Children) {
child.Measure(new Size(availableWidth, availableHeight));
}
return finalSize(new Size(requiredWidth, requiredHeight));
}
示例11: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
this.finalSize = finalSize;
// Children[0] is the outer ScrollViewer
this.Children[0].Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
return finalSize;
}
示例12: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
double width = widthColumns.Sum();
double height = rowHeigh.Sum();
if (width > finalSize.Width)
for (int i = 0; i < widthColumns.Count; i++)
widthColumns[i] = widthColumns[i] * finalSize.Width / width;
double xOffset = 0.0;
double yOffset = 0.0;
int row = 0;
int column = 0;
foreach (UIElement child in this.Children)
{
if (column > 0)
xOffset += widthColumns[column - 1];
child.Arrange(new Rect(xOffset, yOffset, widthColumns[column], rowHeigh[row]));
column++;
if (widthColumns.Count != column)
continue;
yOffset += rowHeigh[row];
row++;
column = 0;
xOffset = 0;
}
return new Size(width, height);
}
示例13: ArrangeOverride
protected override Size ArrangeOverride(Size arrangeSize)
{
Point middle = new Point(arrangeSize.Width / 2, arrangeSize.Height / 2);
UIElementCollection mychildren = Children;
foreach (UIElement element in mychildren)
{
double x = 0.0;
double y = 0.0;
double left = GetLeft(element);
if (!double.IsNaN(left))
{
x = left;
}
double top = GetTop(element);
if (!double.IsNaN(top))
{
y = top;
}
element.Arrange(new Rect(new Point(middle.X + x, middle.Y + y), element.DesiredSize));
}
return arrangeSize;
}
示例14: ExecuteTakePictureCommand
private async void ExecuteTakePictureCommand()
{
try
{
Busy = true;
StorageFile file = null;
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Media.Capture.CameraCaptureUI"))
{
// Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
CameraCaptureUI dialog = new CameraCaptureUI();
Size aspectRatio = new Size(16, 9);
dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;
file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
}
if (file != null)
{
// Copy the file into local folder
await file.CopyAsync(ApplicationData.Current.LocalFolder, file.Name, NameCollisionOption.ReplaceExisting);
// Save in the ToDoItem
TodoItem.ImageUri = new Uri("ms-appdata:///local/" + file.Name);
}
}
finally { Busy = false; }
}
示例15: ArrangeOverride
protected override Size ArrangeOverride(Size finalSize)
{
var r = new RectangleGeometry();
r.Rect = new Rect(new Point(0, 0), finalSize);
Clip = r;
return base.ArrangeOverride(finalSize);
}