private string GetCurrentFormatValue(string text, int baseNum, TempoVisMode mode) { if (mode == TempoVisMode.DECIMAL) { return(Convert.ToInt16(text, baseNum).ToString()); } else { return(String.Format("0x{0:X}", (Int16.Parse(text)))); } }
public FormCalculator(int bpm, int lpb) { InitializeComponent(); currentMode = TempoVisMode.DECIMAL; this.nudBPM.Value = bpm; this.nudLPB.Value = lpb; this.nudTPR.Value = 6; MatchRenoiseSpeedByTPR(); }
private void btnDecHex_Click(object sender, EventArgs e) { if (currentMode == TempoVisMode.DECIMAL) { currentMode = TempoVisMode.HEX; this.btnDecHex.Text = "Dec"; } else { currentMode = TempoVisMode.DECIMAL; this.btnDecHex.Text = "Hex"; } //this.nudBPM.Value = GetCurrentFormatValue(this.nudBPM.Value, 16); //this.nudTempo.Text = GetCurrentFormatValue(this.nudTempo.Value, 16); //this.nudBPM.Hexadecimal = (currentMode == TempoVisMode.HEX); //this.nudTempo.Hexadecimal = (currentMode == TempoVisMode.HEX); this.nudBPM.Hexadecimal = !this.nudBPM.Hexadecimal; this.nudTempo.Hexadecimal = !this.nudTempo.Hexadecimal; }