本文整理汇总了C#中Thickness类的典型用法代码示例。如果您正苦于以下问题:C# Thickness类的具体用法?C# Thickness怎么用?C# Thickness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thickness类属于命名空间,在下文中一共展示了Thickness类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Button
public Button()
{
DrawLayerNumber += 1; // (button design image)
Padding = new Thickness(10, 5, 10, 7);
MouseOverStateChanged += (sender, args) => InvalidateButtonImage();
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:Button.cs
示例2: StackLayoutGallery
public StackLayoutGallery ()
{
Device.OnPlatform (iOS: () => {
if (Device.Idiom == TargetIdiom.Tablet) {
Padding = new Thickness (0, 0, 0, 60);
}
});
var stack = new StackLayout { Orientation = StackOrientation.Vertical };
Button b1 = new Button { Text = "Boring", HeightRequest = 500, MinimumHeightRequest = 50 };
Button b2 = new Button {
Text = "Exciting!",
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
Button b3 = new Button { Text = "Amazing!", VerticalOptions = LayoutOptions.FillAndExpand };
Button b4 = new Button { Text = "Meh", HeightRequest = 400, MinimumHeightRequest = 50 };
b1.Clicked += (sender, e) => {
b1.Text = "clicked1";
};
b2.Clicked += (sender, e) => {
b2.Text = "clicked2";
};
b3.Clicked += (sender, e) => {
b3.Text = "clicked3";
};
b4.Clicked += (sender, e) => {
b4.Text = "clicked4";
};
stack.Children.Add (b1);
stack.Children.Add (b2);
stack.Children.Add (b3);
stack.Children.Add (b4);
Content = stack;
}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:35,代码来源:StackLayoutGallery.cs
示例3: PopUpPanel
/// <summary>
/// Extension of the Panel which has Button to close itself and Label with title.
/// Position is calculate from given width and height (1/4 of the width and 1/5 of the height).
/// Also panel width and height is calculate as 1/2 of the width and 4/7 of the hight.
/// </summary>
/// <param name="screenWidth">The width od screen.</param>
/// <param name="screenHeight">The height od screen.</param>
/// <param name="text">The title text.</param>
/// <param name="name">The name of the panel.</param>
/// <param name="rowHeight">The height of the title label.</param>
/// <param name="panelSkin">The skin of the creating panel.</param>
/// <param name="buttonSkin">The skin of the the closing button.</param>
public PopUpPanel(int screenWidth, int screenHeight, string text, string name, int rowHeight, Skin panelSkin, Skin buttonSkin)
{
Width = screenWidth / 2;
Height = screenHeight * 4 / 7;
Location = new Point(screenWidth / 4, screenHeight / 5);
Skin = panelSkin;
ResizeMode = ResizeModes.None;
Padding = new Thickness(5, 10, 0, 0);
Name = name;
// Title label
var label = new Label() {
Size = new Size(Width / 2, rowHeight),
Text = text,
Location = new Point(Width / 4, 0),
TextStyle = {
Alignment = Miyagi.Common.Alignment.TopCenter
}
};
Controls.Add(label);
Button closeButton = new CloseButton(name) {
Size = new Size(Width / 3, Height / 12),
Location = new Point(Width * 5 / 8, Height * 7 / 8),
Skin = buttonSkin,
Text = "Cancel",
TextStyle = new TextStyle {
Alignment = Alignment.MiddleCenter
}
};
Controls.Add(closeButton);
}
开发者ID:vavrekmichal,项目名称:StrategyGame,代码行数:45,代码来源:PopUpPanel.cs
示例4: ImageLoadingGallery
public ImageLoadingGallery ()
{
Padding = new Thickness (20);
var source = new UriImageSource {
Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"),
CachingEnabled = false
};
var image = new Image {
Source = source,
WidthRequest = 200,
HeightRequest = 200,
};
var indicator = new ActivityIndicator {Color = new Color (.5),};
indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
indicator.BindingContext = image;
var grid = new Grid();
grid.RowDefinitions.Add (new RowDefinition());
grid.RowDefinitions.Add (new RowDefinition());
grid.Children.Add (image);
grid.Children.Add (indicator);
var cancel = new Button { Text = "Cancel" };
cancel.Clicked += (s, e) => source.Cancel();
Grid.SetRow (cancel, 1);
grid.Children.Add (cancel);
Content = grid;
}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:33,代码来源:ImageLoadingGallery.cs
示例5: BoxSetupWizardDialog
public BoxSetupWizardDialog(Screen screen)
: base(screen)
{
viewModel = new BoxSetupViewModel(screen.Game);
DataContext = viewModel;
// 開く際に openAnimation で Width を設定するので 0 で初期化します。
Width = 0;
ShadowOffset = new Vector2(4);
Padding = new Thickness(16);
Overlay.Opacity = 0.5f;
tabControl = new TabControl(screen)
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch
};
Content = tabControl;
attentionTabItem = new AttentionTabItem(Screen);
attentionTabItem.FocusToDefault();
attentionTabItem.AgreeSelected += OnAttentionTabItemAgreeSelected;
attentionTabItem.CancelSelected += OnAttentionTabItemCancelSelected;
tabControl.Items.Add(attentionTabItem);
tabControl.SelectedIndex = 0;
authorizationTabItem = new AuthorizationTabItem(Screen);
authorizationTabItem.NextSelected += OnAuthorizationTabItemNextSelected;
authorizationTabItem.BackSelected += OnAuthorizationTabItemBackSelected;
tabControl.Items.Add(authorizationTabItem);
accessTabItem = new AccessTabItem(Screen);
accessTabItem.NextSelected += OnAccessTabItemNextSelected;
accessTabItem.BackSelected += OnAccessTabItemBackSelected;
tabControl.Items.Add(accessTabItem);
prepareFolderTreeTabItem = new PrepareFolderTreeTabItem(Screen);
prepareFolderTreeTabItem.CreateSelected += OnPrepareFolderTreeTabItemCreateSelected;
prepareFolderTreeTabItem.CancelSelected += OnPrepareFolderTreeTabItemCancelSelected;
tabControl.Items.Add(prepareFolderTreeTabItem);
saveSettingsTabItem = new SaveSettingsTabItem(Screen);
saveSettingsTabItem.YesSelected += OnSaveSettingsTabItemYesSelected;
saveSettingsTabItem.NoSelected += OnSaveSettingsTabItemNoSelected;
tabControl.Items.Add(saveSettingsTabItem);
finishTabItem = new FinishTabItem(Screen);
finishTabItem.UploadSelected += OnFinishTabItemUploadSelected;
finishTabItem.CancelSelected += OnFinishTabItemCancelSelected;
tabControl.Items.Add(finishTabItem);
openAnimation = new FloatLerpAnimation
{
Action = (current) => { Width = current; },
From = 0,
To = 480,
Duration = TimeSpan.FromSeconds(0.1f)
};
Animations.Add(openAnimation);
}
开发者ID:willcraftia,项目名称:Blocks,代码行数:60,代码来源:BoxSetupWizardDialog.cs
示例6: ConfirmationDialog
public ConfirmationDialog(Screen screen)
: base(screen)
{
ShadowOffset = new Vector2(4);
Padding = new Thickness(16);
var stackPanel = new StackPanel(screen)
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Stretch
};
Content = stackPanel;
messageContainer = new DialogMessageContainer(screen)
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch
};
stackPanel.Children.Add(messageContainer);
var separator = ControlUtil.CreateDefaultSeparator(screen);
stackPanel.Children.Add(separator);
var okButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.OKButton);
stackPanel.Children.Add(okButton);
RegisterOKButton(okButton);
cancelButton = ControlUtil.CreateDefaultDialogButton(screen, Strings.CancelButton);
stackPanel.Children.Add(cancelButton);
RegisterCancelButton(cancelButton);
}
开发者ID:willcraftia,项目名称:Blocks,代码行数:31,代码来源:ConfirmationDialog.cs
示例7: CMSearchTextBox
public CMSearchTextBox() : base()
{
BorderThickness = new Thickness(0, 0, 0, 0);
Padding = new Thickness(10, 5, 5, 0);
var valueTip = Custom_UC.UC_AddressBook.ResourcesStringLoader.GetString("STATIC-Textbox-Search-Tooltip-Value");
ToolTipService.SetToolTip(this, valueTip);
}
开发者ID:thongvo,项目名称:myfiles,代码行数:7,代码来源:CMSearchTextBox.cs
示例8: MARGINS
public MARGINS(Thickness t)
{
Left = (int)t.Left;
Right = (int)t.Right;
Top = (int)t.Top;
Bottom = (int)t.Bottom;
}
开发者ID:raven-ie,项目名称:MASGAU,代码行数:7,代码来源:GlassHelper.cs
示例9: MaterialEditWindow
public MaterialEditWindow(Screen screen)
: base(screen)
{
DataContext = new MaterialEdit();
ShadowOffset = new Vector2(4);
Padding = new Thickness(16);
HorizontalAlignment = HorizontalAlignment.Left;
VerticalAlignment = VerticalAlignment.Top;
var stackPanel = new StackPanel(screen)
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Stretch
};
Content = stackPanel;
diffuseColorButton = new LightColorButton(screen);
diffuseColorButton.NameTextBlock.Text = "Diffuse color";
diffuseColorButton.Click += OnDiffuseColorButtonClick;
stackPanel.Children.Add(diffuseColorButton);
specularColorButton = new LightColorButton(screen);
specularColorButton.NameTextBlock.Text = "Specular color";
specularColorButton.Click += OnSpecularColorButtonClick;
stackPanel.Children.Add(specularColorButton);
}
开发者ID:willcraftia,项目名称:Blocks,代码行数:27,代码来源:MaterialEditWindow.cs
示例10: EasingThicknessKeyFrame
/// <summary>
/// Creates a new EasingThicknessKeyFrame.
/// </summary>
public EasingThicknessKeyFrame(Thickness value, KeyTime keyTime, IEasingFunction easingFunction)
: this()
{
Value = value;
KeyTime = keyTime;
EasingFunction = easingFunction;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:EasingKeyFrames.cs
示例11: DrawFullRectangle
public static ShapeDescription DrawFullRectangle(Vector3 position, Size size, IGradientShader linearShader, Color4 fillColor, Thickness borderSize, BorderStyle borderStyle, Color4 borderColor)
{
Color4[] shadedColors = linearShader.Method(linearShader, 4,Shape.Rectangle);
Color4[] borderColors;
switch (borderStyle)
{
case BorderStyle.None:
borderColors = LinearShader.FillColorArray(new Color4(0), 4);
break;
case BorderStyle.Flat:
borderColors = LinearShader.FillColorArray(borderColor, 4);
break;
case BorderStyle.Raised:
borderColors = LinearShader.BorderRaised(borderColor, 4);
break;
case BorderStyle.Sunken:
borderColors = LinearShader.BorderSunken(borderColor, 4);
break;
default:
throw new ArgumentOutOfRangeException("borderStyle");
}
ShapeDescription inside = DrawRectangle(position, size, shadedColors);
ShapeDescription outline = DrawRectangularOutline(position, size, borderSize.All, borderColors, borderStyle, Borders.All);
ShapeDescription result = ShapeDescription.Join(inside, outline);
result.Shape = Shape.RectangleWithOutline;
return result;
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:29,代码来源:ShapeCreator.Rectangle.cs
示例12: DefaultValues
protected override void DefaultValues()
{
base.DefaultValues();
velocity = new Vector2(0.3f, FALLSPEED);
MARGIN = new Thickness(200, -40, 200, 40);
}
开发者ID:WaveEngine,项目名称:Samples,代码行数:7,代码来源:MeteorBehavior.cs
示例13: Render
public override void Render (ConsoleBuffer buffer)
{
if (buffer == null)
throw new ArgumentNullException(nameof(buffer));
Rect renderRectWithoutShadow = new Rect(RenderSize).Deflate(Thickness.Max(Shadow, 0));
//base.Render(buffer);
if (Background != null)
buffer.FillBackgroundRectangle(renderRectWithoutShadow, Background.Value);
buffer.FillForegroundRectangle(new Rect(RenderSize), EffectiveColor);
if (!Shadow.IsEmpty) {
// 3 2 2 1: -1 -1 2 3:
// ▄▄▄▄▄▄▄▄▄ oooo▄▄
// █████████ oooo██
// ███oooo██ █████
// ███oooo██ █████
// ▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀
Thickness shadowLineDelta = new Thickness(0, 1);
Thickness shadowOffset = Thickness.Max(-Shadow - shadowLineDelta, 0);
Rect shadowRect = new Rect(RenderSize).Deflate(shadowOffset);
if (Shadow.Top != 0)
buffer.FillForegroundLine(shadowRect.TopLine, ShadowColor, Chars.LowerHalfBlock);
if (Shadow.Bottom != 0)
buffer.FillForegroundLine(shadowRect.BottomLine, ShadowColor, Chars.UpperHalfBlock);
buffer.FillForegroundRectangle(shadowRect.Deflate(shadowLineDelta), ShadowColor, Chars.FullBlock);
if (ShadowColor == null && ShadowColorMap != null)
buffer.ApplyColorMap(shadowRect, ShadowColorMap,
(ref ConsoleChar c) => c.ForegroundColor = ShadowColorMap[(int)c.BackgroundColor]);
}
buffer.FillForegroundRectangle(renderRectWithoutShadow, EffectiveColor);
buffer.DrawRectangle(renderRectWithoutShadow, EffectiveColor, Stroke);
}
开发者ID:jhorv,项目名称:CsConsoleFormat,代码行数:35,代码来源:Border.cs
示例14: SelectLanguageDialog
public SelectLanguageDialog(Screen screen)
: base(screen)
{
// 開く際に openAnimation で Width を設定するので 0 で初期化します。
Width = 0;
ShadowOffset = new Vector2(4);
Padding = new Thickness(16);
Overlay.Opacity = 0.5f;
var stackPanel = new StackPanel(screen)
{
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Stretch
};
Content = stackPanel;
var title = new TextBlock(screen)
{
Text = Strings.SelectLanguageTitle,
Padding = new Thickness(4),
ForegroundColor = Color.Yellow,
BackgroundColor = Color.Black,
HorizontalAlignment = HorizontalAlignment.Stretch,
TextHorizontalAlignment = HorizontalAlignment.Left,
ShadowOffset = new Vector2(2)
};
stackPanel.Children.Add(title);
var separator = ControlUtil.CreateDefaultSeparator(screen);
stackPanel.Children.Add(separator);
var jaButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.JaButton);
jaButton.Click += OnJaButtonClick;
stackPanel.Children.Add(jaButton);
var enButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.EnButton);
enButton.Click += OnEnButtonClick;
stackPanel.Children.Add(enButton);
var defaultButton = ControlUtil.CreateDefaultMenuButton(screen, Strings.DefaultButton);
defaultButton.Click += OnDefaultButtonClick;
stackPanel.Children.Add(defaultButton);
var cancelButon = ControlUtil.CreateDefaultMenuButton(screen, Strings.CancelButton);
cancelButon.Click += (Control s, ref RoutedEventContext c) => Close();
stackPanel.Children.Add(cancelButon);
openAnimation = new FloatLerpAnimation
{
Action = (current) => { Width = current; },
From = 0,
To = 240,
Duration = TimeSpan.FromSeconds(0.1f)
};
Animations.Add(openAnimation);
cancelButon.Focus();
}
开发者ID:willcraftia,项目名称:Blocks,代码行数:59,代码来源:SelectLanguageDialog.cs
示例15: ImageGallery
public ImageGallery ()
{
Padding = new Thickness (20);
var normal = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
var disabled = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
var rotate = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
var transparent = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
var embedded = new Image { Source = ImageSource.FromResource ("Xamarin.Forms.Controls.ControlGalleryPages.crimson.jpg", typeof (ImageGallery)) };
// let the stack shrink the images
normal.MinimumHeightRequest = normal.MinimumHeightRequest = 10;
disabled.MinimumHeightRequest = disabled.MinimumHeightRequest = 10;
rotate.MinimumHeightRequest = rotate.MinimumHeightRequest = 10;
transparent.MinimumHeightRequest = transparent.MinimumHeightRequest = 10;
embedded.MinimumHeightRequest = 10;
disabled.IsEnabled = false;
rotate.GestureRecognizers.Add (new TapGestureRecognizer { Command = new Command (o => rotate.RelRotateTo (180))});
transparent.Opacity = .5;
Content = new StackLayout {
Orientation = StackOrientation.Horizontal,
Children = {
new StackLayout {
//MinimumWidthRequest = 20,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = {
normal,
disabled,
transparent,
rotate,
embedded,
new StackLayout {
HeightRequest = 30,
Orientation = StackOrientation.Horizontal,
Children = {
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"}
}
}
}
},
new StackLayout {
WidthRequest = 30,
Children = {
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"},
new Image {Source = "cover1.jpg"}
}
}
}
};
}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:59,代码来源:ImageGallery.cs
示例16: UnevenListGallery
public UnevenListGallery ()
{
Padding = new Thickness (0, 20, 0, 0);
var list = new ListView {
HasUnevenRows = true
};
bool next = true;
list.ItemTemplate = new DataTemplate (() => {
bool tall = next;
next = !next;
var cell = new TextCell {
Height = (tall) ? 88 : 44
};
cell.SetBinding (TextCell.TextProperty, ".");
return cell;
});
list.ItemsSource = new[] { "Tall", "Short", "Tall", "Short" };
var listViewCellDynamicHeight = new ListView {
HasUnevenRows = true,
AutomationId= "unevenCellListGalleryDynamic"
};
listViewCellDynamicHeight.ItemsSource = new [] {
@"That Flesh is heir to? 'Tis a consummation
Devoutly to be wished. To die, to sleep,
To sleep, perchance to Dream; Aye, there's the rub,
For in that sleep of death, what dreams may come,That Flesh is heir to? 'Tis a consummation
Devoutly to be wished. To die, to sleep,
To sleep, perchance to Dream; Aye, there's the rub,
For in that sleep of death, what dreams may come",
};
listViewCellDynamicHeight.ItemTemplate = new DataTemplate (typeof(UnevenRowsCell));
listViewCellDynamicHeight.ItemTapped += (sender, e) => {
if (e == null)
return; // has been set to null, do not 'process' tapped event
((ListView)sender).SelectedItem = null; // de-select the row
};
var grd = new Grid ();
grd.RowDefinitions.Add (new RowDefinition ());
grd.RowDefinitions.Add (new RowDefinition ());
grd.Children.Add (listViewCellDynamicHeight);
grd.Children.Add (list);
Grid.SetRow (list, 1);
Content = grd;
}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:58,代码来源:UnevenListGallery.cs
示例17: Desktop
/// <summary>
/// インスタンスを生成します。
/// </summary>
/// <param name="screen">Screen。</param>
internal Desktop(Screen screen)
: base(screen)
{
var viewportBounds = screen.GraphicsDevice.Viewport.TitleSafeArea;
BackgroundColor = Color.CornflowerBlue;
Margin = new Thickness(viewportBounds.Left, viewportBounds.Top, 0, 0);
Width = viewportBounds.Width;
Height = viewportBounds.Height;
}
开发者ID:willcraftia,项目名称:Blocks,代码行数:13,代码来源:Desktop.cs
示例18: DipsToPixels
/// <summary>
/// Converts a <see cref="Thickness"/> value with dimensions in display independent pixels to a <see cref="Thickness"/>
/// value with dimensions in display pixels.
/// </summary>
/// <param name="this">The <see cref="IUltravioletDisplay"/> with which to perform the conversion.</param>
/// <param name="dips">The <see cref="Thickness"/> in display independent pixels to convert.</param>
/// <returns>The converted <see cref="Thickness"/> in display pixels.</returns>
public static Thickness DipsToPixels(this IUltravioletDisplay @this, Thickness dips)
{
Contract.Require(@this, "this");
var left = @this.DipsToPixels(dips.Left);
var top = @this.DipsToPixels(dips.Top);
var right = @this.DipsToPixels(dips.Right);
var bottom = @this.DipsToPixels(dips.Bottom);
return new Thickness(left, top, right, bottom);
}
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:18,代码来源:IUltravioletDisplayExtensions.cs
示例19: TextBlock
public TextBlock()
: base()
{
Border = new Border() {WidthAll = 0, Color = new Color(0,0,0)};
FontName = "Helvetica";
FontColor = new Color(0,0,0);
FontSize = 12;
FieldName = String.Empty;
Padding = new Thickness(1,1,1,1);
CanGrow = true;
}
开发者ID:modesto,项目名称:monoreports,代码行数:11,代码来源:TextBlock.cs
示例20: TextBlock
public TextBlock()
: base()
{
Border = new Border( 0, new Color(0,0,0));
FontName = "Tahoma";
FontColor = new Color(0,0,0);
FontSize = 11;
FieldName = String.Empty;
Padding = new Thickness(2,2,0,0);
CanGrow = true;
Size = new Size(20.mm(),11.pt() + 4);
}
开发者ID:elsupergomez,项目名称:monoreports,代码行数:12,代码来源:TextBlock.cs
注:本文中的Thickness类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论