本文整理汇总了C#中System.Windows.CornerRadius类的典型用法代码示例。如果您正苦于以下问题:C# CornerRadius类的具体用法?C# CornerRadius怎么用?C# CornerRadius使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CornerRadius类属于System.Windows命名空间,在下文中一共展示了CornerRadius类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Comment
public Comment(Node hostNode)
{
HostNode = hostNode;
var scrollViewer = new ScrollViewer
{
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
Height = 70,
CanContentScroll = true
};
var textBlock = new TextBlock
{
Background = Brushes.Transparent,
TextWrapping = TextWrapping.Wrap,
Margin = new Thickness(5),
FontSize = 12
};
Child = scrollViewer;
CornerRadius = new CornerRadius(5);
scrollViewer.Content = textBlock;
var bindingTextToTextBlock = new Binding("Text")
{
Source = this,
Mode = BindingMode.OneWay
};
textBlock.SetBinding(TextBlock.TextProperty, bindingTextToTextBlock);
hostNode.SpaceCanvas.Children.Add(this);
}
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:34,代码来源:Comment.cs
示例2: Convert
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2)
throw new ArgumentException(string.Format("not enough arguments, expected 2, but {0} present", values.Length));
Align align;
Enum.TryParse(values[0].ToString(), out align);
double val = 0.0;
double.TryParse(values[1].ToString(), out val);
CornerRadius radius = new CornerRadius();
if ((align & Align.TopRight) == Align.TopRight)
{
radius.TopRight = val;
}
if ((align & Align.TopLeft) == Align.TopLeft)
{
radius.TopLeft = val;
}
if ((align & Align.BottomRight) == Align.BottomRight)
{
radius.BottomRight = val;
}
if ((align & Align.BottomLeft) == Align.BottomLeft)
{
radius.BottomLeft = val;
}
return radius;
}
开发者ID:kobyb1988,项目名称:PhotoBox,代码行数:33,代码来源:AlignToCornerRadiusConverter.cs
示例3: AlmostEquals
/// <summary>Checks whether two nullable corner radii are close enough to be considered equal.</summary>
/// <summary>Use this method instead of strict equality check to reduce the chance for floating-point errors.</summary>
public static bool AlmostEquals(this CornerRadius? c1, CornerRadius? c2) {
if (c1.HasValue && c2.HasValue) {
return c1.Value.AlmostEquals(c2.Value);
} else {
return !c1.HasValue && !c2.HasValue;
}
}
开发者ID:borkaborka,项目名称:gmit,代码行数:9,代码来源:ClrExtensions.Wpf.cs
示例4: CheckProperties
static void CheckProperties (CornerRadius cr, double value)
{
Assert.AreEqual (value, cr.TopLeft, "TopLeft");
Assert.AreEqual (value, cr.TopRight, "TopRight");
Assert.AreEqual (value, cr.BottomRight, "BottomRight");
Assert.AreEqual (value, cr.BottomLeft, "BottomLeft");
}
开发者ID:dfr0,项目名称:moon,代码行数:7,代码来源:CornerRadiusTest.cs
示例5: WidgetActionBarStyle
public WidgetActionBarStyle()
{
BackgroundOpacity = 0.5;
CornerRadius = new CornerRadius(4);
BackgroundColor = Color.FromRgb(32, 32, 32);
TextColor = Colors.WhiteSmoke;
HorizontalAlignment = HorizontalAlignment.Center;
VerticalAlignment = VerticalAlignment.Top;
}
开发者ID:danielchalmers,项目名称:DesktopWidgets,代码行数:9,代码来源:WidgetActionBarStyle.cs
示例6: Border
public void Border(CornerRadius CornerRadius, Color culoare, Thickness thickness, double Width, double Height)
{
myBorder.Width = Width;
myBorder.Height = Height;
myBorder.BorderThickness = thickness;
myBorder.BorderBrush = new SolidColorBrush(culoare);
myBorder.CornerRadius = CornerRadius;
}
开发者ID:tigerss,项目名称:Grow-Romania,代码行数:9,代码来源:ADDPozaCuBorder.cs
示例7: OnCornerRadiusChanged
protected virtual void OnCornerRadiusChanged(CornerRadius oldValue, CornerRadius newValue)
{
//we always want the InnerBorderRadius to be one less than the CornerRadius
CornerRadius newInnerCornerRadius = new CornerRadius(Math.Max(0, newValue.TopLeft - 1),
Math.Max(0, newValue.TopRight - 1),
Math.Max(0, newValue.BottomRight - 1),
Math.Max(0, newValue.BottomLeft - 1));
InnerCornerRadius = newInnerCornerRadius;
}
开发者ID:zzilla,项目名称:ONVIF-Device-Manager,代码行数:10,代码来源:ButtonChrome.cs
示例8: ConfigureFromNode
public override void ConfigureFromNode(System.Xml.Linq.XElement node)
{
base.ConfigureFromNode(node);
Banner = XmlUtilities.GetTextFromAttribute(node, "banner");
BorderSize = XmlUtilities.ConvertFromAttributeUsingConverter(
node, "borderSize", new ThicknessConverter(), new Thickness(0));
BorderColor = XmlUtilities.GetTextFromAttribute(node, "borderColor");
CornerRadius = XmlUtilities.ConvertFromAttributeUsingConverter(
node, "cornerRadius", new CornerRadiusConverter(), new CornerRadius(0));
}
开发者ID:jardrake03,项目名称:incert,代码行数:10,代码来源:ContentBlockParagraph.cs
示例9: DrawRectangle
/// <summary>See <c>WpfExtensions</c> for details.</summary>
public static void DrawRectangle(DrawingContext dc, Rect rect, Paint paint, CornerRadius corners, CornerStyle cornerStyle, BorderSide borderSide, bool snapToPixel) {
// get brush and stroke resources
if (paint == null) return;
var fill = paint.Fill;
var strokes = paint.GetStrokePens().ToArray();
var hasFill = (fill != null);
var hasStroke = (strokes.Length > 0 && borderSide != BorderSide.None);
if (!hasFill && !hasStroke) return;
// compute the drawing rectangle with offset for pixel snapping
// (assumptions: the box itself is pixel snapped, all strokes have same thickness, and the thickness is a whole number)
var halfThickness = Math.Round(hasStroke ? strokes[0].Thickness : 0.0) / 2;
if (snapToPixel && hasStroke) {
rect = new Rect(rect.X + halfThickness, rect.Y + halfThickness, (rect.Width - 2 * halfThickness).Max(0), (rect.Height - 2 * halfThickness).Max(0));
}
// select drawing function based on the corners complexity
DrawingFunction fillFunc = null;
if (corners.IsZero()) {
fillFunc = _drawSimpleRectangle;
} else if (corners.IsUniform()) {
fillFunc = _drawRoundedRectangle;
} else {
fillFunc = _drawComplexRectangle;
}
// draw the border
if (hasStroke) {
if (paint.IsA<QuadPaint>()) {
rect = _drawSide(dc, rect, null, strokes[0], corners, cornerStyle, BorderSide.Left);
rect = _drawSide(dc, rect, null, strokes[1], corners, cornerStyle, BorderSide.Top);
rect = _drawSide(dc, rect, null, strokes[2], corners, cornerStyle, BorderSide.Right);
rect = _drawSide(dc, rect, null, strokes[3], corners, cornerStyle, BorderSide.Bottom);
corners = _inflateCorners(corners, strokes[3]);
} else {
var strokeFunc = (borderSide == BorderSide.All ? fillFunc : _drawSide);
foreach (var stroke in strokes) {
rect = strokeFunc(dc, rect, null, stroke, corners, cornerStyle, borderSide);
corners = _inflateCorners(corners, stroke);
}
}
}
// draw the background
if (hasFill) {
if (snapToPixel) {
rect = _deflateRect(rect, -halfThickness);
}
if (paint.FillMode == BrushMappingMode.Absolute) {
fill = _mapAbsoluteFill(fill, rect);
}
fillFunc(dc, rect, fill, null, corners, cornerStyle, borderSide);
}
}
开发者ID:borkaborka,项目名称:gmit,代码行数:56,代码来源:DrawingUtilities.cs
示例10: ShouldShareCornerRadiusValueWithBorder
public void ShouldShareCornerRadiusValueWithBorder()
{
var radius1 = new CornerRadius(1, 2, 3, 4);
model.CornerRadius = radius1;
model.Border.CornerRadius.ShouldBe(radius1);
var radius2 = new CornerRadius(9,8,7,6);
model.Border.CornerRadius = radius2;
model.CornerRadius.ShouldBe(radius2);
}
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:11,代码来源:BackgroundModelTest.cs
示例11: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double d = parameter != null ? double.Parse(parameter.ToString()) : -1;
CornerRadius r = (CornerRadius)value;
CornerRadius result = new CornerRadius(
Math.Max(0, r.TopLeft + d),
Math.Max(0, r.TopRight + d),
Math.Max(0, r.BottomRight + d),
Math.Max(0, r.BottomLeft + d));
return result;
}
开发者ID:Kayomani,项目名称:FAP,代码行数:12,代码来源:RoundedCornerResizeConverter.cs
示例12: HtmlBorderRenderElement
public HtmlBorderRenderElement(IRenderQueue renderQueue, IHtmlValueConverter converter)
: base(renderQueue)
{
this.converter = converter;
bounds = Rect.Zero;
borderThickness = Thickness.Zero;
cornerRadius = CornerRadius.Zero;
Style.SetValue("background-clip", "content-box");
Style.SetBackground(Background, converter);
Style.SetBorderThickness(BorderThickness, converter);
Style.SetBounds(new Rect(Bounds.Location, (Bounds.Size - BorderThickness.Size).Max(Size.Zero)), converter);
Style.SetBorderBrush(BorderBrush, converter);
Style.SetCornerRadius(cornerRadius, converter);
Style.SetIsHitTestVisible(IsHitTestVisible && Background != null);
}
开发者ID:highzion,项目名称:Granular,代码行数:17,代码来源:HtmlBorderRenderElement.cs
示例13: CtorFourDoubles
public void CtorFourDoubles ()
{
CornerRadius cr = new CornerRadius (4, 3, 2, 1);
Assert.AreEqual ("4,3,2,1", cr.ToString (), "ToString");
CornerRadius cr2 = new CornerRadius (4, 3, 2, 1);
Assert.IsTrue (cr == cr2, "== true");
Assert.IsFalse (cr != cr2, "== false");
cr.TopLeft = 0;
cr.TopRight = 0;
cr.BottomRight = 0;
cr.BottomLeft = 0;
CheckProperties (cr, 0);
Assert.IsFalse (cr == cr2, "== false");
Assert.IsTrue (cr != cr2, "== true");
}
开发者ID:dfr0,项目名称:moon,代码行数:18,代码来源:CornerRadiusTest.cs
示例14: FlexButton
public FlexButton()
{
HighlightMargin = new Thickness(0);
HighlightBrightness = 100;
GlowColor = Brushes.WhiteSmoke;
OuterBorderBrush = Brushes.Gray;
InnerBorderBrush = new LinearGradientBrush(Colors.White, Colors.LightGray, 90);
InnerBorderThickness = new Thickness(1);
CornerRadius = new CornerRadius(3);
UpdateButtonColor(this, Brushes.Gainsboro);
Foreground = Brushes.Black;
IsEnabledChanged += FlexButtonIsEnabledChanged;
}
开发者ID:yemreguney,项目名称:SambaPOS-3,代码行数:18,代码来源:FlexButton.cs
示例15: AddCornerRadius
public void AddCornerRadius(CornerRadius th, string prefix, string suffix = null)
{
// if (th.IsZero()) return;
if (th.TopLeft == th.TopRight && th.TopRight== th.BottomLeft && th.BottomLeft == th.BottomRight)
{
if (0 != th.TopLeft)
{
AddComposed(th.TopLeft + "px", prefix, suffix);
}
}
else
{
// TODO:
/*AddComposed(th.Left + "px", prefix, "left", suffix);
AddComposed(th.Top + "px", prefix, "top", suffix);
AddComposed(th.Right + "px", prefix, "right", suffix);
AddComposed(th.Bottom + "px", prefix, "bottom", suffix);*/
}
}
开发者ID:thomas13335,项目名称:wpf2html5,代码行数:20,代码来源:StyleBuilder.cs
示例16: CtorDouble
public void CtorDouble ()
{
CornerRadius cr = new CornerRadius (0);
CheckProperties (cr, 0);
cr.TopLeft = 1;
cr.TopRight = 2;
cr.BottomRight = 3;
cr.BottomLeft = 4;
Assert.AreEqual ("1,2,3,4", cr.ToString (), "ToString");
CornerRadius cr2 = new CornerRadius (0);
Assert.IsFalse (cr.Equals (cr2), "!Equals");
Assert.IsFalse (cr2.Equals (cr), "!Equals2");
Assert.IsFalse (cr.Equals (null), "Equals(null)");
Assert.IsTrue (cr.Equals (cr), "Equals(self)");
Assert.Throws<ArgumentException> (delegate {
new CornerRadius (-0.1);
}, "Negative");
}
开发者ID:dfr0,项目名称:moon,代码行数:21,代码来源:CornerRadiusTest.cs
示例17: Comment
public Comment(Node hostNode)
{
HostNode = hostNode;
var scrollViewer = new ScrollViewer
{
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
Height = 70,
CanContentScroll = true,
Background = Brushes.Transparent
};
var textBlock = new TextBlock
{
Background = Brushes.Transparent,
TextWrapping = TextWrapping.Wrap,
Margin = new Thickness(5),
FontSize = 12
};
scrollViewer.Content = textBlock;
CornerRadius= new CornerRadius(5);
Child = scrollViewer;
BorderThickness = new Thickness(2);
Background = Application.Current.Resources["BrushBlue"] as Brush;
var bindingTextToTextBlock = new Binding("Text")
{
Source = this,
Mode = BindingMode.OneWay
};
textBlock.SetBinding(TextBlock.TextProperty, bindingTextToTextBlock);
HostNode.HostCanvas.Children.Add(this);
HostNode_PropertyChanged(null, null);
HostNode.PropertyChanged+= HostNode_PropertyChanged;
}
开发者ID:Dessix,项目名称:TUM.CMS.VPLControl,代码行数:40,代码来源:Comment.cs
示例18: CreateCombinedRectangle
// Creates a border containing a textbox
public static Border CreateCombinedRectangle(TextBlock text, double x, double y, double width, double height, SolidColorBrush color, double opacity, double haloOpacity, SolidColorBrush borderColor, CornerRadius radius, Border cachedBorder, string tooltip = "")
{
// Attempt to use a cached Border before creating a new one
Border border;
if (cachedBorder == null) border = new Border();
else border = cachedBorder;
border.Background = color;
border.BorderThickness = Cached.StandardBorderThickness;
border.BorderBrush = borderColor;
border.Width = width;
border.Height = height;
//border.Opacity = opacity;
border.CornerRadius = radius;
border.VerticalAlignment = VerticalAlignment.Center;
border.HorizontalAlignment = HorizontalAlignment.Center;
if (tooltip != "") border.ToolTip = tooltip;
float left = (float)(x - (border.Width / 2));
float top = (float)(y - (border.Height / 2));
border.Margin = new Thickness(left, top, 0, 0);
Canvas.SetZIndex(border, 5);
return border;
}
开发者ID:lboshuizen,项目名称:Insilico,代码行数:23,代码来源:Primitives.cs
示例19: _AddCornerRadius
private CornerRadius _AddCornerRadius(CornerRadius first, CornerRadius second)
{
return new CornerRadius(
first.TopLeft + second.TopLeft,
first.TopRight + second.TopRight,
first.BottomRight + second.BottomRight,
first.BottomLeft + second.BottomLeft);
}
开发者ID:grandtiger,项目名称:wpf-shell,代码行数:8,代码来源:CornerRadiusAnimation.cs
示例20: SetCornerRadius
public static void SetCornerRadius(UIElement element, CornerRadius value)
{
ControlsHelper.SetCornerRadius(element, value);
}
开发者ID:gencer,项目名称:MahApps.Metro,代码行数:4,代码来源:ButtonHelper.cs
注:本文中的System.Windows.CornerRadius类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论