프로젝트

일반

사용자정보

개정판 ea8a8440

IDea8a844074441ea0f4fed5f1669af14abf2dbce6
상위 5dc8354d
하위 95c73392

김태성이(가) 일년 이상 전에 추가함

iussue #00000 Color List 수정

Change-Id: Ia5bf93dba05b6caa94b086d2b0f704eff24f5950

차이점 보기:

ColorList/App.Release.config
2 2
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
3 3
<!-- In case configuration is not the root element, replace it with root element in source configuration file -->
4 4
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
5
	<startup>
6
		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
7
	</startup>
8
	<connectionStrings>
9
		<add name="markusEntities"
10
connectionString="metadata=res://*/ModelMarkus.csdl|res://*/ModelMarkus.ssdl|res://*/ModelMarkus.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=12.127.163.230,10102;initial catalog=Markus_SEC;persist security info=True;user id=sa;password=P@sswd12;MultipleActiveResultSets=True;App=EntityFramework&quot;"
11
providerName="System.Data.EntityClient"/>
12
	</connectionStrings>
5 13
</configuration>
ColorList/ColorList.csproj
187 187
    </Content>
188 188
  </ItemGroup>
189 189
  <ItemGroup>
190
    <PackageReference Include="Costura.Fody">
191
      <Version>5.6.0</Version>
192
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
193
      <PrivateAssets>all</PrivateAssets>
194
    </PackageReference>
190 195
    <PackageReference Include="EntityFramework">
191 196
      <Version>6.2.0</Version>
192 197
    </PackageReference>
ColorList/MainWindow.xaml
9 9
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
10 10
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
11 11
    Title="Color List"
12
    Width="785"
12
    Width="920"
13 13
    Height="910">
14 14
    <Window.Resources>
15 15
        <converters:StringToColorBrushConverter x:Key="StringToColorBrushConverter" />
......
21 21
        </Grid.RowDefinitions>
22 22
        <Grid.ColumnDefinitions>
23 23
            <ColumnDefinition Width="Auto" MinWidth="150" />
24
            <ColumnDefinition Width="Auto" />
24 25
            <ColumnDefinition />
25 26
        </Grid.ColumnDefinitions>
27
        <Border
28
            Grid.RowSpan="2"
29
            Grid.ColumnSpan="2"
30
            Background="#FFC7C4C4" />
26 31
        <ZoomAndPan:ZoomAndPanControl
27 32
            x:Name="zoomAndPanControl"
28
            Grid.Row="1"
33
            Grid.RowSpan="2"
29 34
            Grid.Column="2"
30 35
            Background="LightGray"
31 36
            ConstrainedContentViewportHeight="{Binding ActualHeight, ElementName=image, Mode=OneWay}"
......
44 49
                    Stretch="None" />
45 50
            </Canvas>
46 51
        </ZoomAndPan:ZoomAndPanControl>
47
        <Border
48
            Grid.Column="1"
49
            HorizontalAlignment="Left"
50
            VerticalAlignment="Top"
51
            Background="AliceBlue"
52
            BorderBrush="#FF6A6A6A"
53
            BorderThickness="2">
54
            <StackPanel Margin="5" Orientation="Horizontal">
55
                <TextBlock Text="Text Bold: " />
56
                <CheckBox
57
                    x:Name="chkTextBold"
58
                    Margin="0,0,10,0"
59
                    HorizontalAlignment="Center"
60
                    VerticalAlignment="Center"
61
                    Click="chkTextBold_Click" />
62
                <TextBlock Text="Text Size : " />
63
                <telerik:RadNumericUpDown
64
                    Margin="0,0,10,0"
65
                    Minimum="1"
66
                    ValueChanged="TextSize_ValueChanged"
67
                    Value="12">
68
                    <telerik:RadNumericUpDown.NumberFormatInfo>
69
                        <Globalization:NumberFormatInfo
70
                            CurrencyDecimalDigits="0"
71
                            NumberDecimalDigits="0"
72
                            PercentDecimalDigits="0"
