本文整理汇总了C#中System.Windows.Media.Brush.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# Brush.Freeze方法的具体用法?C# Brush.Freeze怎么用?C# Brush.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Brush
的用法示例。
在下文中一共展示了Brush.Freeze方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetBrush
public void SetBrush(Brush brush)
{
_hightlightBrush = brush;
_hightlightBrush.Freeze();
_textView.InvalidateLayer(Layer);
}
示例2: PostInfoDisplay
public PostInfoDisplay(double textRightEdge,
double viewRightEdge,
Geometry newTextGeometry,
string body)
{
if (brush == null)
{
brush = new SolidColorBrush(Color.FromArgb(0x20, 0x48, 0x3d, 0x8b));
brush.Freeze();
Brush penBrush = new SolidColorBrush(Colors.DarkSlateBlue);
penBrush.Freeze();
solidPen = new Pen(penBrush, 0.5);
solidPen.Freeze();
dashPen = new Pen(penBrush, 0.5);
dashPen.DashStyle = DashStyles.Dash;
dashPen.Freeze();
}
this.textGeometry = newTextGeometry;
TextBlock tb = new TextBlock();
tb.Text = "Blog Entry: " + body;
const int MarginWidth = 8;
this.postGrid = new Grid();
this.postGrid.RowDefinitions.Add(new RowDefinition());
this.postGrid.RowDefinitions.Add(new RowDefinition());
ColumnDefinition cEdge = new ColumnDefinition();
cEdge.Width = new GridLength(MarginWidth);
ColumnDefinition cEdge2 = new ColumnDefinition();
cEdge2.Width = new GridLength(MarginWidth);
this.postGrid.ColumnDefinitions.Add(cEdge);
this.postGrid.ColumnDefinitions.Add(new ColumnDefinition());
this.postGrid.ColumnDefinitions.Add(cEdge2);
System.Windows.Shapes.Rectangle rect = new System.Windows.Shapes.Rectangle();
rect.RadiusX = 6;
rect.RadiusY = 3;
rect.Fill = brush;
rect.Stroke = Brushes.DarkSlateBlue;
Size inf = new Size(double.PositiveInfinity, double.PositiveInfinity);
tb.Measure(inf);
this.postGrid.Width = tb.DesiredSize.Width + 2 * MarginWidth;
Grid.SetColumn(rect, 0);
Grid.SetRow(rect, 0);
Grid.SetRowSpan(rect, 1);
Grid.SetColumnSpan(rect, 3);
Grid.SetRow(tb, 0);
Grid.SetColumn(tb, 1);
this.postGrid.Children.Add(rect);
this.postGrid.Children.Add(tb);
Canvas.SetLeft(this.postGrid, Math.Max(viewRightEdge - this.postGrid.Width - 20.0, textRightEdge + 20.0));
Canvas.SetTop(this.postGrid, textGeometry.GetRenderBounds(solidPen).Top);
this.Children.Add(this.postGrid);
}
示例3: NamedBrush
/// <summary>
/// Initializes a new instance of the <see cref="NamedBrush"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="brush">The brush.</param>
public NamedBrush(string name, Brush brush)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");
Name = name;
Brush = brush;
Brush.Freeze();
}
示例4: UpdateColors
public void UpdateColors(Color background, Color foreground)
{
_borderPen = new Pen(new SolidColorBrush(foreground), 1);
_borderPen.Freeze();
_backgroundBrush = new SolidColorBrush(background);
_backgroundBrush.Freeze();
}
示例5: SelectAdorner
static SelectAdorner()
{
Color color = Color.FromRgb(0x53, 0x9C, 0xD8);
BorderBrush = new SolidColorBrush(color);
BorderBrush.Freeze();
color.A = 100;
FillBrush = new SolidColorBrush(color);
FillBrush.Freeze();
}
示例6: FreezeBrush
public static Brush FreezeBrush(Brush brush)
{
RenderOptions.SetBitmapScalingMode(brush, BitmapScalingMode.LowQuality);
RenderOptions.SetCacheInvalidationThresholdMinimum(brush, 0.5);
RenderOptions.SetCacheInvalidationThresholdMaximum(brush, 2.0);
RenderOptions.SetCachingHint(brush, CachingHint.Cache);
brush.Freeze();
return brush;
}
示例7: BlockToCellConverter
public BlockToCellConverter(Brush dayOffForeground, Brush newTermForeground, Brush foreground)
{
dayOffForeground.Freeze();
newTermForeground.Freeze();
foreground.Freeze();
_foreground = foreground;
_dayOffFroeground = dayOffForeground;
_newTermForeground = newTermForeground;
}
示例8: LogViewer
public LogViewer()
{
InitializeComponent();
m_foregroundBrushTime = new SolidColorBrush(Colors.LightGray);
m_foregroundBrushTime.Freeze();
m_foregroundBrushHighlight = new SolidColorBrush(Colors.Firebrick);
m_foregroundBrushHighlight.Freeze();
}
示例9: ToxUserStatusToBrushConverter
public ToxUserStatusToBrushConverter()
{
ToxUserStatusNONE = new SolidColorBrush(Color.FromRgb(6, 225, 1));
ToxUserStatusNONE.Freeze();
ToxUserStatusBUSY = new SolidColorBrush(Color.FromRgb(214, 43, 79));
ToxUserStatusBUSY.Freeze();
ToxUserStatusAWAY = new SolidColorBrush(Color.FromRgb(229, 222, 31));
ToxUserStatusAWAY.Freeze();
ToxUserStatusINVALID = new SolidColorBrush(Colors.Red);
ToxUserStatusINVALID.Freeze();
}
示例10: WPFCanvasAdapter
public WPFCanvasAdapter()
{
_pen = new Pen()
{
Brush = new SolidColorBrush(Colors.Black),
Thickness = 1,
StartLineCap = PenLineCap.Round,
EndLineCap = PenLineCap.Round,
};
_pen.Freeze();
_brush = new SolidColorBrush(Colors.Transparent);
_brush.Freeze();
}
示例11: FormatMapWatcher
static FormatMapWatcher()
{
Color highlight = SystemColors.HighlightColor;
Color darkColor = Color.FromArgb(96, highlight.R, highlight.G, highlight.B);
Color lightColor = Color.FromArgb(48, highlight.R, highlight.G, highlight.B);
gradientBrush = new LinearGradientBrush(new GradientStopCollection() { new GradientStop(darkColor, 0.0),
new GradientStop(lightColor, 0.5),
new GradientStop(darkColor, 1.0) },
90.0);
gradientBorder = new Pen(SystemColors.HighlightBrush, 1) { LineJoin = PenLineJoin.Round };
gradientBrush.Freeze();
gradientBorder.Freeze();
}
示例12: Brand
/// <summary>Noformējums ar īpašām fona otām.</summary>
/// <remarks>
/// Lai lietotu vienu bildi visai kopējai ekrāna daļai,
/// to jāpadod kā <paramref name="logoBackground"/>, bet <paramref name="guideBackground"/> jābūt <c>null</c>.
/// </remarks>
public Brand(Color textColor, Color statusColor, Color captionTextColor, Color windowBorderColor,
Brush captionBackground, Brush logoBackground, Brush guideBackground=null) {
if (textColor == null || statusColor == null || captionBackground == null) throw new ArgumentNullException("Kāda krāsa nav norādīta");
if (captionBackground == null || logoBackground == null) throw new ArgumentNullException("Kāda ota nav norādīta");
if (guideBackground == null) HasSharedBackground=true;
else {
guideBackground.Freeze(); HasSharedBackground=false;
}
textForeground=new SolidColorBrush(textColor); statusForeground=new SolidColorBrush(statusColor);
captionForeground=new SolidColorBrush(captionTextColor); windowBorder=new SolidColorBrush(windowBorderColor);
this.captionBackground=captionBackground; this.logoBackground=logoBackground; this.guideBackground=guideBackground;
// Iesaldē otas labākai veiktspējai. To animācija pēc šī soļa nav iespējama.
textForeground.Freeze(); statusForeground.Freeze(); captionForeground.Freeze();
windowBorder.Freeze(); captionBackground.Freeze(); logoBackground.Freeze();
}
示例13: EquationBase
public EquationBase(EquationContainer parent)
{
this.ParentEquation = parent;
if (parent != null)
{
SubLevel = parent.SubLevel;
fontSize = parent.fontSize;
ApplySymbolGap = parent.ApplySymbolGap;
r = (byte)(parent.r + 15);
g = (byte)(parent.r + 15);
b = (byte)(parent.r + 15);
}
debugBrush = new SolidColorBrush(Color.FromArgb(100, r, g, b));
debugBrush.Freeze();
boxPen.Freeze();
}
示例14: DWindow
public DWindow()
{
InitializeComponent();
Color color = Color.FromRgb(0x00, 0x00, 0x00);
_turnBrush = new SolidColorBrush(color);
_turnBrush.Freeze();
DebugWindowCommand.InputGestures.Add(new KeyGesture(Key.D, ModifierKeys.Control));
var cb = new CommandBinding(DebugWindowCommand,
MyCommandExecute, MyCommandCanExecute);
CommandBindings.Add(cb);
var kg = new KeyGesture(Key.M, ModifierKeys.Control);
var ib = new InputBinding(DebugWindowCommand, kg);
InputBindings.Add(ib);
}
示例15: CellFactory
static CellFactory()
{
_padding = new Thickness(4, 0, 4, 0);
_bdrError = new Thickness(4);
_bdrFixed = new Thickness(0, 0, 1, 1);
_bdrV = new Thickness(0, 0, 1, 0);
_bdrH = new Thickness(0, 0, 0, 1);
_bdrA = new Thickness(0, 0, 1, 1);
_bdrN = Util.Util.ThicknessEmpty;
// _brBlack = Brushes.Black;
_brWhite = Brushes.White;
_brError = new SolidColorBrush(Color.FromArgb(255, 220, 0, 12));
_brError.Freeze();
_brBlue = new SolidColorBrush(Color.FromArgb(255, 100, 150, 200));
_brBlue.Freeze();
// _brOpaque = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0));
// _brOpaque.Freeze();
_brTransparent = Brushes.Transparent;
_imgError = null;
_csSelected = new CellStyle();
}