自定义了窗口
xmal代码为
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:qk="https://getquicker.net"
Width="400"
Height="150"
Title="调节透明度"
mc:Ignorable="d">
<Grid Margin="5">
<StackPanel>
<Slider x:Name="MySlider" Minimum="0" Maximum="255"
Value="128"
LargeChange="64" SmallChange="32"
TickPlacement="BottomRight" TickFrequency="16"
HorizontalAlignment="Stretch"
/>
</StackPanel>
</Grid>
</Window>
c#代码为
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Collections.Generic;
using MessageBox = System.Windows.Forms.MessageBox;
using Quicker.Public;
public static IDictionary<string, object> dataContext;
public static ICustomWindowContext winContext;
public static Slider MySlider;
public static void OnWindowCreated(Window win, IDictionary<string, object> winData, ICustomWindowContext winContext){
MySlider = win.FindName("MySlider") as Slider;
MySlider.ValueChanged += MySlider_ValueChanged;//注册MySlider_ValueChanged事件
winContext.RunSp("tiaojie", new Dictionary<string,object>{{"alpha", MySlider.Value}});
}
public static void MySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
winContext.RunSp("tiaojie", new Dictionary<string,object>{{"alpha", e.NewValue}});
}
载入窗口时调用 tiaojie 模块可以使用
但在使用 MySlider_ValueChanged 回调函数 去出现错误,如何解决呢,望大佬们给点意见