AmandaInterface.FileManagerTabControl._MouseClick C# (CSharp) Method

_MouseClick() private method

private _MouseClick ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
return void
        void _MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Middle)
            {
                // Find out which tab has been clicked & close that file.
                //
                for (int i = 0; i < TabCount; i++)
                {
                    if (GetTabRect(i).Contains(e.X, e.Y))
                    {
                        CloseFile((FileEditorTab)TabPages[i]);
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                // Left click already sets the target tab to selected so no need to do the stuff we do for the middle mouse button (looping through all the tabs)
                //
                int tabIndex = TabPages.IndexOf(SelectedTab);
                Rectangle r = ConvertRectangleBounds_CloseButton(GetTabRect(tabIndex));

                if (r.Contains(e.Location))
                {
                    CloseFile(this.SelectedFileTab);
                    SelectedIndex = tabIndex;
                }
            }
        }