C#WPF代码问题........... [英] C# WPF code problem...........
本文介绍了C#WPF代码问题...........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
this is my code
private void textBlock2_MouseMove(object sender, MouseEventArgs e)
{
textBlock2.Foreground.Opacity = 255;
TextBlock myButton = (TextBlock)sender;
OuterGlowBitmapEffect myBlurEffect = new OuterGlowBitmapEffect();
myBlurEffect.Opacity = 100;
myBlurEffect.GlowSize = 30;
myBlurEffect.GlowColor = Colors.Green;
textBlock2.BitmapEffect = myBlurEffect;
}
错误1是
and error 1 is
Warning 1 Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string' C:\Users\Kyle\documents\visual studio 2010\Projects\DaysUntill\DaysUntill\MainWindow.xaml.cs 105 17 DaysUntill
错误2是
and error 2 is
Warning 2 'System.Windows.UIElement.BitmapEffect' is obsolete: '"BitmapEffects are deprecated and no longer function. Consider using Effects where appropriate instead."' C:\Users\Kyle\documents\visual studio 2010\Projects\DaysUntill\DaysUntill\MainWindow.xaml.cs 394 13 DaysUntill
can anyone plz help?
推荐答案
首先,这些都是警告,而不是错误.
第二个警告1并非来自此代码.
它可能来自ifcomparision
,可能是您在某个位置的字符串和对象之间进行的操作.
不建议使用OuterGlowBitmapEffect
,而应使用BlurEffect
.请参见此处 [
First these are both warnings and not errors.
Second warning 1 is not coming from this code.
It is probably coming from an ifcomparision
that you may be doing between a string and an object somewhere.
OuterGlowBitmapEffect
is deprecated andBlurEffect
should be used instead. See here[^].
这篇关于C#WPF代码问题...........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文