73
                            PercentSymbol="px" />
74
                    </telerik:RadNumericUpDown.NumberFormatInfo>
75
                </telerik:RadNumericUpDown>
76
                <TextBlock Text="Border Size : " />
77
                <telerik:RadNumericUpDown
78
                    Minimum="1"
79
                    ValueChanged="BorderSize_ValueChanged"
80
                    Value="1">
81
                    <telerik:RadNumericUpDown.NumberFormatInfo>
82
                        <Globalization:NumberFormatInfo
83
                            CurrencyDecimalDigits="0"
84
                            NumberDecimalDigits="0"
85
                            PercentDecimalDigits="0"
86
                            PercentSymbol="px" />
87
                    </telerik:RadNumericUpDown.NumberFormatInfo>
88
                </telerik:RadNumericUpDown>
89
            </StackPanel>
90
        </Border>
91 52
        <StackPanel Margin="5">
92 53
            <Button
93 54
                Width="100"
94 55
                Height="24"
56
                Margin="0,0,0,10"
95 57
                Click="Button_Click"
96 58
                Content="Save" />
97
        </StackPanel>
98
        <telerik:RadListBox
99
            x:Name="listBox"
100
            Grid.Row="1"
101
            MouseDoubleClick="listBox_MouseDoubleClick">
102
            <telerik:RadListBox.ItemTemplate>
103
                <DataTemplate>
104
                    <StackPanel Orientation="Horizontal">
105
                        <TextBlock Text="{Binding Inx, StringFormat=\{0:D2\}}" />
59
            <telerik:RadListBox
60
                x:Name="listBox"
61
                MinHeight="30"
62
                MaxWidth="350"
63
                Margin="-4,0,0,20"
64
                MouseDoubleClick="listBox_MouseDoubleClick"
65
                SelectionChanged="listBox_SelectionChanged"
66
                VirtualizingPanel.IsVirtualizingWhenGrouping="True"
67
                VirtualizingPanel.ScrollUnit="Pixel"
68
                VirtualizingPanel.VirtualizationMode="Recycling">
69
                <telerik:RadListBox.ItemsPanel>
70
                    <ItemsPanelTemplate>
71
                        <telerik:VirtualizingWrapPanel ItemHeight="35" ItemWidth="45" />
72
                    </ItemsPanelTemplate>
73
                </telerik:RadListBox.ItemsPanel>
74
                <telerik:RadListBox.ItemTemplate>
75
                    <DataTemplate>
106 76
                        <Border
107
                            Width="80"
108
                            Height="24"
77
                            Width="45"
78
                            Height="30"
79
                            Margin="2"
109 80
                            Background="{Binding Color, Converter={StaticResource StringToColorBrushConverter}}"
110 81
                            BorderBrush="#FFE0E0E0"
111
                            BorderThickness="1" />
82
                            BorderThickness="1">
83
                            <TextBlock
84
                                HorizontalAlignment="Center"
85
                                VerticalAlignment="Center"
86
                                Foreground="White"
87
                                Text="{Binding Inx, StringFormat=\{0:D2\}}"/>
88
                        </Border>
89
                    </DataTemplate>
90
                </telerik:RadListBox.ItemTemplate>
91
            </telerik:RadListBox>
92
            <Border
93
                Grid.Row="1"
94
                Padding="4"
95
                HorizontalAlignment="Left"
96
                VerticalAlignment="Top"
97
                Background="AliceBlue"
98
                BorderBrush="Gray"
99
                BorderThickness="1">
100
                <Grid>
101
                    <Grid.RowDefinitions>
102
                        <RowDefinition />
103
                        <RowDefinition />
104
                        <RowDefinition Height="45" />
105
                    </Grid.RowDefinitions>
106
                    <StackPanel Margin="5" Orientation="Vertical">
107
                        <StackPanel Margin="0,4" Orientation="Horizontal">
108
                            <TextBlock Text="Image Hide: " />
