Click here to Skip to main content
15,885,216 members
Articles / Desktop Programming / Windows Forms

C# and VB.NET Code Searcher - Using Roslyn

Rate me:
Please Sign up or sign in to vote.
4.84/5 (51 votes)
7 Mar 2013LGPL314 min read 200K   5.6K   130  
A fast C# and VB.NET code searcher using Roslyn.
using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;

namespace KRBTabControl
{
    partial class KRBTabControl
    {
        public class SelectedIndexChangingEventArgs : EventArgs, IDisposable
        {
            #region Instance Member

            private bool cancel = false;
            private int tabPageIndex = -1;
            private TabPageEx tabPage = null;

            #endregion

            #region Constructor

            public SelectedIndexChangingEventArgs(TabPageEx tabPage, int tabPageIndex)
            {
                this.tabPage = tabPage;
                this.tabPageIndex = tabPageIndex;
            }

            #endregion

            #region Property

            /// <summary>
            /// Gets or sets a value indicating whether the event should be canceled.
            /// </summary>
            public bool Cancel
            {
                get { return cancel; }
                set
                {
                    if (!value.Equals(cancel))
                        cancel = value;
                }
            }

            /// <summary>
            /// Gets the zero-based index of the TabPageEx in the KRBTabControl.TabPages collection.
            /// </summary>
            public int TabPageIndex
            {
                get { return tabPageIndex; }
            }

            /// <summary>
            /// Gets the TabPageEx the event is occurring for.
            /// </summary>
            public TabPageEx TabPage
            {
                get { return tabPage; }
            }

            #endregion

            #region IDisposable Members

            void IDisposable.Dispose()
            {
                GC.SuppressFinalize(this);
            }

            #endregion
        }

        public class ContextMenuShownEventArgs : EventArgs, IDisposable
        {
            #region Instance Member

            private ContextMenuStrip contextMenu = null;
            private Point menuLocation = Point.Empty;

            #endregion

            #region Constructor

            public ContextMenuShownEventArgs(ContextMenuStrip contextMenu, Point menuLocation)
            {
                this.contextMenu = contextMenu;
                this.menuLocation = menuLocation;
            }

            #endregion

            #region Property

            /// <summary>
            /// Gets the drop-down menu of the control.It shows when a user clicks the drop-down icon on the caption.
            /// </summary>
            public ContextMenuStrip ContextMenu
            {
                get { return contextMenu; }
            }

            /// <summary>
            /// Gets or sets the drop-down menu location on the screen coordinates.
            /// </summary>
            public Point MenuLocation
            {
                get { return menuLocation; }
                set 
                { 
                    menuLocation = value;
                }
            }

            #endregion

            #region IDisposable Members

            void IDisposable.Dispose()
            {
                GC.SuppressFinalize(this);
            }

            #endregion
        }
    }
}

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 GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior)
Netherlands Netherlands
Languages: C#, ASP.NET, HTML, VB, Javascript.
Tools: Visual Studio 2010, 2012.
Databases: MS SQL Server, Oracle, SQLite.
Skills: MCPD Web Developer 4.0, MCSD 2.0
Likes: Solving problems at projecteuler.net. at #66 now.
Technologies:C#, Azure, Xamarin.iOS, Web API, T/SQL, PL/SQL, MSBuild, WIX, XSLT, WPF, WCF, JavaScript

I have been a programmer since 1995. At first at school where we had a computer club with nice Aster CT-80 (TRS-80 clone) computers and 1 MSX computer where I learned to program in BASIC. Later I had my own 8086 XT computer.
My first experience with programming was way before that when I was about 8. A friend of mine had a Commodore 64. He typed over a BASIC game from a computing magazine. The program worked but it contained an error. The thing he did was go to the source line that caused the error, deleted the line, and restarted the program. It worked every time he got an error...

Comments and Discussions