我正在尝试让颜色选择器在我的组合框内工作iv设法让它列出颜色,但我遇到一些问题,让它从Media.Brush
转换为Media.Color
。
private void BrushColorCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Color DrawColor = (Color)(BrushColorCombo.SelectedItem as PropertyInfo).GetValue(null, null);
}
startPoint = e.GetPosition(PaintCanvas);
rect = new Rectangle
{
Stroke = Drawcolor,
StrokeThickness = 1
};
rect.Fill = new SolidColorBrush(Drawcolor);
Canvas.SetLeft(rect, startPoint.X);
Canvas.SetTop(rect, startPoint.Y);
PaintCanvas.Children.Add(rect);
return;