private void btnPalette_Click(object sender, RoutedEventArgs e) { Button target = (Button)sender; int idx; if (!int.TryParse(target.Tag.ToString(), out idx)) { return; } if (CurrentPalette.PaletteColor[idx] == new Color()) { btnLoadColorBack.IsEnabled = false; btnLoadColorFront.IsEnabled = false; txtColorName.Text = FrontColor.ToString(); } else { btnLoadColorBack.IsEnabled = true; btnLoadColorFront.IsEnabled = true; txtColorName.Text = CurrentPalette.ColorName[idx]; } palettePopup.PlacementTarget = target; palettePopup.StaysOpen = false; palettePopup.IsOpen = true; txtColorName.Focus(); }
public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize) { UInt32 pageCount = pageArrayBin.pageCount; UInt32 curveCount = pageArrayBin.pageArray[pageCount].trendChartNum++; if (pageArrayBin.pageArray[pageCount].m_trendChart == null) { pageArrayBin.pageArray[pageCount].m_trendChart = new TrendChartBin[SVLimit.PAGE_TCHART_MAXNUM]; } TrendChartBin curveBin = pageArrayBin.pageArray[pageCount].m_trendChart[curveCount]; curveBin.lineClr = new UInt32[4]; curveBin.lineWidth = new Byte[4]; curveBin.addrOffset = new UInt32[4]; curveBin.varType = new Byte[4]; curveBin.keyOffset = new UInt32[3]; curveBin.id = ID; curveBin.rect.sX = (UInt16)Rect.X; curveBin.rect.sY = (UInt16)Rect.Y; curveBin.rect.eX = (UInt16)(Rect.Width + curveBin.rect.sX); curveBin.rect.eY = (UInt16)(Rect.Height + curveBin.rect.sY); //字体颜色 curveBin.scaleClr = (UInt32)FrontColor.ToArgb(); //背景颜色 curveBin.bgClr = (UInt32)BackgdColor.ToArgb(); curveBin.yMin = Min; curveBin.yMax = Max; curveBin.maxTime = Interval; curveBin.font = (Byte)_font.Size; curveBin.stepTime = Step; var varInstance = SVVaribleType.instance(); curveBin.keyOffset[0] = varInstance.strToAddress(ForwardControl.VarName, ForwardControl.VarBlockType); curveBin.keyOffset[1] = varInstance.strToAddress(CurControl.VarName, CurControl.VarBlockType); curveBin.keyOffset[2] = varInstance.strToAddress(BackwardControl.VarName, BackwardControl.VarBlockType); ///编译变量、颜色及使能标志 Int32 nCount = _variable.Count; for (Int32 i = 0; i < nCount; i++) { String name = _variable[i].Var.VarName; Byte type = _variable[i].Var.VarBlockType; curveBin.addrOffset[i] = varInstance.strToAddress(name, type); curveBin.varType[i] = (Byte)varInstance.strToType(name, type); curveBin.lineClr[i] = (UInt32)_variable[i].Color.ToArgb(); curveBin.lineWidth[i] = _variable[i].Enabled ? (Byte)1 : (Byte)0; } ///"SHORT_INT", "SHORTINT_VAR", "INT", "INT_VAR", "REAL", "REAL_VAR" pageArrayBin.pageArray[pageCount].m_trendChart[curveCount] = curveBin; }
public override int GetHashCode() { unchecked { var hashCode = BackColor.GetHashCode(); hashCode = (hashCode * 397) ^ FrontColor.GetHashCode(); hashCode = (hashCode * 397) ^ Glyph.GetHashCode(); return(hashCode); } }
protected override void DrawCore(RenderContext context) { var sceneCameraRenderer = context.Tags.Get(SceneCameraRenderer.Current); var graphicsDevice = context.GraphicsDevice; try { graphicsDevice.PushState(); // If we have a scene camera renderer use it to disable depth if (sceneCameraRenderer != null) { sceneCameraRenderer.ActivateOutput(context, !EnableDepth); } // Setup the backface paramters if (context.Parameters.Get(MaterialFrontBackBlendShaderKeys.UseNormalBackFace) != EnableBackColor) { context.Parameters.Set(MaterialFrontBackBlendShaderKeys.UseNormalBackFace, EnableBackColor); } context.Parameters.Set(MaterialFrontBackBlendShaderKeys.ColorFront, FrontColor.ToColorSpace(graphicsDevice.ColorSpace)); context.Parameters.Set(MaterialFrontBackBlendShaderKeys.ColorBack, (EnableBackColor ? BackColor : FrontColor).ToColorSpace(graphicsDevice.ColorSpace)); context.Parameters.Set(MaterialFrontBackBlendShaderKeys.AlphaBlend, AlphaBlend * BlendFactor); context.Parameters.Set(MaterialFrontBackBlendShaderKeys.ColorBlend, (EnableColorBlend ? ColorBlend : AlphaBlend) * BlendFactor); graphicsDevice.SetBlendState(graphicsDevice.BlendStates.AlphaBlend); graphicsDevice.SetRasterizerState(EnableBackColor || ShowBackface ? graphicsDevice.RasterizerStates.WireFrame : graphicsDevice.RasterizerStates.WireFrameCullBack); graphicsDevice.SetDepthStencilState(graphicsDevice.DepthStencilStates.Default); modelComponentAndPickingRenderer.ModelRenderer.ForceRasterizer = true; base.DrawCore(context); } finally { graphicsDevice.PopState(); } }
/// <summary> /// Perform deep copy of this object. /// </summary> /// <returns></returns> public object Clone() { return(new Tile((Color)BackColor.Clone(), (Color)FrontColor.Clone(), Glyph)); }
protected bool Equals(Tile other) { return(BackColor.Equals(other.BackColor) && FrontColor.Equals(other.FrontColor) && Glyph == other.Glyph); }