public void Add(GeoPoint from, GeoVector dir, double size, System.Drawing.Color color) { Line l = Line.Construct(); l.StartPoint = from; l.EndPoint = from + size * dir.Normalized; ColorDef cd = new ColorDef(color.Name, color); l.ColorDef = cd; toShow.Add(l); GeoVector perp = dir ^ GeoVector.ZAxis; if (Precision.IsNullVector(perp)) { perp = dir ^ GeoVector.XAxis; } GeoPoint p1 = from + size * 0.9 * dir.Normalized + size * 0.1 * perp.Normalized; GeoPoint p2 = from + size * 0.9 * dir.Normalized - size * 0.1 * perp.Normalized; Line l1 = Line.Construct(); l1.StartPoint = l.EndPoint; l1.EndPoint = p1; l1.ColorDef = cd; toShow.Add(l1); Line l2 = Line.Construct(); l2.StartPoint = l.EndPoint; l2.EndPoint = p2; l2.ColorDef = cd; toShow.Add(l2); }
public void SetColors(OverlayColorData[] CurrentColors) { List <SharedColorDef> newColors = new List <SharedColorDef>(); foreach (var col in CurrentColors) { SharedColorDef scd = new SharedColorDef(col.name, col.channelCount); List <ColorDef> colorchannels = new List <ColorDef>(); for (int i = 0; i < col.channelCount; i++) { if (col.isDefault(i)) { continue; } Color Mask = col.channelMask[i]; Color Additive = col.channelAdditiveMask[i]; colorchannels.Add(new ColorDef(i, ColorDef.ToUInt(Mask), ColorDef.ToUInt(Additive))); } if (colorchannels.Count > 0) { scd.SetChannels(colorchannels.ToArray()); newColors.Add(scd); } } Colors = newColors.ToArray(); }
/// <summary> /// Constructor required by deserialization /// </summary> /// <param name="info">SerializationInfo</param> /// <param name="context">StreamingContext</param> protected BlockRef(SerializationInfo info, StreamingContext context) : base(info, context) { idea = InfoReader.Read(info, "Idea", typeof(Block)) as Block; insertion = (ModOp)InfoReader.Read(info, "Insertion", typeof(ModOp)); colorDef = ColorDef.Read(info, context); }
private void colorList_DidModify(object sender, EventArgs args) { Choices = colorList.Names; ExtendChoices(); ColorDef selectedColor = null; if (iColorDef != null) { selectedColor = iColorDef.ColorDef; } else if (propertyInfo != null) { MethodInfo mi = propertyInfo.GetGetMethod(); object[] prm = new object[0]; selectedColor = (ColorDef)mi.Invoke(objectWithProperty, prm); } if (selectedColor != null) { selectedText = selectedColor.Name; } else if (selectedCD != null) { selectedText = selectedCD.Name; } }
public ColorSelectionProperty(object go, string propertyName, string resourceId, ColorList clrTable, ColorList.StaticFlags flags) { useFlags = flags; flags = clrTable.Usage; clrTable.Usage = useFlags; base.resourceId = resourceId; colorList = clrTable; choices = clrTable.Names; objectWithProperty = go; propertyInfo = objectWithProperty.GetType().GetProperty(propertyName); MethodInfo mi = propertyInfo.GetGetMethod(); object[] prm = new object[0]; ColorDef selectedColor = (ColorDef)mi.Invoke(objectWithProperty, prm); if (selectedColor != null) { selectedText = selectedColor.Name; } selectedCD = selectedColor; clrTable.Usage = flags; unselectedText = StringTable.GetString("ColorDef.Undefined"); toWatch = go as IGeoObject; // may be null }
int IExportStep.Export(ExportStep export, bool topLevel) { // #63=LINE('',#60,#62) ; int p1 = (startPoint as IExportStep).Export(export, false); // unfortunately we don't know about vertices here, so we cannot use them int dir = ((EndPoint - StartPoint) as IExportStep).Export(export, false); int vec = export.WriteDefinition("VECTOR('',#" + dir.ToString() + ",1.)"); int ln = export.WriteDefinition("LINE('',#" + p1.ToString() + ",#" + vec.ToString() + ")"); if (topLevel) { // export as a geometric curve set of a single trimmed curve // #37 = GEOMETRIC_CURVE_SET('',(#38)); // #38 = TRIMMED_CURVE('',#39,(#43,PARAMETER_VALUE(0.E+000)),(#44,PARAMETER_VALUE(62.52263230373)),.T.,.PARAMETER.); int sp = (startPoint as IExportStep).Export(export, false); int ep = (endPoint as IExportStep).Export(export, false); int tc = export.WriteDefinition("TRIMMED_CURVE('',#" + ln.ToString() + ",(#" + sp.ToString() + ",PARAMETER_VALUE(0.0)),(#" + ep.ToString() + ",PARAMETER_VALUE(" + export.ToString(Length) + ")),.T.,.CARTESIAN.)"); int gcs = export.WriteDefinition("GEOMETRIC_CURVE_SET('',(#" + tc.ToString() + "))"); // is a Representation_Item ColorDef cd = ColorDef; if (cd == null) { cd = new ColorDef("Black", Color.Black); } cd.MakeStepStyle(gcs, export); int product = export.WriteDefinition("PRODUCT( '','','',(#2))"); int pdf = export.WriteDefinition("PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE( ' ', 'NONE', #" + product.ToString() + ", .NOT_KNOWN. )"); int pd = export.WriteDefinition("PRODUCT_DEFINITION( 'NONE', 'NONE', #" + pdf.ToString() + ", #3 )"); int pds = export.WriteDefinition("PRODUCT_DEFINITION_SHAPE( 'NONE', 'NONE', #" + pd.ToString() + " )"); int sr = export.WriteDefinition("SHAPE_REPRESENTATION('', ( #" + gcs.ToString() + "), #4 )"); export.WriteDefinition("SHAPE_DEFINITION_REPRESENTATION( #" + pds.ToString() + ", #" + sr.ToString() + ")"); return(sr); } else { return(ln); } }
public override void ListBoxSelected(int selectedIndex) { if (selectedIndex < 0) { return; } selectedCD = colorList.Find(choices[selectedIndex]); if (selectedCD == null) { return; } if (iColorDef != null) { iColorDef.ColorDef = selectedCD; } else if (propertyInfo != null) { MethodInfo mi = propertyInfo.GetSetMethod(); object[] prm = new object[1]; prm[0] = selectedCD; mi.Invoke(objectWithProperty, prm); } else if (ColorDefChangedEvent != null) { ColorDefChangedEvent(selectedCD); } if (propertyPage != null) { propertyPage.Refresh(this); } }
/// <summary> /// Empty protected constructor. /// </summary> protected Line() { colorDef = new ColorDef(null, Color.Black); if (Constructed != null) { Constructed(this); } }
public override void SetSelection(int toSelect) { if (toSelect >= 0 && toSelect < choices.Length) { selectedCD = colorList[toSelect]; } base.SetSelection(toSelect); }
private void OnUpdateColor() { var epgSetting = (EpgSetting)grid_basic.DataContext; if (epgSetting != null && initializingColor == false) { epgSetting.TitleColor1 = ((KeyValuePair <string, SolidColorBrush>)comboBox_colorTitle1.SelectedItem).Key; epgSetting.TitleColor2 = ((KeyValuePair <string, SolidColorBrush>)comboBox_colorTitle2.SelectedItem).Key; epgSetting.TitleCustColor1 = ColorDef.ToUInt(((SolidColorBrush)button_colorTitle1.Background).Color); epgSetting.TitleCustColor2 = ColorDef.ToUInt(((SolidColorBrush)button_colorTitle2.Background).Color); } epgSetting = (EpgSetting)grid_color.DataContext; if (epgSetting != null && initializingColor == false) { epgSetting.ContentColorList[0x00] = ((KeyValuePair <string, SolidColorBrush>)comboBox0.SelectedItem).Key; epgSetting.ContentColorList[0x01] = ((KeyValuePair <string, SolidColorBrush>)comboBox1.SelectedItem).Key; epgSetting.ContentColorList[0x02] = ((KeyValuePair <string, SolidColorBrush>)comboBox2.SelectedItem).Key; epgSetting.ContentColorList[0x03] = ((KeyValuePair <string, SolidColorBrush>)comboBox3.SelectedItem).Key; epgSetting.ContentColorList[0x04] = ((KeyValuePair <string, SolidColorBrush>)comboBox4.SelectedItem).Key; epgSetting.ContentColorList[0x05] = ((KeyValuePair <string, SolidColorBrush>)comboBox5.SelectedItem).Key; epgSetting.ContentColorList[0x06] = ((KeyValuePair <string, SolidColorBrush>)comboBox6.SelectedItem).Key; epgSetting.ContentColorList[0x07] = ((KeyValuePair <string, SolidColorBrush>)comboBox7.SelectedItem).Key; epgSetting.ContentColorList[0x08] = ((KeyValuePair <string, SolidColorBrush>)comboBox8.SelectedItem).Key; epgSetting.ContentColorList[0x09] = ((KeyValuePair <string, SolidColorBrush>)comboBox9.SelectedItem).Key; epgSetting.ContentColorList[0x0A] = ((KeyValuePair <string, SolidColorBrush>)comboBox10.SelectedItem).Key; epgSetting.ContentColorList[0x0B] = ((KeyValuePair <string, SolidColorBrush>)comboBox11.SelectedItem).Key; epgSetting.ContentColorList[0x0F] = ((KeyValuePair <string, SolidColorBrush>)comboBox12.SelectedItem).Key; epgSetting.ContentColorList[0x10] = ((KeyValuePair <string, SolidColorBrush>)comboBox13.SelectedItem).Key; epgSetting.ServiceColor = ((KeyValuePair <string, SolidColorBrush>)comboBox_service.SelectedItem).Key; epgSetting.ReserveRectColorNormal = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNormal.SelectedItem).Key; epgSetting.ReserveRectColorNo = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNo.SelectedItem).Key; epgSetting.ReserveRectColorNoTuner = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNoTuner.SelectedItem).Key; epgSetting.ReserveRectColorWarning = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveWarning.SelectedItem).Key; epgSetting.ContentCustColorList[0x00] = ColorDef.ToUInt(((SolidColorBrush)button0.Background).Color); epgSetting.ContentCustColorList[0x01] = ColorDef.ToUInt(((SolidColorBrush)button1.Background).Color); epgSetting.ContentCustColorList[0x02] = ColorDef.ToUInt(((SolidColorBrush)button2.Background).Color); epgSetting.ContentCustColorList[0x03] = ColorDef.ToUInt(((SolidColorBrush)button3.Background).Color); epgSetting.ContentCustColorList[0x04] = ColorDef.ToUInt(((SolidColorBrush)button4.Background).Color); epgSetting.ContentCustColorList[0x05] = ColorDef.ToUInt(((SolidColorBrush)button5.Background).Color); epgSetting.ContentCustColorList[0x06] = ColorDef.ToUInt(((SolidColorBrush)button6.Background).Color); epgSetting.ContentCustColorList[0x07] = ColorDef.ToUInt(((SolidColorBrush)button7.Background).Color); epgSetting.ContentCustColorList[0x08] = ColorDef.ToUInt(((SolidColorBrush)button8.Background).Color); epgSetting.ContentCustColorList[0x09] = ColorDef.ToUInt(((SolidColorBrush)button9.Background).Color); epgSetting.ContentCustColorList[0x0A] = ColorDef.ToUInt(((SolidColorBrush)button10.Background).Color); epgSetting.ContentCustColorList[0x0B] = ColorDef.ToUInt(((SolidColorBrush)button11.Background).Color); epgSetting.ContentCustColorList[0x0F] = ColorDef.ToUInt(((SolidColorBrush)button12.Background).Color); epgSetting.ContentCustColorList[0x10] = ColorDef.ToUInt(((SolidColorBrush)button13.Background).Color); epgSetting.ServiceCustColor = ColorDef.ToUInt(((SolidColorBrush)button_service.Background).Color); epgSetting.EpgBackColorA = ((SolidColorBrush)button_epgBack.Background).Color.A; epgSetting.EpgBackColorR = ((SolidColorBrush)button_epgBack.Background).Color.R; epgSetting.EpgBackColorG = ((SolidColorBrush)button_epgBack.Background).Color.G; epgSetting.EpgBackColorB = ((SolidColorBrush)button_epgBack.Background).Color.B; epgSetting.ContentCustColorList[0x11] = ColorDef.ToUInt(((SolidColorBrush)button14.Background).Color); epgSetting.ContentCustColorList[0x12] = ColorDef.ToUInt(((SolidColorBrush)button15.Background).Color); epgSetting.ContentCustColorList[0x13] = ColorDef.ToUInt(((SolidColorBrush)button16.Background).Color); epgSetting.ContentCustColorList[0x14] = ColorDef.ToUInt(((SolidColorBrush)button17.Background).Color); } }
public override void SetObjectData(IJsonReadData data) { base.SetObjectData(data); refPoint = data.GetProperty <GeoPoint>("RefPoint"); containedObjects = data.GetProperty <GeoObjectList>("ContainedObjects"); colorDef = data.GetPropertyOrDefault <ColorDef>("ColorDef"); name = data.GetPropertyOrDefault <string>("Name"); data.RegisterForSerializationDoneCallback(this); }
public void SetProgramList(List <Tuple <double, List <ProgramViewItem> > > programGroupList, double height) { try { for (int i = 0; i < canvas.Children.Count; i++) { if (canvas.Children[i] is EpgViewPanel) { canvas.Children.RemoveAt(i--); } } var itemFontNormal = new EpgViewPanel.ItemFont(EpgSetting.FontName, false, false); var itemFontTitle = new EpgViewPanel.ItemFont(EpgSetting.FontNameTitle, EpgSetting.FontBoldTitle, false); var background = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgBackColorR, EpgSetting.EpgBackColorG, EpgSetting.EpgBackColorB)); //フリーズしないとかなり重い background.Freeze(); var dictTitle = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePatternTitle); var dicNormal = CommonManager.CreateReplaceDictionary(EpgSetting.EpgReplacePattern); Brush brushTitle = ColorDef.CustColorBrush(EpgSetting.TitleColor1, EpgSetting.TitleCustColor1); Brush brushNormal = ColorDef.CustColorBrush(EpgSetting.TitleColor2, EpgSetting.TitleCustColor2); //ジャンル別の背景ブラシ var contentBrushList = new List <Brush>(); for (int i = 0; i < EpgSetting.ContentColorList.Count; i++) { SolidColorBrush brush = ColorDef.CustColorBrush(EpgSetting.ContentColorList[i], EpgSetting.ContentCustColorList[i]); contentBrushList.Add(EpgSetting.EpgGradation ? (Brush)ColorDef.GradientBrush(brush.Color) : brush); } double totalWidth = 0; foreach (var programList in programGroupList) { EpgViewPanel item = new EpgViewPanel(); item.Background = background; item.Height = Math.Ceiling(height); item.Width = programList.Item1; Canvas.SetLeft(item, totalWidth); item.Initialize(programList.Item2, EpgSetting.EpgBorderLeftSize, EpgSetting.EpgBorderTopSize, false, EpgSetting.EpgTitleIndent, EpgSetting.EpgExtInfoTable, dictTitle, dicNormal, itemFontTitle, itemFontNormal, EpgSetting.FontSizeTitle, EpgSetting.FontSize, brushTitle, brushNormal, EpgSetting.EpgBackColorA, contentBrushList); item.InvalidateVisual(); canvas.Children.Add(item); totalWidth += programList.Item1; } //包含するCanvasにも直接適用する(Bindingは遅延するため)。GridやStackPanelで包含してもよいはずだが //非表示中にここを通るとなぜか包含側のActualHeight(Width)が正しく更新されず、結果スクロール不能になる canvasContainer.Height = canvas.Height = Math.Ceiling(height); canvasContainer.Width = canvas.Width = totalWidth; itemFontNormal.ClearCache(); itemFontTitle.ClearCache(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Implements the <see cref="IGeoObjectImpl.CopyGeometry"/> method. /// </summary> /// <param name="ToCopyFrom"></param> public override void CopyGeometry(IGeoObject ToCopyFrom) { using (new Changing(this)) { this.location = ((Point)ToCopyFrom).location; this.symbol = ((Point)ToCopyFrom).symbol; this.size = ((Point)ToCopyFrom).size; this.colorDef = ((Point)ToCopyFrom).colorDef; } }
public RGBConverterViewModel() { Title = "ColorPicker"; _currentColor = new ColorDef { Red = 0, Green = 0, Blue = 0 }; RedOfColorPicker = _currentColor.Red; GreenOfColorPicker = _currentColor.Green; BlueOfColorPicker = _currentColor.Blue; }
public static void SelectNearColor(ComboBox cmbo, Color c) { var items = cmbo.Items.OfType <ColorComboItem>().Where(item => item.Value is SolidColorBrush).ToList(); if (items.Count == 0) { return; } cmbo.SelectedItem = items[ColorDef.SelectNearColor(items.Select(item => (item.Value as SolidColorBrush).Color), c)]; }
public override void PaintValue(PaintValueEventArgs e) { ColorDef colorDef = (ColorDef)e.Value; var color = colDefToColor[colorDef]; SolidBrush brush = new SolidBrush(color); Pen pen = new Pen(color, 0); Rectangle rect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawRectangle(pen, rect); e.Graphics.FillRectangle(brush, rect); }
private static void PropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var win = (ColorSetWindow)sender; Color c = win.GetColor(); win.rectangle_color.Fill = new SolidColorBrush(c); win.comboBox_color.SelectionChanged -= win.SelectedColor_Changed; try { SelectNearColor(win.comboBox_color, c); } finally { win.comboBox_color.SelectionChanged += win.SelectedColor_Changed; } win.label_Status.Text = ColorDef.ColorDiff((Color)win.comboBox_color.SelectedValue, c) < 1 ? "現在の色" : "近い色"; }
public void Add(IGeoObject toAdd, System.Drawing.Color color, int debugHint = 0) { if (toAdd != null) { ColorDef cd = new ColorDef(color.Name, color); if (toAdd is IColorDef) { (toAdd as IColorDef).ColorDef = cd; } toShow.Add(toAdd); } }
/// <summary> /// Constructor required by deserialization /// </summary> /// <param name="info">SerializationInfo</param> /// <param name="context">StreamingContext</param> protected Point(SerializationInfo info, StreamingContext context) : base(info, context) { location = (GeoPoint)info.GetValue("Location", typeof(GeoPoint)); symbol = (PointSymbol)info.GetValue("Symbol", typeof(PointSymbol)); colorDef = (ColorDef)info.GetValue("ColorDef", typeof(ColorDef)); size = (double)info.GetValue("Size", typeof(double)); if (Constructed != null) { Constructed(this); } }
/// <summary> /// Constructor required by deserialization /// </summary> /// <param name="info">SerializationInfo</param> /// <param name="context">StreamingContext</param> protected Line(SerializationInfo info, StreamingContext context) : base(info, context) { startPoint = (GeoPoint)info.GetValue("StartPoint", typeof(GeoPoint)); endPoint = (GeoPoint)info.GetValue("EndPoint", typeof(GeoPoint)); colorDef = ColorDef.Read(info, context); lineWidth = LineWidth.Read("LineWidth", info, context); linePattern = LinePattern.Read("LinePattern", info, context); if (Constructed != null) { Constructed(this); } }
public void SetDay(List <DateTime> dayList, double serviceWidth, bool gradationHeader) { stackPanel_day.Children.Clear(); if (serviceWidth > 2) { foreach (DateTime time in dayList) { TextBlock item = new TextBlock(); item.Width = serviceWidth - 2; item.Text = time.ToString("M\\/d\r\n(ddd)"); Color backgroundColor; if (time.DayOfWeek == DayOfWeek.Saturday) { item.Foreground = Brushes.DarkBlue; backgroundColor = Colors.Lavender; } else if (time.DayOfWeek == DayOfWeek.Sunday) { item.Foreground = Brushes.DarkRed; backgroundColor = Colors.MistyRose; } else { item.Foreground = Brushes.Black; backgroundColor = Colors.White; } var gridItem = new System.Windows.Controls.Primitives.UniformGrid(); if (gradationHeader == false) { gridItem.Background = new SolidColorBrush(backgroundColor); gridItem.Background.Freeze(); } else { gridItem.Background = ColorDef.GradientBrush(backgroundColor, 0.8); } gridItem.Margin = new Thickness(1, 1, 1, 1); item.TextAlignment = TextAlignment.Center; item.FontSize = 12; item.FontWeight = FontWeights.Bold; // 単にCenterだとやや重い感じになるので上げる item.Padding = new Thickness(0, 0, 0, 4); item.VerticalAlignment = VerticalAlignment.Center; gridItem.Children.Add(item); stackPanel_day.Children.Add(gridItem); } } }
public void SetDay(System.Collections.SortedList dayList) { try { stackPanel_day.Children.Clear(); foreach (DateTime time in dayList.Values) { TextBlock item = new TextBlock(); item.Width = Settings.Instance.ServiceWidth - 2; item.Text = time.ToString("M/d\r\n(ddd)"); Color backgroundColor; if (time.DayOfWeek == DayOfWeek.Saturday) { item.Foreground = Brushes.DarkBlue; backgroundColor = Colors.Lavender; } else if (time.DayOfWeek == DayOfWeek.Sunday) { item.Foreground = Brushes.DarkRed; backgroundColor = Colors.MistyRose; } else { item.Foreground = Brushes.Black; backgroundColor = Colors.White; } if (Settings.Instance.EpgGradationHeader == false) { item.Background = new SolidColorBrush(backgroundColor); } else { item.Background = ColorDef.GradientBrush(backgroundColor, 0.8); } item.Padding = new Thickness(0, 0, 0, 2); item.Margin = new Thickness(1, 1, 1, 1); item.TextAlignment = TextAlignment.Center; item.FontSize = 12; item.FontWeight = FontWeights.Bold; stackPanel_day.Children.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void grid_color_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { var epgSetting = (EpgSetting)grid_color.DataContext; if (epgSetting != null) { initializingColor = true; comboBox0.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x00])); comboBox1.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x01])); comboBox2.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x02])); comboBox3.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x03])); comboBox4.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x04])); comboBox5.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x05])); comboBox6.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x06])); comboBox7.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x07])); comboBox8.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x08])); comboBox9.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x09])); comboBox10.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x0A])); comboBox11.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x0B])); comboBox12.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x0F])); comboBox13.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ContentColorList[0x10])); comboBox_service.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ServiceColor)); comboBox_reserveNormal.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ReserveRectColorNormal)); comboBox_reserveNo.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ReserveRectColorNo)); comboBox_reserveNoTuner.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ReserveRectColorNoTuner)); comboBox_reserveWarning.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.ReserveRectColorWarning)); initializingColor = false; button0.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x00])); button1.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x01])); button2.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x02])); button3.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x03])); button4.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x04])); button5.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x05])); button6.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x06])); button7.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x07])); button8.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x08])); button9.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x09])); button10.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x0A])); button11.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x0B])); button12.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x0F])); button13.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x10])); button_service.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ServiceCustColor)); button_epgBack.Background = new SolidColorBrush(Color.FromArgb(epgSetting.EpgBackColorA, epgSetting.EpgBackColorR, epgSetting.EpgBackColorG, epgSetting.EpgBackColorB)); button14.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x11])); button15.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x12])); button16.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x13])); button17.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.ContentCustColorList[0x14])); } }
private void grid_basic_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { var epgSetting = (EpgSetting)grid_basic.DataContext; if (epgSetting != null) { initializingColor = true; comboBox_colorTitle1.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.TitleColor1)); comboBox_colorTitle2.SelectedIndex = Math.Max(0, ColorDef.BrushNames.IndexOfKey(epgSetting.TitleColor2)); initializingColor = false; button_colorTitle1.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.TitleCustColor1)); button_colorTitle2.Background = new SolidColorBrush(ColorDef.FromUInt(epgSetting.TitleCustColor2)); } }
public void Add(GeoPoint pnt, System.Drawing.Color color, int debugHint) { Point point = Point.Construct(); point.Location = pnt; point.Symbol = PointSymbol.Circle; ColorDef cd = new ColorDef(color.Name, color); point.ColorDef = cd; IntegerProperty ip = new IntegerProperty(debugHint, "Debug.Hint"); point.UserData.Add("Debug", ip); toShow.Add(point); }
public void Add(GeoPoint2D pnt, System.Drawing.Color color, string debugHint) { Point point = Point.Construct(); point.Location = new GeoPoint(pnt); point.Symbol = PointSymbol.Circle; ColorDef cd = new ColorDef(color.Name, color); point.ColorDef = cd; StringProperty sp = new StringProperty(debugHint, "Debug.Hint"); point.UserData.Add("Debug", sp); toShow.Add(point); }
private void OnUpdateColor() { var settings = (Settings)DataContext; if (settings != null && initializingColor == false) { settings.ContentColorList[0x00] = ((KeyValuePair <string, SolidColorBrush>)comboBox0.SelectedItem).Key; settings.ContentColorList[0x01] = ((KeyValuePair <string, SolidColorBrush>)comboBox1.SelectedItem).Key; settings.ContentColorList[0x02] = ((KeyValuePair <string, SolidColorBrush>)comboBox2.SelectedItem).Key; settings.ContentColorList[0x03] = ((KeyValuePair <string, SolidColorBrush>)comboBox3.SelectedItem).Key; settings.ContentColorList[0x04] = ((KeyValuePair <string, SolidColorBrush>)comboBox4.SelectedItem).Key; settings.ContentColorList[0x05] = ((KeyValuePair <string, SolidColorBrush>)comboBox5.SelectedItem).Key; settings.ContentColorList[0x06] = ((KeyValuePair <string, SolidColorBrush>)comboBox6.SelectedItem).Key; settings.ContentColorList[0x07] = ((KeyValuePair <string, SolidColorBrush>)comboBox7.SelectedItem).Key; settings.ContentColorList[0x08] = ((KeyValuePair <string, SolidColorBrush>)comboBox8.SelectedItem).Key; settings.ContentColorList[0x09] = ((KeyValuePair <string, SolidColorBrush>)comboBox9.SelectedItem).Key; settings.ContentColorList[0x0A] = ((KeyValuePair <string, SolidColorBrush>)comboBox10.SelectedItem).Key; settings.ContentColorList[0x0B] = ((KeyValuePair <string, SolidColorBrush>)comboBox11.SelectedItem).Key; settings.ContentColorList[0x0F] = ((KeyValuePair <string, SolidColorBrush>)comboBox12.SelectedItem).Key; settings.ContentColorList[0x10] = ((KeyValuePair <string, SolidColorBrush>)comboBox13.SelectedItem).Key; settings.ReserveRectColorNormal = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNormal.SelectedItem).Key; settings.ReserveRectColorNo = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNo.SelectedItem).Key; settings.ReserveRectColorNoTuner = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveNoTuner.SelectedItem).Key; settings.ReserveRectColorWarning = ((KeyValuePair <string, SolidColorBrush>)comboBox_reserveWarning.SelectedItem).Key; settings.TitleColor1 = ((KeyValuePair <string, SolidColorBrush>)comboBox_colorTitle1.SelectedItem).Key; settings.TitleColor2 = ((KeyValuePair <string, SolidColorBrush>)comboBox_colorTitle2.SelectedItem).Key; settings.ContentCustColorList[0x00] = ColorDef.ToUInt(((SolidColorBrush)button0.Background).Color); settings.ContentCustColorList[0x01] = ColorDef.ToUInt(((SolidColorBrush)button1.Background).Color); settings.ContentCustColorList[0x02] = ColorDef.ToUInt(((SolidColorBrush)button2.Background).Color); settings.ContentCustColorList[0x03] = ColorDef.ToUInt(((SolidColorBrush)button3.Background).Color); settings.ContentCustColorList[0x04] = ColorDef.ToUInt(((SolidColorBrush)button4.Background).Color); settings.ContentCustColorList[0x05] = ColorDef.ToUInt(((SolidColorBrush)button5.Background).Color); settings.ContentCustColorList[0x06] = ColorDef.ToUInt(((SolidColorBrush)button6.Background).Color); settings.ContentCustColorList[0x07] = ColorDef.ToUInt(((SolidColorBrush)button7.Background).Color); settings.ContentCustColorList[0x08] = ColorDef.ToUInt(((SolidColorBrush)button8.Background).Color); settings.ContentCustColorList[0x09] = ColorDef.ToUInt(((SolidColorBrush)button9.Background).Color); settings.ContentCustColorList[0x0A] = ColorDef.ToUInt(((SolidColorBrush)button10.Background).Color); settings.ContentCustColorList[0x0B] = ColorDef.ToUInt(((SolidColorBrush)button11.Background).Color); settings.ContentCustColorList[0x0F] = ColorDef.ToUInt(((SolidColorBrush)button12.Background).Color); settings.ContentCustColorList[0x10] = ColorDef.ToUInt(((SolidColorBrush)button13.Background).Color); settings.ContentCustColorList[0x11] = ColorDef.ToUInt(((SolidColorBrush)button14.Background).Color); settings.ContentCustColorList[0x12] = ColorDef.ToUInt(((SolidColorBrush)button15.Background).Color); settings.ContentCustColorList[0x13] = ColorDef.ToUInt(((SolidColorBrush)button16.Background).Color); settings.ContentCustColorList[0x14] = ColorDef.ToUInt(((SolidColorBrush)button17.Background).Color); settings.TitleCustColor1 = ColorDef.ToUInt(((SolidColorBrush)button_colorTitle1.Background).Color); settings.TitleCustColor2 = ColorDef.ToUInt(((SolidColorBrush)button_colorTitle2.Background).Color); } }
public void Add(ICurve2D c2d, System.Drawing.Color color, string debugHint) { if (c2d == null) { return; } IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane); ColorDef cd = new ColorDef(color.Name, color); (go as IColorDef).ColorDef = cd; StringProperty sp = new StringProperty(debugHint, "Debug.Hint"); go.UserData.Add("Debug", sp); toShow.Add(go); }
public override string[] GetDropDownList() { string[] res = new string[choices.Length]; for (int i = 0; i < choices.Length; i++) { ColorDef cd = colorList.Find(choices[i]); if (cd != null && cd.Source != ColorDef.ColorSource.fromParent && cd.Source != ColorDef.ColorSource.fromStyle) { res[i] = "[[ColorBox:" + cd.Color.R.ToString() + ":" + cd.Color.G.ToString() + ":" + cd.Color.B.ToString() + "]]" + cd.Name; } else { res[i] = choices[i]; } } return(res); }
private void OnMultiColorDefSelectionChanged(ColorDef selected) { isChangingMultipleAttributes = true; using (frame.Project.Undo.UndoFrame) { for (int i = 0; i < selectedObjects.Count; ++i) { IColorDef icd = selectedObjects[i] as IColorDef; if (icd != null) { icd.ColorDef = selected; } } } isChangingMultipleAttributes = false; MultiChangeDone(); }