本文整理汇总了C#中Windows.UI.Xaml.Thickness类的典型用法代码示例。如果您正苦于以下问题:C# Thickness类的具体用法?C# Thickness怎么用?C# Thickness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thickness类属于Windows.UI.Xaml命名空间,在下文中一共展示了Thickness类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:JDanielSmith,项目名称:Projects,代码行数:29,代码来源:MainPage.xaml.cs
示例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;
}
开发者ID:JuannyWang,项目名称:filter-effects,代码行数:35,代码来源:MarvelFilter.cs
示例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));
}
开发者ID:ChrisCross67,项目名称:wpfspark,代码行数:13,代码来源:Utils.cs
示例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();
}
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:13,代码来源:HighlightOverlay.xaml.cs
示例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;
}
}
开发者ID:liptonbeer,项目名称:Template10,代码行数:25,代码来源:PageHeader.cs
示例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);
}
}
}
开发者ID:Caverat,项目名称:TicTacToe,代码行数:27,代码来源:MainPage.xaml.cs
示例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);
}
}
开发者ID:modulexcite,项目名称:ProjectOxford,代码行数:35,代码来源:MainPage.xaml.cs
示例8: CommandBarGridView
public CommandBarGridView()
{
this.Loaded += (s, a) =>
{
AppShell.Current.TogglePaneButtonRectChanged += Current_TogglePaneButtonSizeChanged;
Margin = new Thickness(AppShell.Current.TogglePaneButtonRect.Right, 0, 0, 0);
};
}
开发者ID:Adam8234,项目名称:the-blue-alliance-windows,代码行数:8,代码来源:CommandBarGridView.cs
示例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);
}
开发者ID:mhusen,项目名称:Eto,代码行数:8,代码来源:TreeToggleButton.cs
示例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;
}
开发者ID:housemeow,项目名称:OurSecrets,代码行数:9,代码来源:Block.cs
示例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);
}
开发者ID:jayway,项目名称:Kelly-Win8-XAML,代码行数:9,代码来源:MainPage.xaml.cs
示例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;
}
开发者ID:tapanila,项目名称:SharpCaster,代码行数:10,代码来源:CastDialog.cs
示例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;
}
开发者ID:okhosting,项目名称:OKHOSTING.UI,代码行数:11,代码来源:Platform.cs
示例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;
}
开发者ID:yuqiqian,项目名称:Copacescc,代码行数:12,代码来源:SegmentSurveyComboBox.cs
示例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;
}
开发者ID:EmiiFont,项目名称:MyShuttle_RC,代码行数:12,代码来源:MyShuttleRateToMarginConverter.cs
示例16: ProcessImageAsync
private async Task ProcessImageAsync()
{
var bitmapImage = new BitmapImage();
try
{
using (var client = new HttpClient())
{
using (var stream = await client.GetStreamAsync(new Uri(BlobUrl)))
{
var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream);
memoryStream.Position = 0;
bitmapImage.SetSource(memoryStream.AsRandomAccessStream());
}
}
}
catch (Exception ex)
{ }
//InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream();
//var httpClient = new HttpClient();
//var webReq = (HttpWebRequest)WebRequest.Create(BlobUrl);
//var httpClient.re
//using (WebResponse response = await webReq.GetResponseAsync())
//{
// using (Stream responseStream = response.GetResponseStream())
// {
// try
// {
// responseStream.CopyTo(stream);
// }
// catch (Exception ex)
// { }
// }
//}
//var image = new BitmapImage();
//image.SetSource(stream);
//Image = image;
Image = bitmapImage;
var scale = 350.0 / Image.PixelWidth;
FaceBoxWidth = FaceRectangle.Width * scale;
FaceBoxHeight = FaceRectangle.Height * scale;
FaceBoxMargin = new Thickness(FaceRectangle.Left * scale, FaceRectangle.Top * scale, 0, 0);
OnPropertyChanged("Image");
OnPropertyChanged("FaceBoxWidth");
OnPropertyChanged("FaceBoxHeight");
OnPropertyChanged("FaceBoxMargin");
}
开发者ID:CatalystCode,项目名称:bb9-oxford,代码行数:53,代码来源:SimilarFaceResult.cs
示例17: PageHeader_Loaded
private void PageHeader_Loaded(object sender, RoutedEventArgs e)
{
this.dataExchangeService = ((App)App.Current).Scope.Resolve<IDataExchangeService>();
this.dataExchangeService.DataExchangeStarted += UpdateProgressIndicator;
this.dataExchangeService.DataExchangeComplete += UpdateProgressIndicator;
var margin = Margin;
margin = new Thickness(margin.Left, margin.Top + 5, margin.Right, margin.Bottom);
Margin = margin;
UpdateProgressIndicator(sender, null);
}
开发者ID:Korshunoved,项目名称:Win10reader,代码行数:12,代码来源:PageHeader.xaml.cs
示例18: MeasureOverride
protected override Size MeasureOverride(Size availableSize)
{
double height = availableSize.Width / this.AspectRatio;
height = Math.Max(height, this.MinHeight);
height = Math.Min(height, this.MaxHeight);
double ratio = Math.Min(2, height / this.MinHeight);
this.RelativePadding = new Thickness(this.Padding.Left * ratio, this.Padding.Top * ratio, this.Padding.Right * ratio, this.Padding.Bottom * ratio);
var size = new Size(availableSize.Width, height);
base.MeasureOverride(size);
return size;
}
开发者ID:ridomin,项目名称:waslibs,代码行数:13,代码来源:ResponsiveRow.cs
示例19: MainPage
public MainPage()
{
this.InitializeComponent();
_blocksList = new List<Block>();
_textBox.Text = _blocksList.Count.ToString();
//_imgSanta.ManipulationMode = ManipulationModes.All;
_imgSanta.PointerPressed += OnPointerPressed;
_imgSanta.PointerMoved += OnPointerMoved;
_imgSanta.PointerReleased += OnPointerReleased;
//_imgSanta.ManipulationStarted += StartedImageManipulation;
_thickness = new Thickness(200, 0, 0, 0);
_imgSanta.Margin = _thickness;
_isPressed = false;
}
开发者ID:housemeow,项目名称:OurSecrets,代码行数:14,代码来源:MainPage.xaml.cs
示例20: SegmentSurveyTextBox
public SegmentSurveyTextBox()
{
DefaultStyleKey = typeof(TextBox);
FontFamily = new FontFamily("Segoe UI");
FontSize = 15;
Margin = new Thickness(0, 5, 10, 0);
LostFocus += TextBox_OnLostFocus;
DataContextChanged += TextBox_OnDataContextChanged;
Loaded += TextBox_OnLoaded;
IsDataValid = true;
}
开发者ID:yuqiqian,项目名称:Copacescc,代码行数:14,代码来源:SegmentSurveyTextBox.cs
注:本文中的Windows.UI.Xaml.Thickness类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论