本文整理汇总了C#中System.Windows.Media.Effects.DropShadowEffect.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# DropShadowEffect.Freeze方法的具体用法?C# DropShadowEffect.Freeze怎么用?C# DropShadowEffect.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Effects.DropShadowEffect
的用法示例。
在下文中一共展示了DropShadowEffect.Freeze方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Agent
//.........这里部分代码省略.........
}
}
if (config.AppSettings.Settings["Topmost"] != null)
{
if (config.AppSettings.Settings["Topmost"].Value.Length > 0)
{
this.Topmost = Boolean.Parse(config.AppSettings.Settings["Topmost"].Value);
}
}
if (config.AppSettings.Settings["ShowInTaskbar"] != null)
{
if (config.AppSettings.Settings["ShowInTaskbar"].Value.Length > 0)
{
this.ShowInTaskbar = Boolean.Parse(config.AppSettings.Settings["ShowInTaskbar"].Value);
}
}
if (config.AppSettings.Settings["DropShadow"] != null)
{
if (config.AppSettings.Settings["DropShadow"].Value.Length > 0)
{
if (Boolean.Parse(config.AppSettings.Settings["DropShadow"].Value))
{
DropShadowEffect dropShadowEffect = new DropShadowEffect();
dropShadowEffect.Color = Colors.Black;
dropShadowEffect.BlurRadius = 10;
dropShadowEffect.Direction = 270;
dropShadowEffect.ShadowDepth = 0;
dropShadowEffect.Opacity = 0.5;
if (dropShadowEffect.CanFreeze)
{
dropShadowEffect.Freeze();
}
this.Canvas.Effect = dropShadowEffect;
}
}
}
if (config.AppSettings.Settings["Mute"] != null)
{
if (config.AppSettings.Settings["Mute"].Value.Length > 0)
{
this.isMute = Boolean.Parse(config.AppSettings.Settings["Mute"].Value);
}
}
if (config.AppSettings.Settings["FrameRate"] != null)
{
if (config.AppSettings.Settings["FrameRate"].Value.Length > 0)
{
this.frameRate = Double.Parse(config.AppSettings.Settings["FrameRate"].Value, System.Globalization.CultureInfo.InvariantCulture);
}
}
}
else
{
Agent agent = Application.Current.MainWindow as Agent;
if (agent != null)
{
this.opacity = agent.opacity;
示例2: UpdateGuide
/// <summary>
/// Updates the line <paramref name="guide"/> with a new format.
/// </summary>
/// <param name="guide">The <see cref="Line"/> to update.</param>
/// <param name="formatIndex">The new format index.</param>
void UpdateGuide(LineSpan lineSpan, Line adornment)
{
if (lineSpan == null || adornment == null) return;
LineFormat format;
if (lineSpan.Type == LineSpanType.PageWidthMarker)
{
if (!Theme.PageWidthMarkers.TryGetValue(lineSpan.Indent, out format))
{
format = Theme.DefaultLineFormat;
}
}
else if (!Theme.LineFormats.TryGetValue(lineSpan.FormatIndex, out format))
{
format = Theme.DefaultLineFormat;
}
if (!format.Visible)
{
adornment.Visibility = Visibility.Hidden;
return;
}
bool highlight = lineSpan.Highlight || lineSpan.LinkedLines.Any(ls => ls.Highlight);
var lineStyle = highlight ? format.HighlightStyle : format.LineStyle;
var lineColor = (highlight && !lineStyle.HasFlag(LineStyle.Glow)) ?
format.HighlightColor : format.LineColor;
Brush brush;
if (!GuideBrushCache.TryGetValue(lineColor, out brush))
{
brush = new SolidColorBrush(lineColor.ToSWMC());
if (brush.CanFreeze) brush.Freeze();
GuideBrushCache[lineColor] = brush;
}
adornment.Stroke = brush;
adornment.StrokeThickness = lineStyle.GetStrokeThickness();
adornment.StrokeDashArray = lineStyle.GetStrokeDashArray();
if (lineStyle.HasFlag(LineStyle.Dotted) || lineStyle.HasFlag(LineStyle.Dashed))
{
adornment.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Unspecified);
}
else
{
adornment.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
}
if (lineStyle.HasFlag(LineStyle.Glow))
{
Effect effect;
var glowColor = highlight ? format.HighlightColor : format.LineColor;
if (!GlowEffectCache.TryGetValue(glowColor, out effect))
{
effect = new DropShadowEffect
{
Color = glowColor.ToSWMC(),
BlurRadius = LineStyle.Thick.GetStrokeThickness(),
Opacity = 1.0,
ShadowDepth = 0.0,
RenderingBias = RenderingBias.Performance
};
if (effect.CanFreeze) effect.Freeze();
GlowEffectCache[glowColor] = effect;
}
try
{
adornment.Effect = effect;
}
catch (COMException)
{
// No sensible way to deal with this exception, so we'll
// fall back on changing the color.
adornment.Effect = null;
if (!GuideBrushCache.TryGetValue(glowColor, out brush))
{
brush = new SolidColorBrush(glowColor.ToSWMC());
if (brush.CanFreeze) brush.Freeze();
GuideBrushCache[glowColor] = brush;
}
adornment.Stroke = brush;
}
}
else
{
adornment.Effect = null;
}
}
示例3: OnRendering
//.........这里部分代码省略.........
{
if (this.hoverEmbeddedIndex.HasValue && this.hoverEmbeddedIndex.Value == inlineIndex1)
{
scrollStep = new Nullable<double>(1);
this.embedScrollStepDictionary.Add(inlineIndex1, 1);
}
}
else
{
scrollStep = new Nullable<double>(step);
this.embedScrollStepDictionary.Add(inlineIndex1, step);
}
}
if (this.embedColorStepDictionary.TryGetValue(inlineIndex1, out step2))
{
if (isReady && this.nextHistoryPoint.HasValue)
{
if (!this.embedScrollStepDictionary.ContainsKey(inlineIndex1))
{
step2 -= 1 / (averageFrameRate / 4);
}
if (step2 <= 0)
{
entry = null;
isMutable = true;
this.embedColorStepDictionary.Remove(inlineIndex1);
}
else if (step2 < 1)
{
brush = new SolidColorBrush(Color.FromArgb((byte)(this.textColor.A + (this.linkColor.A - this.textColor.A) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.R + (this.linkColor.R - this.textColor.R) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.G + (this.linkColor.G - this.textColor.G) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.B + (this.linkColor.B - this.textColor.B) * Math.Sin(step2 / 2 * Math.PI))));
if (brush.CanFreeze)
{
brush.Freeze();
}
isMutable = true;
this.embedColorStepDictionary[inlineIndex1] = step2;
}
else
{
brush = this.linkBrush;
}
}
else if (step2 < 1)
{
step2 += 1 / (averageFrameRate / 4);
if (step2 >= 1)
{
brush = this.linkBrush;
isMutable = true;
this.embedColorStepDictionary[inlineIndex1] = 1;
}
else
{
brush = new SolidColorBrush(Color.FromArgb((byte)(this.textColor.A + (this.linkColor.A - this.textColor.A) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.R + (this.linkColor.R - this.textColor.R) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.G + (this.linkColor.G - this.textColor.G) * Math.Sin(step2 / 2 * Math.PI)), (byte)(this.textColor.B + (this.linkColor.B - this.textColor.B) * Math.Sin(step2 / 2 * Math.PI))));
if (brush.CanFreeze)
{
brush.Freeze();
}
isMutable = true;