Click here to Skip to main content
12,508,014 members (54,248 online)
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads

Stats

221K views
8.2K downloads
284 bookmarked
Posted

Window Tabifier

, 29 Mar 2008 CPOL
A simple application for hosting several Windows in one parent window
WindowTabifier_demo
About.dll
DragAndDropFileComponent.dll
TabStrip.dll
Window Tabifier.exe
Window Tabifier
Window Tabifier
bin
DLL's
About.dll
DragAndDropFileComponent.dll
TabStrip.dll
documents-32x32.png
folder-documents.ico
Properties
Thumbs.db
Window Tabifier.csproj.user
Window.cd
Windows-Desktop-32x32.png
WindowTabifier_srcVS2005
Window Tabifier
bin
DLLs
About.dll
DragAndDropFileComponent.dll
TabStrip.dll
documents-32x32.png
Properties
Resources
folder-documents.ico
Thumbs.db
Thumbs.db
Window Tabifier.csproj.user
window.cd
Windows-Desktop-32x32.png
WindowTabifier_srcVS2008
Window Tabifier
bin
DLLs
About.dll
DragAndDropFileComponent.dll
TabStrip.dll
documents-32x32.png
folder-documents.ico
Properties
Thumbs.db
Window Tabifier.csproj.user
window.cd
Windows-Desktop-32x32.png
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace WindowTabifier
{
    public partial class WindowList : Form
    {
        List<window> windows = new List<window>();

        private List<window> selected;

        public List<window> SelectedWindows
        {
            get { return selected; }
            set { selected = value; }
        }

        public WindowList()
        {
            InitializeComponent();
        }
        
        #region EventHandlers

        private void filterBox_TextChanged(object sender, EventArgs e)
        {
            Display(filterBox.Text);
        }

        private void WindowList_Load(object sender, EventArgs e)
        {
            GetWindows();
            Display("");
        }

        private void OKButton_Click(object sender, EventArgs e)
        {
            int count = List.CheckedIndices.Count;

            List<window> copy = windows.FindAll(delegate(window wnd) { return wnd.Title.Contains(filterBox.Text); });
            selected = new List<window>(count);

            for (int i = 0; i < count; i++)
            {
                selected.Add(copy[List.CheckedIndices[i]]);
            }
        }

        private void refreshToolStripButton_Click(object sender, EventArgs e)
        {
            GetWindows();
            Display(filterBox.Text);
        }

        private void CheckAllToolStripButton_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < List.Items.Count; i++)
            {
                List.SetItemChecked(i, true);
            }
        }

        private void ClearallToolStripButton_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < List.Items.Count; i++)
            {
                List.SetItemChecked(i, false);
            }
        }

        #endregion

        private void GetWindows()
        {
            if (Properties.Settings.Default.Ignore)
            {
                windows=window.GetOpenWindows().FindAll(delegate(window wnd) {return wnd.Title.Length>0&& wnd.GetExecutablePath()!=Application.ExecutablePath;});
            }
            else
            {
                windows=window.GetOpenWindows().FindAll(delegate(window wnd) {return wnd.GetExecutablePath()!=Application.ExecutablePath;});
            }
        }

        private void Display(string filter)
        {
            List.Items.Clear();

            List<window> copy = windows.FindAll(delegate(window wnd) { return wnd.Title.Contains(filter); });

            foreach (window wnd in copy)
            {
                List.Items.Add(wnd.Title);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Giorgi Dalakishvili
Software Developer
Georgia Georgia
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160927.1 | Last Updated 29 Mar 2008
Article Copyright 2008 by Giorgi Dalakishvili
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid