本文整理汇总了C#中Windows.UI.Xaml.Thickness类的典型用法代码示例。如果您正苦于以下问题:C# Thickness类的具体用法?C# Thickness怎么用?C# Thickness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thickness类属于Windows.UI.Xaml命名空间,在下文中一共展示了Thickness类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPictures
async void RenderPictures()
{
var service = new JDanielSmith.PictureOfTheDay.Service();
var thickness = new Thickness(0, 0, 50, 100);
foreach (var name in service.Names)
{
var image = new Image() { Stretch = Stretch.Fill, Margin = thickness };
const int offset = 25;
thickness = new Thickness(thickness.Left + offset, thickness.Top + offset, thickness.Right - offset, thickness.Bottom - offset);
this.grid1.Children.Add(image);
var result = await service.GetPictureAsync(name);
//var bitmapImage = new BitmapImage(result.Url);
var bitmapImage = new BitmapImage();
// http://jebarson.info/post/2012/03/14/byte-array-to-bitmapimage-converter-irandomaccessstream-implementation-for-windows-8-metro.aspx (see comment)
using (var ms = new Windows.Storage.Streams.InMemoryRandomAccessStream())
{
await result.Image.WriteContentAsync(ms.AsStreamForWrite());
ms.Seek(0);
await bitmapImage.SetSourceAsync(ms);
}
image.Source = bitmapImage;
}
}
示例2: CreateControl
private void CreateControl()
{
var grid = new Grid();
var margin = new Thickness {Top = 24};
grid.Margin = margin;
var distinctEdgesCheckBox = new CheckBox {Margin = margin, VerticalAlignment = VerticalAlignment.Center};
var padding = new Thickness {Left = 12, Right = 12};
distinctEdgesCheckBox.Padding = padding;
var textBlock = new TextBlock
{
VerticalAlignment = VerticalAlignment.Center,
FontSize = FilterControlTitleFontSize,
Text = _resourceLoader.GetString("DistinctEdges/Text")
};
distinctEdgesCheckBox.Content = textBlock;
distinctEdgesCheckBox.IsChecked = Filter.DistinctEdges;
distinctEdgesCheckBox.Checked += distinctEdgesCheckBox_Checked;
distinctEdgesCheckBox.Unchecked += distinctEdgesCheckBox_Unchecked;
var rowDefinition = new RowDefinition {Height = GridLength.Auto};
grid.RowDefinitions.Add(rowDefinition);
var columnDefinition = new ColumnDefinition {Width = GridLength.Auto};
grid.ColumnDefinitions.Add(columnDefinition);
grid.Children.Add(distinctEdgesCheckBox);
Control = grid;
}
示例3: Deflate
/// <summary>
/// Deflates rectangle by given thickness
/// </summary>
/// <param name="rect">Rectangle</param>
/// <param name="thick">Thickness</param>
/// <returns>Deflated Rectangle</returns>
public static Rect Deflate(this Rect rect, Thickness thick)
{
return new Rect(rect.Left + thick.Left,
rect.Top + thick.Top,
Math.Max(0.0, rect.Width - thick.Left - thick.Right),
Math.Max(0.0, rect.Height - thick.Top - thick.Bottom));
}
示例4: OnHighlightBoundsChanged
/// <summary>
/// Provides derived classes an opportunity to handle changes
/// to the HighlightBounds property.
/// </summary>
/// <param name="oldHighlightBounds">The old HighlightBounds value</param>
/// <param name="newHighlightBounds">The new HighlightBounds value</param>
private void OnHighlightBoundsChanged(
Thickness oldHighlightBounds, Thickness newHighlightBounds)
{
this.HighlightRect.Margin = newHighlightBounds;
this.UpdateExtendedLinesPositions();
this.UpdateHighlightTextPosition();
}
示例5: UpdateMarginToFitHamburgerMenu
private void UpdateMarginToFitHamburgerMenu(HamburgerMenu hamburgerMenu = null)
{
hamburgerMenu = hamburgerMenu ?? ParentHamburgerMenu;
if (hamburgerMenu == null)
{
Margin = new Thickness(0);
return;
}
switch (hamburgerMenu.DisplayMode)
{
case SplitViewDisplayMode.Overlay:
{
var buttonVisible = hamburgerMenu.HamburgerButtonVisibility == Visibility.Visible;
Margin = buttonVisible ? new Thickness(0) : new Thickness(48, 0, 0, 0);
}
break;
case SplitViewDisplayMode.Inline:
case SplitViewDisplayMode.CompactOverlay:
case SplitViewDisplayMode.CompactInline:
{
Margin = new Thickness(0);
}
break;
}
}
示例6: AddButtons
private void AddButtons(int count)
{
for (int i = 0; i < count; i++)
{
this.GameBoard.ColumnDefinitions.Add(new ColumnDefinition());
this.GameBoard.RowDefinitions.Add(new RowDefinition());
}
Button button;
for (int x = 0; x < count; x++)
{
for (int y = 0; y < count; y++)
{
button = new Button();
button.HorizontalAlignment = HorizontalAlignment.Stretch;
button.VerticalAlignment = VerticalAlignment.Stretch;
button.SetValue(Grid.ColumnProperty, x);
button.SetValue(Grid.RowProperty, y);
Thickness margin = new Thickness(10);
button.Margin = margin;
this.GameBoard.Children.Add(button);
}
}
}
示例7: PerformFaceAnalysis
private async void PerformFaceAnalysis(StorageFile file)
{
var imageInfo = await FileHelper.GetImageInfoForRendering(file.Path);
NewImageSizeWidth = 300;
NewImageSizeHeight = NewImageSizeWidth*imageInfo.Item2/imageInfo.Item1;
var newSourceFile = await FileHelper.CreateCopyOfSelectedImage(file);
var uriSource = new Uri(newSourceFile.Path);
SelectedFileBitmapImage = new BitmapImage(uriSource);
// start face api detection
var faceApi = new FaceApiHelper();
DetectedFaces = await faceApi.StartFaceDetection(newSourceFile.Path, newSourceFile, imageInfo, "4c138b4d82b947beb2e2926c92d1e514");
// draw rectangles
var color = Color.FromArgb(125, 255, 0, 0);
var bg = new SolidColorBrush(color);
DetectedFacesCanvas = new ObservableCollection<Canvas>();
foreach (var detectedFace in DetectedFaces)
{
var margin = new Thickness(detectedFace.RectLeft, detectedFace.RectTop, 0, 0);
var canvas = new Canvas()
{
Background = bg,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Height = detectedFace.RectHeight,
Width = detectedFace.RectWidth,
Margin = margin
};
DetectedFacesCanvas.Add(canvas);
}
}
示例8: CommandBarGridView
public CommandBarGridView()
{
this.Loaded += (s, a) =>
{
AppShell.Current.TogglePaneButtonRectChanged += Current_TogglePaneButtonSizeChanged;
Margin = new Thickness(AppShell.Current.TogglePaneButtonRect.Right, 0, 0, 0);
};
}
示例9: Configure
public void Configure (ITreeGridItem item)
{
Item = item;
var index = Controller.IndexOf (item);
IsChecked = Controller.IsExpanded (index);
Visibility = item != null && item.Expandable ? Visibility.Visible : Visibility.Hidden;
Margin = new Thickness (Controller.LevelAtRow (index) * LevelWidth, 0, 0, 0);
}
示例10: Block
public Block()
{
_image = new Image();
_image.Source = new BitmapImage(new Uri("ms-appx:/Assets/test.png"));
_image.Height = 160;
_image.Width = 100;
_thickness = new Thickness(0, 0, 0, 0);
_image.Margin = _thickness;
}
示例11: ShowSettingsPanel
public void ShowSettingsPanel()
{
Thickness th = new Thickness(0);
settingsCtrl.Margin = th;
settingsCtrl.Visibility = Visibility.Visible;
settingsCtrl.Initialize(_viewModel);
// PointerPressed dismisses SettingsPanel
this.PointerPressed += new PointerEventHandler(HideSettingsPanel);
}
示例12: OnApplyTemplate
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
Margin = new Thickness { Left = Window.Current.Bounds.Width * 0.05};
Width = Window.Current.Bounds.Width * 0.9;
Height = Window.Current.Bounds.Height * 0.9;
var chromecasts = GetTemplateChild("ChromecastListView") as ListView;
chromecasts.DataContext = this;
if (chromecasts != null) chromecasts.Tapped += Chromecast_Tapped;
}
示例13: Parse
public virtual Windows.UI.Xaml.Thickness Parse(Thickness thickness)
{
Windows.UI.Xaml.Thickness nativeThickness = new Windows.UI.Xaml.Thickness();
if (thickness.Left.HasValue) nativeThickness.Left = (int)thickness.Left;
if (thickness.Top.HasValue) nativeThickness.Top = (int)thickness.Top;
if (thickness.Right.HasValue) nativeThickness.Right = (int)thickness.Right;
if (thickness.Bottom.HasValue) nativeThickness.Bottom = (int)thickness.Bottom;
return nativeThickness;
}
示例14: SegmentSurveyComboBox
public SegmentSurveyComboBox()
{
this.DefaultStyleKey = typeof(ComboBox);
SelectionChanged += ComboBox_OnSelectionChanged;
DataContextChanged += ComboBox_OnDataContextChanged;
FontFamily = new FontFamily("Segoe UI");
FontSize = 15;
Margin = new Thickness(0, 2, 10, 0);
Loaded += ComboBox_OnLoaded;
}
示例15: Convert
public object Convert(object value, Type targetType, object parameter, string language)
{
var isSmallRes = WindowHelper.IsSmallResolution();
var tileHeight = !isSmallRes ? new[] { 410, 270, 270, 270, 130 } : new[] { 270, 130, 130, 130, 130 };
var driver = value as Driver;
var percent = driver.Rate.AvgRate * (tileHeight[driver.Index] - 20) / 10;
var margin = new Thickness { Left = 0, Top = 0, Right = 0, Bottom = percent };
return margin;
}