private void LBtnDownEvent(object sender, RoutedEventArgs arg) { CurveCtrlBlock ccb = (CurveCtrlBlock)curveCtrlBlocks[sender]; if (sender != LastSelectedCbts) { LastSelectedCbts = sender; this.y_scale_txt.Text = "" + ccb.yScale; this.y_offset_txt.Text = "" + ccb.yOffset; this.x_scale_txt.Text = "" + ccb.xScale; } else { Rectangle cbtTemp = (Rectangle)sender; if (ccb.show) { ccb.show = false; ccb.brush = cbtTemp.Fill; cbtTemp.Fill = disableBrush; this.curveView.SetCurveVisable(ccb.curveIdx, false); } else { ccb.show = true; cbtTemp.Fill = ccb.brush; this.curveView.SetCurveVisable(ccb.curveIdx, true); } CurveUpdate(); } }
private void BindCbts() { defColors = new Color[CurveView.MAX_CURVE_NUMS] { Color.FromRgb(0, 0, 0), Color.FromRgb(255, 192, 203), Color.FromRgb(220, 20, 60), Color.FromRgb(219, 112, 147), Color.FromRgb(255, 105, 180), Color.FromRgb(255, 20, 147), Color.FromRgb(199, 21, 133), Color.FromRgb(218, 112, 214), Color.FromRgb(238, 130, 238), Color.FromRgb(255, 0, 255), Color.FromRgb(139, 0, 139), Color.FromRgb(75, 0, 130), Color.FromRgb(119, 136, 153), Color.FromRgb(30, 144, 255), Color.FromRgb(135, 206, 235), Color.FromRgb(47, 79, 79), }; cbts = new Rectangle[CurveView.MAX_CURVE_NUMS]; cbts[0] = this.cbt1; cbts[1] = this.cbt2; cbts[2] = this.cbt3; cbts[3] = this.cbt4; cbts[4] = this.cbt5; cbts[5] = this.cbt6; cbts[6] = this.cbt7; cbts[7] = this.cbt8; cbts[8] = this.cbt9; cbts[9] = this.cbt10; cbts[10] = this.cbt11; cbts[11] = this.cbt12; cbts[12] = this.cbt13; cbts[13] = this.cbt14; cbts[14] = this.cbt15; cbts[15] = this.cbt16; for (int i = 0; i < cbts.Length; i++) { cbts[i].AddHandler(Rectangle.MouseLeftButtonDownEvent, new RoutedEventHandler(this.LBtnDownEvent)); CurveCtrlBlock ccb = new CurveCtrlBlock(); ccb.color = defColors[i]; ccb.xScale = 1.0f; ccb.yOffset = 0.0f; ccb.yScale = 1.0f; ccb.show = true; ccb.curveIdx = i; curveCtrlBlocks.Add(cbts[i], ccb); } }
private void UpdateBtn_Click(object sender, RoutedEventArgs e) { if (LastSelectedCbts == null) { return; } CurveCtrlBlock ccb = (CurveCtrlBlock)curveCtrlBlocks[LastSelectedCbts]; float y_scale = float.Parse(this.y_scale_txt.Text); double y_offset = float.Parse(this.y_offset_txt.Text); float x_scale = float.Parse(this.x_scale_txt.Text); ccb.yScale = y_scale; ccb.yOffset = y_offset; ccb.xScale = x_scale; this.curveView.SetCurveScale(ccb.curveIdx, y_scale, x_scale); this.curveView.SetCurveOffset(ccb.curveIdx, y_offset, 0); CurveUpdate(); }