示例#1
0
 private void BTN_Searching_Click(object sender, EventArgs e)      //Searching for Publish Year Button
 {
     Book[] books;
     books = BooksFunctions.Search(yearsearch, 1);                 //to call searching function of the book by the Publish Year
     if (books == null)
     {
         MessageBox.Show("This Book is not found");
         TXT_Searching.Text = "";
     }
     else
     {
         string[] Lines = new string[(books.Length * 5) - 1];      //Array of strings to Put each field in a line with a seperator between each record
         int      index = 0;
         for (int i = 0; i < books.Length; i++)                    //Loop to put each field in the string array inorder to display them
         {
             Lines[index++] = "Serial Number: " + books[i].serialNo;
             Lines[index++] = "Book Name: " + books[i].bookName;
             Lines[index++] = "Publish Year: " + books[i].publishYear;
             Lines[index++] = "Author Number: " + books[i].authorNo;
             if (i != books.Length - 1)                              //to handle the last record inorder not to display seperator line after the last record
             {
                 Lines[index++] = "----------------------------------------";
             }
         }
         TXT_Searching.Lines = Lines;                                //function Searching.Lines is to put each single element in the array in a single line
         SearchingTextBox.Focus();                                   //To Handle a problem occurred when Displaying The Books inorder to change the mouse focus after displaying
     }
 }
示例#2
0
        private void Initialize()
        {
            this._searchBox = new SearchingTextBox();

            this._searchBox.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this._searchBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this._searchBox.ForeColor   = System.Drawing.Color.White;

            this._searchBox.TabIndex = 1;
            this._searchBox.Visible  = false;
            //Controls.Add(_searchBox);

            this._searchBox.KeyDown     += new KeyEventHandler(_searchBox_KeyDown);
            this._searchBox.TextChanged += new EventHandler(_searchBox_TextChanged);
            this._searchBox.Leave       += new EventHandler(_searchBox_Leave);
        }
示例#3
0
 private void SearchingHintTextBlock_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     SearchingTextBox.Focus();
 }
        private void Initialize()
        {
            this._searchBox = new SearchingTextBox();

            this._searchBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            this._searchBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this._searchBox.ForeColor = System.Drawing.Color.White;

            this._searchBox.TabIndex = 1;
            this._searchBox.Visible = false;
            //Controls.Add(_searchBox);

            this._searchBox.KeyDown += new KeyEventHandler(_searchBox_KeyDown);
            this._searchBox.TextChanged += new EventHandler(_searchBox_TextChanged);
            this._searchBox.Leave += new EventHandler(_searchBox_Leave);
        }