diff --git a/ConvertMoels/ColorSQLConvert.cs b/ConvertMoels/ColorSQLConvert.cs index e00a27d..c420311 100644 --- a/ConvertMoels/ColorSQLConvert.cs +++ b/ConvertMoels/ColorSQLConvert.cs @@ -4,15 +4,22 @@ using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; namespace formula_manage.ConvertMoels { - internal class ColorSQLConvert + /// + /// RGB色彩数值转换器 + /// 将色彩数值转换为ARGB代码返回 + /// + public class ColorSQLConvert : IValueConverter { + /// + /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) - { + { string colorValue = string.Format("{0:X6}", value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0” /*string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值(正向)*/ string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数 @@ -26,8 +33,8 @@ namespace formula_manage.ConvertMoels return null;//返回空 } } - /// - /// + /// + /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; diff --git a/ConvertMoels/ProductTypeSQLConvert.cs b/ConvertMoels/ProductTypeSQLConvert.cs index 2e8eee5..ab33eb5 100644 --- a/ConvertMoels/ProductTypeSQLConvert.cs +++ b/ConvertMoels/ProductTypeSQLConvert.cs @@ -4,10 +4,11 @@ using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; namespace formula_manage.ConvertMoels { - internal class ProductTypeSQLConvert + internal class ProductTypeSQLConvert : IValueConverter { /// /// diff --git a/MainWindow.xaml b/MainWindow.xaml index a9f0aa5..b2d0af2 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -97,7 +97,7 @@ HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC" BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" CanUserReorderColumns="False" CanUserSortColumns="False" - CanUserAddRows="False" CanUserDeleteRows="False" + CanUserAddRows="False" CanUserDeleteRows="False" Background="White" SelectionMode="Single" FontSize="15" CanUserResizeRows="False"> - + + + - + - + - - - - + + + + diff --git a/Windows/Stuff.xaml.cs b/Windows/Stuff.xaml.cs index 009648c..e8cfdb5 100644 --- a/Windows/Stuff.xaml.cs +++ b/Windows/Stuff.xaml.cs @@ -16,6 +16,7 @@ using GalaSoft.MvvmLight; using formula_manage.SQLModels; using System.Data.SqlClient; using System.Data; +using System.Windows.Forms; namespace formula_manage.Windows { @@ -38,13 +39,11 @@ namespace formula_manage.Windows { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); - } private async void Stuff_Loaded(object sender, RoutedEventArgs e)//打开页面执行 { UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取 - this.DataGridStuff.LoadingRow += new EventHandler(this.DataGridEquipment_LoadingRow);//生成序列号 TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件 @@ -72,19 +71,19 @@ namespace formula_manage.Windows Stuff_data.Fill(Stuff_DataSet); //查询结果存入缓存 conn_SC.Close(); //关闭连接 - DataGridStuff.DataContext = Stuff_DataSet; - DataGridStuff.ItemsSource = new object[] {Stuff_DataSet }; + // DataGridStuff.ItemsSource = Stuff_DataSet.DefaultViewManager; } catch (Exception) { System.Windows.MessageBox.Show("请求原料信息失败,检查连接"); return; - } + } + } - - /// - /// 生成序列号的方法 - /// + + /// + /// 生成序列号的方法 + /// private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) { e.Row.Header = e.Row.GetIndex() + 1;