本文整理汇总了C#中System.Windows.Thickness类的典型用法代码示例。如果您正苦于以下问题:C# Thickness类的具体用法?C# Thickness怎么用?C# Thickness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Thickness类属于System.Windows命名空间,在下文中一共展示了Thickness类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
String Param = parameter as String;
Double Value = (Double)value;
Thickness Margin = new Thickness(0);
if (Param != null)
{
if (Param.Equals(String.Empty))
{
Margin = new Thickness(Value);
}
else
{
String[] sSides = Param.Replace("x", Value.ToString()).Split(',');
Double[] dSides= new Double[sSides.Length];
for (int i = 0; i < sSides.Length; ++i)
dSides[i] = Parse.TryParse<Double>(sSides[i], 0);
switch (sSides.Length)
{
default: break;
case 2:
Margin = new Thickness(dSides[0], dSides[1], dSides[0], dSides[1]);
break;
case 4:
Margin = new Thickness(dSides[0], dSides[1], dSides[2], dSides[3]);
break;
}
}
}
return Margin;
}
开发者ID:Chesire,项目名称:myManga,代码行数:34,代码来源:MarginConverter.cs
示例2: Convert
/// <summary>
/// Convert from A to B.
/// </summary>
/// <param name="pValue">The value to convert.</param>
/// <param name="pTargetType">The target type.</param>
/// <param name="pExtraParameter">The extra parameter to use (not used by the converter).</param>
/// <param name="pCulture">The culture to use (not used by the converter).</param>
/// <returns>The value converted.</returns>
public object Convert(object[] pValue, Type pTargetType, object pExtraParameter, CultureInfo pCulture)
{
if (pValue.Any(lValue => lValue == DependencyProperty.UnsetValue))
{
return Binding.DoNothing;
}
// First value is the port list count, second is the list.
int lPortsCount = System.Convert.ToInt32(pValue[0]);
PortViewModelCollection lPorts = pValue[1] as PortViewModelCollection;
// Evaluating the padding using the ports.
Thickness lPadding = new Thickness();
if (lPorts != null)
{
if (lPorts.Any(lPort => lPort.Direction == PortDirection.Input))
{
lPadding.Left = PORT_WIDTH;
}
if (lPorts.Any(lPort => lPort.Direction == PortDirection.Output))
{
lPadding.Right = PORT_WIDTH;
}
}
return lPadding;
}
开发者ID:mastertnt,项目名称:XGraph,代码行数:36,代码来源:NodeViewPortsCountToBoundingPaddingConverter.cs
示例3: AddGeometries
public static void AddGeometries(WpfHexView hexView, Collection<VSTF.TextBounds> textBounds, bool isLineGeometry, bool clipToViewport, Thickness padding, double minWidth, ref PathGeometry geo, ref bool createOutlinedPath) {
foreach (var bounds in textBounds) {
double left = bounds.Left - padding.Left;
double right = bounds.Right + padding.Right;
double top, bottom;
if (isLineGeometry) {
top = bounds.Top - padding.Top;
bottom = bounds.Bottom + padding.Bottom;
}
else {
top = bounds.TextTop - padding.Top;
bottom = bounds.TextBottom + padding.Bottom;
}
if (right - left < minWidth)
right = left + minWidth;
if (clipToViewport) {
left = Math.Max(left, hexView.ViewportLeft);
right = Math.Min(right, hexView.ViewportRight);
}
if (right <= left || bottom <= top)
continue;
const double MAX_HEIGHT = 1000000;
const double MAX_WIDTH = 1000000;
double width = Math.Min(right - left, MAX_WIDTH);
double height = Math.Min(bottom - top, MAX_HEIGHT);
if (geo == null)
geo = new PathGeometry { FillRule = FillRule.Nonzero };
else
createOutlinedPath = true;
geo.AddGeometry(new RectangleGeometry(new Rect(left, top, width, height)));
}
}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:33,代码来源:HexMarkerHelper.cs
示例4: PrintDocument
public PrintDocument(Thickness margin)
{
PageLayout = new PrintLayout
{
Margin = margin,
};
}
开发者ID:schakko,项目名称:bootstrap-net,代码行数:7,代码来源:PrintDocument.cs
示例5: FileListItem
public FileListItem(string captionText, string imagePath)
: base()
{
Margin = new Thickness(13);
var panel = new StackPanel();
var imageSource = new BitmapImage();
var image = new Image();
var caption = new TextBlock();
imageSource.BeginInit();
imageSource.UriSource = new Uri(imagePath, UriKind.Relative);
imageSource.EndInit();
image.VerticalAlignment = System.Windows.VerticalAlignment.Center;
image.Source = imageSource;
image.Height = 64;
image.Width = 64;
image.ToolTip = "Select & click on 'Table' for data view.";
caption.TextAlignment = TextAlignment.Center;
caption.TextWrapping = TextWrapping.Wrap;
caption.Text = captionText;
Caption = captionText;
if (caption.Text.Length <= 18)
caption.Text += "\n ";
panel.Children.Add(image);
panel.Children.Add(caption);
Child = panel;
}
开发者ID:aceindy,项目名称:ArctiumTools,代码行数:34,代码来源:FileListItem.cs
示例6: UpdateUpBorder
protected virtual void UpdateUpBorder()
{
if (ShowUpBorder)
BorderThickness = new Thickness(BorderThickness.Left, 1, BorderThickness.Right, BorderThickness.Bottom);
else
BorderThickness = new Thickness(BorderThickness.Left, 0, BorderThickness.Right, BorderThickness.Bottom);
}
开发者ID:SmallMobile,项目名称:ranet-uilibrary-olap.latest-unstabilized,代码行数:7,代码来源:PivotGridItem.cs
示例7: ExtendGlassFrame
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if (!Native.DwmIsCompositionEnabled())
return false;
try
{
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("The Window must be shown before extending glass.");
// Set the background to transparent from both the WPF and Win32 perspectives
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
Native.MARGINS margins = new Native.MARGINS(margin);
Native.DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
catch (Exception ex)
{
LogWriter.Log(ex, "Error • Glass");
}
return false;
}
开发者ID:gayancc,项目名称:screentogif,代码行数:28,代码来源:Glass.cs
示例8: MARGINS
public MARGINS(Thickness thickness)
{
Left = (int)thickness.Left;
Right = (int)thickness.Right;
Top = (int)thickness.Top;
Bottom = (int)thickness.Bottom;
}
开发者ID:SilentPenguin,项目名称:Skyscraper,代码行数:7,代码来源:GlassHelper.cs
示例9: ExtendGlassFrame
/// <summary>
/// Extends the Aero Glass area on a given window.
/// </summary>
/// <param name="window">The window to extend glass onto.</param>
/// <param name="margin">The distances from the border to extend the glass by.</param>
/// <returns>True if glass was extended successfully, otherwise false.</returns>
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if (window == null) {
throw new ArgumentNullException("window");
}
bool result = false;
try {
if (DwmIsCompositionEnabled()) {
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("The Window must be shown before extending glass.");
// Set the background to transparent from both the WPF and Win32 perspectives
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
result = true;
}
} catch { }
return result;
}
开发者ID:PaulStovell,项目名称:trial-balance,代码行数:31,代码来源:GlassHelper.cs
示例10: Dock
public Dock(Canvas parent_canvas)
{
parentCanvas = parent_canvas;
emptyDockContents = new StackPanel();
emptyDockContents.Orientation = Orientation.Horizontal;
emptyDockContents.Margin = new Thickness(5, 5, 5, 5);
TextBox dropToAdd = new TextBox();
dropToAdd.Background = new SolidColorBrush(Colors.Transparent);
dropToAdd.BorderBrush = new SolidColorBrush(Colors.Transparent);
dropToAdd.Text = "Drop Here To Add";
dropToAdd.Foreground = new SolidColorBrush(Colors.White);
dropToAdd.FontSize = 18;
dropToAdd.VerticalAlignment = VerticalAlignment.Center;
emptyDockContents.Children.Add(dropToAdd);
Image iconImage = new Image();
//iconImage.Source = "";// guiConfig.getAddToDockImage();
iconImage.Width = 40;
iconImage.Height = 40;
iconImage.Margin = new Thickness(5,0,5,0);
//emptyDockContents.Children.Add(iconImage);
MinHeight = 80;
MaxHeight = 80;
Background = new SolidColorBrush(Color.FromArgb(200, 0, 0, 0));
BorderBrush = new SolidColorBrush(Colors.White);
BorderThickness = new Thickness(2, 2, 2, 0);
Child = emptyDockContents;
SizeChanged += Dock_SizeChanged;
}
开发者ID:MikeOrtman,项目名称:MultitouchExplorer,代码行数:32,代码来源:Dock.cs
示例11: AppearanceManager
public AppearanceManager(ISettingsManager manager)
{
_manager = manager;
DefaultMargin = new Thickness(0, 0, 0, 2);
DefaultPadding = new Thickness(0, 4, 0, 4);
}
开发者ID:jardrake03,项目名称:incert,代码行数:7,代码来源:AppearanceManager.cs
示例12: ExtendGlassFrame
/// <summary>
/// Extends the glass frame.
/// </summary>
/// <param name="window">The window.</param>
/// <param name="margin">The margin.</param>
/// <returns></returns>
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if(!DwmIsCompositionEnabled()) {
return false;
}
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if(hwnd == IntPtr.Zero) {
throw new InvalidOperationException("The Window must be shown before extending glass.");
}
// Set the background to transparent from both the WPF and Win32 perspectives
SolidColorBrush background = new SolidColorBrush(Colors.Red);
background.Opacity = 0.5;
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
开发者ID:vandango,项目名称:MovieMatic,代码行数:33,代码来源:GlassHelper.cs
示例13: ThicknessInterpolation
/// <summary>Creates a new <see cref="ThicknessInterpolation"/> instance with the specified parameters.</summary>
/// <param name="interpolator">The interpolation function.</param>
/// <param name="fromValue">The starting value of the animation, or <c>null</c>.</param>
/// <param name="toValue">The ending value of the animation, or <c>null</c>.</param>
/// <param name="isAdditive">Indicates whether the interpolation is additive.</param>
/// <param name="isCumulative">Indicates whether the interpolation is cumulative.</param>
public ThicknessInterpolation(Interpolator interpolator, Thickness? fromValue, Thickness? toValue, bool isAdditive, bool isCumulative) : this() {
Interpolator = interpolator;
if (fromValue.HasValue) base.From = fromValue.Value; else if (isAdditive) base.From = new Thickness();
if (toValue.HasValue) base.To = toValue.Value; else if (isAdditive) base.To = new Thickness();
base.IsAdditive = isAdditive;
base.IsCumulative = isCumulative;
}
开发者ID:borkaborka,项目名称:gmit,代码行数:13,代码来源:ThicknessInterpolation.cs
示例14: IsNonNegative
internal static bool IsNonNegative(Thickness value)
{
return DoubleUtil.IsNonNegative(value.Left) &&
DoubleUtil.IsNonNegative(value.Top) &&
DoubleUtil.IsNonNegative(value.Right) &&
DoubleUtil.IsNonNegative(value.Bottom);
}
开发者ID:oysteinkrog,项目名称:MonitorControl,代码行数:7,代码来源:ThicknessUtil.cs
示例15: Margins
public Margins(Thickness t)
{
Left = (int)t.Left;
Right = (int)t.Right;
Top = (int)t.Top;
Bottom = (int)t.Bottom;
}
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:7,代码来源:GlassHelper.cs
示例16: ExtendGlassFrame
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
// Get the Operating System From Environment Class
OperatingSystem os = Environment.OSVersion;
// Get the version information
Version vs = os.Version;
if (vs.Major < 6)
return false;
if (!DwmIsCompositionEnabled())
return false;
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("Glass cannot be extended before the window is shown.");
// Set the background to transparent from both the WPF and Win32 perspectives
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
开发者ID:brschwalm,项目名称:Vienna,代码行数:27,代码来源:GlassHelper.cs
示例17: Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var isReadOnly = (bool) value;
var black = new Thickness(1);
var red = new Thickness(4);
return isReadOnly ? black : red;
}
开发者ID:ananse23,项目名称:EsriWPF,代码行数:7,代码来源:GridBorderThicknessConverter.cs
示例18: MallWindow
public MallWindow(Brush bodyimg, Brush OKB, Brush OKBClicked, Datas datas)
{
InitializeComponent();
originalMargin = new Thickness(110, 145, 0, 0);
duringMargin = new Thickness(140, 145, 0, 0);
isSearching = false;
this.Title = "찾는 물건 시세가?";
this.bodyimg = bodyimg;
this.Background = bodyimg;
this.datas = datas;
this.searchbutton.Background = Brushes.Transparent;
this.searchbutton.Cursor = Cursors.Hand;
this.OKB = OKB;
this.OKBClicked = OKBClicked;
this.okbut.Background = this.OKB;
//처음엔 입력을 기다린다.
readyForInput();
updateItems();
}
开发者ID:HammerAndSickle,项目名称:namyongNdaddy,代码行数:25,代码来源:MallWindow.xaml.cs
示例19: OnCloseButtonMarginChanged
protected virtual void OnCloseButtonMarginChanged(Thickness oldValue, Thickness newValue)
{
if (newValue != null && closeButton != null)
{
closeButton.Margin = newValue;
}
}
开发者ID:ielcoro,项目名称:PaulozziCo.MetroShell,代码行数:7,代码来源:PopupWrapper.cs
示例20: GUIQuestion
public GUIQuestion(QLMemory memory, string identifier, string label, bool isComputed, ExpressionBase showCondition, ChangedEventHandler changeHandler)
{
_hideConditions = new List<ExpressionBase>();
_showCondition = showCondition;
_memory = memory;
_identifier = identifier;
_isComputed = isComputed;
_label = new Label
{
Content = label,
Width = 300,
Margin = new Thickness(0, 0, 25, 0),
HorizontalContentAlignment = HorizontalAlignment.Right
};
_input = _memory.GetDeclaredValue(_identifier).CreateInputControl(_identifier, _memory, _isComputed);
_input.OnChanged = changeHandler;
//ui properties
Width = 600;
Margin = new Thickness(0, 10, 0 , 0);
Orientation = Orientation.Horizontal;
}
开发者ID:software-engineering-amsterdam,项目名称:poly-ql,代码行数:25,代码来源:GUIQuestion.cs
注:本文中的System.Windows.Thickness类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论