109
                            <CheckBox x:Name="chkImageHide" Click="chkImageHide_Click" />
110
                        </StackPanel>
111
                        <StackPanel Margin="0,4" Orientation="Horizontal">
112
                            <TextBlock Text="Text Bold: " />
113
                            <CheckBox x:Name="chkTextBold" Click="chkTextBold_Click" />
114
                        </StackPanel>
115
                        <StackPanel Margin="0,4" Orientation="Horizontal">
116
                            <TextBlock Text="Text Size : " />
117
                            <telerik:RadNumericUpDown
118
                                Minimum="1"
119
                                ValueChanged="TextSize_ValueChanged"
120
                                Value="12">
121
                                <telerik:RadNumericUpDown.NumberFormatInfo>
122
                                    <Globalization:NumberFormatInfo
123
                                        CurrencyDecimalDigits="0"
124
                                        NumberDecimalDigits="0"
125
                                        PercentDecimalDigits="0"
126
                                        PercentSymbol="px" />
127
                                </telerik:RadNumericUpDown.NumberFormatInfo>
128
                            </telerik:RadNumericUpDown>
129
                        </StackPanel>
130
                        <StackPanel Orientation="Horizontal">
131
                            <TextBlock Text="Border Size : " />
132
                            <telerik:RadNumericUpDown
133
                                Minimum="1"
134
                                ValueChanged="BorderSize_ValueChanged"
135
                                Value="1">
136
                                <telerik:RadNumericUpDown.NumberFormatInfo>
137
                                    <Globalization:NumberFormatInfo
138
                                        CurrencyDecimalDigits="0"
139
                                        NumberDecimalDigits="0"
140
                                        PercentDecimalDigits="0"
141
                                        PercentSymbol="px" />
142
                                </telerik:RadNumericUpDown.NumberFormatInfo>
143
                            </telerik:RadNumericUpDown>
144
                        </StackPanel>
112 145
                    </StackPanel>
113
                </DataTemplate>
114
            </telerik:RadListBox.ItemTemplate>
115
        </telerik:RadListBox>
146
                    <StackPanel
147
                        Grid.Row="1"
148
                        Width="350"
149
                        Height="320">
150
                        <telerik:RadColorSelector
151
                            x:Name="colorSelector"
152
                            MainPalette="Office"
153
                            MainPaletteHeaderText=""
154
                            NoColorVisibility="Collapsed"
155
                            SelectedColorChanged="colorSelector_SelectColorChanged"
156
                            StandardPaletteVisibility="Collapsed" />
157
                        <telerik:RadColorEditor x:Name="colorEditor" SelectedColorChanged="RadColorEditor_SelectedColorChanged" />
158
                    </StackPanel>
159
                    <StackPanel Grid.Row="2" Orientation="Horizontal">
160
                        <StackPanel
161
                            Margin="3,3,20,3"
162
                            HorizontalAlignment="Left"
163
                            Orientation="Horizontal">
164
                            <TextBlock VerticalAlignment="Center" Text="Select Color " />
165
                            <Border
166
                                x:Name="border"
167
                                Width="30"
168
                                Height="30"
169
                                BorderBrush="Black"
170
                                BorderThickness="1" />
171
                        </StackPanel>
172
                        <Button
173
                            Width="100"
174
                            Height="30"
175
                            Click="Ok_Click"
176
                            Content="Ok" />
177
                    </StackPanel>
178
                </Grid>
179
            </Border>
180
        </StackPanel>
116 181
    </Grid>
117 182
</Window>
ColorList/MainWindow.xaml.cs
173 173

  
174 174
        private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
