在WPF中,我可以使用以下代码设置堆栈面板的背景
stackPanelFlasher.Background = Brushes.Aqua;
Run Code Online (Sandbox Code Playgroud)
例如,如何将颜色设置为十六进制颜色代码#C7DFFC?
我在我的程序中收到了这个警告,我最近更新到了 Node 10,我试图找出弃用警告的来源:
[DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
如何跟踪此错误的来源?
附注。我已经在 CLI 上尝试过--trace-warnings,--trace-deprecation但没有运气
所以,在我的程序中我有3个滑块,SliderRed,SliderGreen,Slider Blue.它们的最大值都是255. EndColor当我移动滑块时,控件调用正确地改变了颜色,但我还没有找到一种方法来获取hexcode.text(Textblock)将画笔或颜色转换为十六进制值,如#FF0000.
我应该用什么来工作呢?
public void SliderChanged()
{
byte r = byte.Parse(sliderRed.Value.ToString());
byte g = byte.Parse(sliderGreen.Value.ToString());
byte b = byte.Parse(sliderBlue.Value.ToString());
EndColor.Background = new SolidColorBrush(Color.FromArgb(255, r, g, b));
hexcode.Text = EndColor.Background.ToString(); //Something like this
}
Run Code Online (Sandbox Code Playgroud)
我只需要hexcode.Text显示十六进制值.
我正在试图弄清楚调度计时器是如何工作的,所以我可以将它实现到我的程序中,我按照网站上的确切说明查找堆栈溢出的答案.人们说他们的问题是固定的,但我的代码非常相似,它不会工作......
错误是:
"timer_Tick"没有重载与委托"EventHandler <object>"相匹配
我能做什么?
public MainPage()
{
this.InitializeComponent();
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += timer_Tick;
timer.Start();
}
void timer_Tick(EventArgs e)
{
TimeRefresh();
}
Run Code Online (Sandbox Code Playgroud)