{
this.SetDropdownFormLocation();
}
+
}
}
\ No newline at end of file
private void InitializeComponent()
{
this.icon = new System.Windows.Forms.PictureBox();
+ this.label = new System.Windows.Forms.Label();
this.textBox = new Lugens.Components.AutoCompleteTextBox();
((System.ComponentModel.ISupportInitialize)(this.icon)).BeginInit();
this.SuspendLayout();
this.icon.TabIndex = 1;
this.icon.TabStop = false;
//
+ // label
+ //
+ this.label.AutoSize = true;
+ this.label.Cursor = System.Windows.Forms.Cursors.IBeam;
+ this.label.Enabled = false;
+ this.label.Location = new System.Drawing.Point(26, 6);
+ this.label.Name = "label";
+ this.label.Size = new System.Drawing.Size(35, 12);
+ this.label.TabIndex = 2;
+ this.label.Text = "label1";
+ //
// textBox
//
this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox.ShowableDropdownList = true;
this.textBox.Size = new System.Drawing.Size(180, 19);
this.textBox.TabIndex = 0;
+ this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged);
//
// SearchTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Window;
+ this.Controls.Add(this.label);
this.Controls.Add(this.icon);
this.Controls.Add(this.textBox);
this.Name = "SearchTextBox";
private AutoCompleteTextBox textBox;
private System.Windows.Forms.PictureBox icon;
+ private System.Windows.Forms.Label label;
}
}
[Description("背景色です。")]
public Color FillBackColor { get { return fillBackColor; } set { fillBackColor = value; } }
+ [Category("表示")]
+ [Description("ラベルのテキストです。")]
+ public string LabelText { get { return this.label.Text; } set { this.label.Text = value; } }
+
+ [Category("表示")]
+ [Description("ラベルのフォントです。")]
+ public Font LabelFont { get { return this.label.Font; } set { this.label.Font = value; } }
+
public AutoCompleteTextBox TextBox { get { return textBox; } }
public PictureBox Icon { get { return this.icon; } }
-
-
public SearchTextBox()
{
InitializeComponent();
this.textBox.Width = this.Width - 25;
this.Invalidate();
}
+
+ private void textBox_TextChanged(object sender, EventArgs e)
+ {
+ this.label.Visible = String.IsNullOrEmpty(this.textBox.Text);
+ }
}
}
public SearchTextBox SearchTextBox { get { return searchTextBox; } }
/// <summary>
+ /// 現在選択中の検索エンジン
+ /// </summary>
+ private string SelectedEngine;
+
+ /// <summary>
/// ツールチップ表示用
/// </summary>
private string dropdownListBoxText = "";
//
// TODO: InitializeComponent 呼び出しの後に、コンストラクタ コードを追加してください。
//
+ //this.searchTextBox.TextBox.BackTextColor = System.Drawing.SystemColors.Control;
+ //this.searchTextBox.TextBox.BackTextFont = this.searchTextBox.TextBox.Font;
+ //this.searchTextBox.TextBox.BackText = "コマンドを入力してください";
this.searchTextBox.TextBox.Complement += new Lugens.Components.AutoCompleteTextBox.ComplementEventHandler(this.textBox_cmd_Complement);
this.searchTextBox.TextBox.TextChanged += new System.EventHandler(this.textBox_cmd_TextChanged);
this.searchTextBox.TextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_cmd_KeyDown);
//
this.searchTextBox.BackColor = System.Drawing.Color.Transparent;
this.searchTextBox.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(157)))), ((int)(((byte)(185)))));
+ this.searchTextBox.FillBackColor = System.Drawing.Color.White;
+ this.searchTextBox.ForeColor = System.Drawing.SystemColors.WindowText;
this.searchTextBox.Location = new System.Drawing.Point(9, 4);
this.searchTextBox.Name = "searchTextBox";
this.searchTextBox.Size = new System.Drawing.Size(205, 25);
return ret;
}
+
+ /// <summary>
+ /// 検索エンジンを変更
+ /// </summary>
+ /// <param name="info"></param>
+ public void SetSearchEngine(EngineInfo info)
+ {
+ this.SelectedEngine = info.Name;
+ this.SearchTextBox.LabelText = info.Display;
+ this.SearchTextBox.Icon.Image = info.Icon;
+ this.SearchTextBox.Invalidate();
+ }
+
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
this.searchTextBox.TextBox.Text = "";
this.searchTextBox.TextBox.ShowableDropdownList = false;
this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
+ this.SetSearchEngine(Program.HotKeyEngineDic[4176]);
this.timer1.Stop();
}
}
command = commands[commands.Length - 1];
this.searchTextBox.TextBox.DropdownForm.DropdownListBox.Items.Clear();
- //this.searchTextBox.a
if (filter && command.Equals(""))
{
this.searchTextBox.TextBox.DropdownForm.DoVisibleChange(false);
if (Program.HotKeyEngineDic.ContainsKey(KeyboardHook.Keycode))
{
EngineInfo info = Program.HotKeyEngineDic[KeyboardHook.Keycode];
- searchTextBox.Icon.Image = info.Icon;
- searchTextBox.Invalidate();
+ this.SetSearchEngine(info);
e.Handled = true;
return;
}
break;
case Keys.Down:
- if (!this.SearchTextBox.TextBox.DropdownForm.Visible)
+ if ((Keys.Control & Control.ModifierKeys) == Keys.Control)
+ {
+ }
+ else
{
- if (Program.CommandHistoryIndex > 0)
+ if (!this.SearchTextBox.TextBox.DropdownForm.Visible)
{
- Program.CommandHistoryIndex--;
- this.showDropdownSupport = false;
- if (Program.CommandHistoryIndex == 0)
- this.SearchTextBox.TextBox.Text = "";
+ if (Program.CommandHistoryIndex > 0)
+ {
+ Program.CommandHistoryIndex--;
+ this.showDropdownSupport = false;
+ if (Program.CommandHistoryIndex == 0)
+ this.SearchTextBox.TextBox.Text = "";
+ else
+ this.SearchTextBox.TextBox.Text = Program.CommandHistoryList[Program.CommandHistoryIndex - 1];
+ this.SearchTextBox.TextBox.SelectionStart = this.SearchTextBox.TextBox.Text.Length;
+ this.showDropdownSupport = true;
+ }
else
- this.SearchTextBox.TextBox.Text = Program.CommandHistoryList[Program.CommandHistoryIndex - 1];
- this.SearchTextBox.TextBox.SelectionStart = this.SearchTextBox.TextBox.Text.Length;
- this.showDropdownSupport = true;
- }
- else
- {
- this.ShowDropdownForm(false);
+ {
+ this.ShowDropdownForm(false);
+ }
}
}
break;
}
}
+
+ /// <summary>
+ /// 検索エンジンリスト読み込み
+ /// </summary>
+ /// <returns></returns>
public static bool ReadEngineList()
{
string file = null;
Program.EngineList.Clear();
Program.HotKeyEngineDic.Clear();
+ //デフォルトのエンジンを追加
+ info.Name = "Passer";
+ info.Type = 0;
+ info.Shortcut = 4176; //RControl + P
+ info.Icon = Properties.Resources.engine_command;
+ info.Display = "コマンドを入力してください";
+ Program.EngineList.Add(info.Name);
+ Program.HotKeyEngineDic.Add(info.Shortcut, info);
+
try
{
using (reader = new XmlTextReader(file))
if (reader.LocalName.Equals("Icon"))
{
reader.Read();
- info.Icon = Image.FromFile(reader.Value);
+ try
+ {
+ info.Icon = Image.FromFile(reader.Value);
+ }
+ catch{}
continue;
}
if (reader.LocalName.Equals("Display"))
}
else if (reader.LocalName.Equals("Engine"))
{
+ info.Type = 2;
Program.EngineList.Add(info.Name);
Program.HotKeyEngineDic.Add(info.Shortcut, info);
}
public string Name;
/// <summary>
+ /// タイプ(0.COMMAND 1.LOCAL_SEARCH 2.WEB_SEARCH)
+ /// </summary>
+ public int Type;
+
+ /// <summary>
/// URL
/// </summary>
public string Url;
/// </summary>
public string Comment;
- /// <summary>
- /// アイコン
- /// </summary>
- public Icon ApplicationIcon;
}
public class KeyRecordInfo