175 175
        {
176
            if (listBox.SelectedItem != null)
177
            {
178
                var coloritem = listBox.SelectedItem as ColorItem;
176
            //if (listBox.SelectedItem != null)
177
            //{
178
            //    var coloritem = listBox.SelectedItem as ColorItem;
179 179
                
180
                var result =  colorPicker(coloritem.Color);
181

  
182
                coloritem.Color = $"{result.R:X2}{result.G:X2}{result.B:X2}";
183

  
184

  
185
                foreach (var item in canvas.Children)
186
                {
187
                    if (item is SampleItem sample)
188
                    {
189
                        if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2"))
190
                        {
191
                            sample.BorderBrush = new SolidColorBrush(result);
192
                            break;
193
                        }
194
                    }
195
                }
196
            }
180
            //    var result =  colorPicker(coloritem.Color);
181

  
182
            //    coloritem.Color = $"{result.R:X2}{result.G:X2}{result.B:X2}";
183

  
184

  
185
            //    foreach (var item in canvas.Children)
186
            //    {
187
            //        if (item is SampleItem sample)
188
            //        {
189
            //            if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2"))
190
            //            {
191
            //                sample.BorderBrush = new SolidColorBrush(result);
192
            //                break;
193
            //            }
194
            //        }
195
            //    }
196
            //}
197 197
        }
198 198

  
199 199
        private void chkTextBold_Click(object sender, RoutedEventArgs e)
......
249 249
                canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanControl);
250 250
            }
251 251
        }
252

  
253
        private void RadColorEditor_SelectedColorChanged(object sender, Telerik.Windows.Controls.ColorEditor.ColorChangeEventArgs e)
254
        {
255
            SetColor(colorEditor.SelectedColor);
256
        }
257

  
258
        private void colorSelector_SelectColorChanged(object sender, EventArgs e)
259
        {
260
            SetColor(colorSelector.SelectedColor);
261
        }
262

  
263
        private void SetColor(Color color,bool isPreview = true)
264
        {
265
            if (listBox.SelectedItem != null)
266
            {
267
                var coloritem = listBox.SelectedItem as ColorItem;
268

  
269
                foreach (var item in canvas.Children)
270
                {
271
                    if (item is SampleItem sample)
272
                    {
273
                        if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2"))
274
                        {
275
                            border.Background = new SolidColorBrush(color);
276
                            sample.BorderBrush = new SolidColorBrush(color);
277
                            break;
278
                        }
279
                    }
280
                }
281
            }
282
        }
283

  
284
        bool IsChange;
285

  
286
        private void Ok_Click(object sender, RoutedEventArgs e)
287
        {
288
            if (listBox.SelectedItem != null && border.Background is SolidColorBrush brush)
289
            {
290
                var coloritem = listBox.SelectedItem as ColorItem;
291
                
292
                var color = brush.Color;
293

  
294
                coloritem.Color = $"{color.R:X2}{color.G:X2}{color.B:X2}"; ;
295
            }
296
        }
297

  
298
        private void chkImageHide_Click(object sender, RoutedEventArgs e)
299
        {
300
            if(chkImageHide.IsChecked == true)
301
            {
302
                image.Visibility = Visibility.Hidden;
303
            }
304
            else
305
            {
306
                image.Visibility = Visibility.Visible;
307
            }
308
        }
309

  
310
        private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
311
        {
312
            if(e.RemovedItems.Count > 0)
313
            {
314
                if(e.RemovedItems[0] is ColorItem coloritem)
315
                {
316
                    SolidColorBrush brush = new SolidColorBrush(Converters.StringToColorBrushConverter.Parse(coloritem.Color));
317
                    foreach (var item in canvas.Children)
318
                    {
319
                        if (item is SampleItem sample)
320
                        {
321
                            if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2"))
322
                            {
323
                                if (sample.BorderBrush != brush)
324
                                {
325
                                    sample.BorderBrush = brush;
326
                                }
327

  
328
                                break;
329
                            }
330
                        }
331
                    }
332
                }
333
            }
334
        }
252 335
    }
253 336

  
254 337
    public class ColorItem : NotifyPropertyChange
KCOM/Common/Converter/StringToColorConverter.cs
22 22
            if (value is Color)
23 23
                return new SolidColorBrush((Color)value);
24 24

  
25

  
26

  
27 25
            if (value is string)
28 26
                return new SolidColorBrush(Parse((string)value));
29 27

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)