private void SetNumericEnabledStatus(bool value) { for (int i = 0; i < 10; i++) { CwButton btn = tablelayoutNumeric.Controls["bt" + i] as CwButton; if (btn != null) { btn.Enabled = value; } } btnDelete.Enabled = value; }
private void Form1_Load(object sender, EventArgs e) { yeniOyunToolStripMenuItem.Enabled = false; tekrarBaşlatCtrlRToolStripMenuItem.Enabled = false; this.KeyPreview = true; UserProfileStatsGenerator = new UserProfileStatsRecorder(); ActiveGame = new SayiTahminGame(); ActiveGame.GameStarted += ActiveGame_GameStarted; ActiveGame.GameFinished += ActiveGame_GameFinished; ActiveGame.TimeDecreased += ActiveGame_TimeDecreased; ActiveGame.LifeDecreased += ActiveGame_LifeDecreased; ActiveGame.EnteredGuess += ActiveGame_EnteredGuess; phraseComponent1.SetAllControlTextByName(this); phraseComponent1.SetAllBindedControlText(); if (this.CWMode) { this.SetText(GlobalVariants.GameVersion + " (Cyber-Warrior Mode)"); } else { this.SetText(GlobalVariants.GameVersion); } lvStartGame.SetAllColumnsText(); CheckProfile(); createStartGameGroup(); btBack.RoundCorners = true; btBack.RoundedCorners = CWKöşeler.SolAlt | CWKöşeler.SolÜst; btBack.BorderRadius = 15; btRestart.RoundCorners = true; btRestart.RoundedCorners = CWKöşeler.SağAlt | CWKöşeler.SağÜst; btRestart.BorderRadius = 15; rtbHistory.Text = String.GetLangText("STI_GAME_GUESS_HST"); rtbHistory.HeaderVAlign = DikeyHiza.CWDHOrta; rtbHistory.HeaderHAlign = YatayHiza.CWYHOrta; for (int i = 0; i < 10; i++) { CwButton btn = tablelayoutNumeric.Controls["bt" + i] as CwButton; if (btn != null) { btn.Click += btnNumericsClick; } } }
private void btnNumericsClick(object sender, EventArgs e) { if (txtInput.Text.Length >= txtInput.MaxLength) { txtInput.Focus(); return; } CwButton btn = sender as CwButton; if (btn == null) { return; } int bnum = int.Parse(btn.Name.Substring((2))); txtInput.SelectedText += bnum; txtInput.Focus(); }