protected override bool ProcessDialogKey(Keys keyData)
{
//TextBox1でEnterを押してもビープ音が鳴らないようにする
if ((keyData & Keys.KeyCode) == Keys.Enter)
{
if (StatusText.Focused)
{
bool _NewLine = false;
bool _Post = false;
if (this._cfgCommon.PostCtrlEnter) //Ctrl+Enter投稿時
{
if (StatusText.Multiline)
{
if ((keyData & Keys.Shift) == Keys.Shift && (keyData & Keys.Control) != Keys.Control) _NewLine = true;
if ((keyData & Keys.Control) == Keys.Control) _Post = true;
}
else
{
if (((keyData & Keys.Control) == Keys.Control)) _Post = true;
}
}
else if (this._cfgCommon.PostShiftEnter) //SHift+Enter投稿時
{
if (StatusText.Multiline)
{
if ((keyData & Keys.Control) == Keys.Control && (keyData & Keys.Shift) != Keys.Shift) _NewLine = true;
if ((keyData & Keys.Shift) == Keys.Shift) _Post = true;
}
else
{
if (((keyData & Keys.Shift) == Keys.Shift)) _Post = true;
}
}
else //Enter投稿時
{
if (StatusText.Multiline)
{
if ((keyData & Keys.Shift) == Keys.Shift && (keyData & Keys.Control) != Keys.Control) _NewLine = true;
if (((keyData & Keys.Control) != Keys.Control && (keyData & Keys.Shift) != Keys.Shift) ||
((keyData & Keys.Control) == Keys.Control && (keyData & Keys.Shift) == Keys.Shift)) _Post = true;
}
else
{
if (((keyData & Keys.Shift) == Keys.Shift) ||
(((keyData & Keys.Control) != Keys.Control) &&
((keyData & Keys.Shift) != Keys.Shift))) _Post = true;
}
}
if (_NewLine)
{
int pos1 = StatusText.SelectionStart;
if (StatusText.SelectionLength > 0)
{
StatusText.Text = StatusText.Text.Remove(pos1, StatusText.SelectionLength); //選択状態文字列削除
}
StatusText.Text = StatusText.Text.Insert(pos1, Environment.NewLine); //改行挿入
StatusText.SelectionStart = pos1 + Environment.NewLine.Length; //カーソルを改行の次の文字へ移動
return true;
}
else if (_Post)
{
PostButton_Click(null, null);
return true;
}
}
else if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch &&
(ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focused ||
ListTab.SelectedTab.Controls["panelSearch"].Controls["comboLang"].Focused))
{
this.SearchButton_Click(ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"], null);
return true;
}
}
return base.ProcessDialogKey(keyData);
}