本文整理汇总了C#中Dimensions类的典型用法代码示例。如果您正苦于以下问题:C# Dimensions类的具体用法?C# Dimensions怎么用?C# Dimensions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dimensions类属于命名空间,在下文中一共展示了Dimensions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImagePart
/// <summary>
/// Instantiates a new instance of <see cref="ImagePart"/>.
/// </summary>
/// <param name="imageUrl">The url to the image.</param>
/// <param name="text">The text.</param>
/// <param name="linkUrl">The url to the link.</param>
/// <param name="dimensions">The dimensions of the image.</param>
public ImagePart(string imageUrl, string text, string linkUrl, Dimensions dimensions)
{
ImageUrl = imageUrl;
Text = text;
LinkUrl = linkUrl;
Dimensions = dimensions;
}
示例2: CreateAnimationCore
/// <summary>
/// Create a <see cref="Storyboard"/> to be used to animate the view,
/// based on the animation configuration supplied at initialization
/// time and the new view position and size.
/// </summary>
/// <param name="view">The view to create the animation for.</param>
/// <param name="dimensions">The view dimensions.</param>
protected override IObservable<Unit> CreateAnimationCore(FrameworkElement view, Dimensions dimensions)
{
var fromValue = IsReverse ? 1.0 : 0.0;
var toValue = IsReverse ? 0.0 : 1.0;
var animatedProperty = AnimatedProperty;
if (animatedProperty.HasValue)
{
var storyboard = new Storyboard();
var @finally = default(Action);
switch (animatedProperty.Value)
{
case AnimatedPropertyType.Opacity:
view.Opacity = fromValue;
storyboard.Children.Add(CreateOpacityAnimation(view, fromValue, toValue));
@finally = () => view.Opacity = toValue;
break;
case AnimatedPropertyType.ScaleXY:
// TODO: implement this layout animation option
throw new NotImplementedException();
default:
throw new InvalidOperationException(
"Missing animation for property: " + animatedProperty.Value);
}
return new StoryboardObservable(storyboard, @finally);
}
throw new InvalidOperationException(
"Missing animated property from the animation configuration.");
}
示例3: OutputRaster
//---------------------------------------------------------------------
public OutputRaster(string path,
Dimensions dimensions)
: base(path, dimensions)
{
this.pixelsWritten = 0;
this.disposed = false;
}
示例4: GetImageFromGoogleCharts
Image GetImageFromGoogleCharts(Dimensions dimensions)
{
var chl = "&chl=" + Uri.EscapeDataString(GetValue<string>("text"));
var chs = string.Format("&chs={0}x{1}", dimensions.Width,
dimensions.Height);
var choe = "&choe=" + GetEncodingString();
var chld = string.Format("&chld={0}|{1}", GetValue<string>("error_correction"),
GetValue<int>("margin"));
var url = "http://chart.apis.google.com/chart?cht=qr"
+ chl + chs + choe + chld;
var procedure = new Procedure("file-uri-load");
try
{
var returnArgs = procedure.Run(url, url);
return returnArgs[0] as Image;
}
catch (GimpSharpException e)
{
new Message(e.Message);
return null;
}
}
示例5: Raster
//---------------------------------------------------------------------
/// <summary>
/// Initializes a new instance.
/// </summary>
public Raster(string path,
Dimensions dimensions)
{
this.path = path;
this.dimensions = dimensions;
this.disposed = false;
UpdatePixelCount();
}
示例6: Bathroom
public Bathroom(Dimensions dimensions, bool hasToilet, bool hasShower, bool hasBath, bool hasSink)
{
Dimensions = dimensions;
HasToilet = hasToilet;
HasShower = hasShower;
HasBath = hasBath;
HasSink = hasSink;
}
示例7: Path
public static string Path(Dimensions dim, int x, int z)
{
string path = "world/";
if (dim != Dimensions.Overworld)
path += "DIM" + ((int)dim) + "/";
path += "region/r." + (x >> 9) + "." + (z >> 9) + ".mca";
return path;
}
示例8: CreateAnimationCore
/// <summary>
/// Create an observable animation to be used to animate the view,
/// based on the animation configuration supplied at initialization
/// time and the new view position and size.
/// </summary>
/// <param name="view">The view to create the animation for.</param>
/// <param name="dimensions">The view dimensions</param>
/// <returns>
/// An observable sequence that starts an animation when subscribed to,
/// stops the animation when disposed, and that completes
/// simultaneously with the underlying animation.
/// </returns>
protected override IObservable<Unit> CreateAnimationCore(FrameworkElement view, Dimensions dimensions)
{
Canvas.SetLeft(view, dimensions.X);
Canvas.SetTop(view, dimensions.Y);
view.Width = dimensions.Width;
view.Height = dimensions.Height;
return base.CreateAnimationCore(view, dimensions);
}
示例9: PlatformInfoProvider
#pragma warning restore 0067
public PlatformInfoProvider()
{
Deployment.Current.Dispatcher.BeginInvoke(() => {
double scale = (double)Application.Current.Host.Content.ScaleFactor / 100;
int h = (int)Math.Ceiling(Application.Current.Host.Content.ActualHeight * scale);
int w = (int)Math.Ceiling(Application.Current.Host.Content.ActualWidth * scale);
_screenResolution = new Dimensions(h, w);
});
}
示例10: OutputRaster
//---------------------------------------------------------------------
public OutputRaster(string path,
Dimensions dimensions,
IMetadata metadata)
: base(path, dimensions, metadata)
{
this.pixelsWritten = 0;
this.pixelCount = dimensions.Rows * dimensions.Columns;
this.disposed = false;
}
示例11: Raster
//---------------------------------------------------------------------
public Raster(string path,
Dimensions dimensions,
IMetadata metadata)
{
this.path = path;
this.dimensions = dimensions;
this.metadata = metadata;
this.disposed = false;
}
示例12: Load
public static McaFile Load(Dimensions dim, int x, int z)
{
string path = McaFile.Path(dim, x, z);
if (File.Exists(path) == false)
return null;
McaFile mca = new McaFile(dim, x, z);
mca.LoadFromFile(path);
return mca;
}
示例13: GetSubMatrix
public Matrix2D GetSubMatrix(int index, Dimensions dimsType)
{
switch (dimsType)
{
case Dimensions.TimeDimension:
throw new InvalidOperationException("Can't get submatrix for this dimension");
case Dimensions.Thickness:
if (index < thickness)
{
Matrix2D result = new Matrix2D(width, height);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
result[i, j] = this[i, j, index];
}
}
return result;
}
else
throw new ArgumentException("Invalid indexer");
case Dimensions.Height:
if (index < height)
{
Matrix2D result = new Matrix2D(width, thickness);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < thickness; j++)
{
result[i, j] = this[i, index, j];
}
}
return result;
}
else
throw new ArgumentException("Invalid indexer");
case Dimensions.Width:
if (index < width)
{
Matrix2D result = new Matrix2D(height, thickness);
for (int i = 0; i < height; i++)
{
for (int j = 0; j < thickness; j++)
{
result[i, j] = this[index, i, j];
}
}
return result;
}
else
throw new ArgumentException("Invalid indexer");
default:
throw new Exception("Something strange has happened");
}
}
示例14: ResizeHeightMaintainAspectRatio
public static Dimensions ResizeHeightMaintainAspectRatio(Dimensions originalDimensions, int maximumHeight)
{
var resizedHeight = originalDimensions.Height > maximumHeight
? maximumHeight
: originalDimensions.Height;
var resizedWidth = ((float)resizedHeight) / ((float)originalDimensions.Height);
resizedWidth = resizedWidth * originalDimensions.Width;
return new Dimensions((int)resizedWidth, resizedHeight);
}
示例15: ResizeWidthMaintainAspectRatio
public static Dimensions ResizeWidthMaintainAspectRatio(Dimensions originalDimensions, int maximumWidth)
{
int resizedWidth = originalDimensions.Width > maximumWidth
? maximumWidth
: originalDimensions.Width;
float resizedHeight = ((float)resizedWidth) / ((float)originalDimensions.Width);
resizedHeight = resizedHeight * originalDimensions.Height;
return new Dimensions(resizedWidth, (int)resizedHeight);
}