Click here to Skip to main content
11,629,614 members (71,411 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
Add your own
alternative version

CodeDom Assistant

, 21 Sep 2007 81.6K 4.9K 76
Generating CodeDom Code By Parsing C# or VB
codedomassistant_demo.zip
CodeDomAssistant_Demo
CodeDomAssistant.exe
ICSharpCode.NRefactory.dll
RemoteLoader.dll
SciLexer.dll
ScintillaNet.dll
codedomassistant_src.zip
sln.CodeDomAssistant
CodeDomAssistant
bin
Debug
SciLexer.dll
Properties
Settings.settings
NRefactory
NRefactoryASTGenerator
AST
Project
Configuration
Resources
ICSharpCode.NRefactory.snk
Src
Ast
General
Lexer
BuildKeywords.pl
CSharp
Special
VBNet
Parser
CSharp
cs.ATG
Frames
Parser.frame
Scanner.frame
SharpCoco.exe
VBNet
VBNET.ATG
PrettyPrinter
CSharp
VBNet
Visitors
Test
General
Lexer
CSharp
VBNet
Output
CodeDOM
CSharp
VBNet
Parser
Expressions
GlobalScope
Statements
TypeLevel
RemoteLoader
Properties
ScintillaNET
Configuration
Builtin
LexerKeywordListNames
LexerStyleNames
FindReplace
Printing
Properties
Resources
DeleteHS.png
GoToNextMessage - Copy.png
GoToNextMessage.png
GoToPreviousMessage.png
LineColorHS.png
Thumbs.db
ScintillaNET.csproj.vspscc
Snippets
using System;
using System.Runtime.InteropServices;
using System.Drawing;
namespace ScintillaNet
{			
	[StructLayout(LayoutKind.Sequential)]
	public struct CharacterRange 
	{
		public int cpMin;
		public int cpMax;
	}

	[StructLayout(LayoutKind.Sequential)]
	public struct TextRange 
	{
		public CharacterRange chrg;
		public IntPtr lpstrText;
	}

	[StructLayout(LayoutKind.Sequential)]
	public struct TextToFind 
	{
		public CharacterRange chrg;			// range to search
		public IntPtr lpstrText;			// the search pattern (zero terminated)
		public CharacterRange chrgText;		// returned as position of matching text
	}

	/// <summary>
	/// Struct used for passing parameters to FormatRange()
	/// </summary>
	[StructLayout(LayoutKind.Sequential)]
	public struct RangeToFormat
	{
		/// <summary>
		/// The HDC (device context) we print to
		/// </summary>
		public IntPtr hdc;
		/// <summary>
		/// The HDC we use for measuring (may be same as hdc)
		/// </summary>
		public IntPtr hdcTarget;
		/// <summary>
		/// Rectangle in which to print
		/// </summary>
		public PrintRectangle rc;
		/// <summary>
		/// Physically printable page size
		/// </summary>
		public PrintRectangle rcPage;
		/// <summary>
		/// Range of characters to print
		/// </summary>
		public CharacterRange chrg;
	}

	/// <summary>
	/// Struct used for specifying the printing bounds
	/// </summary>
	[StructLayout(LayoutKind.Sequential)]
	public struct PrintRectangle
	{
		/// <summary>
		/// Left X Bounds Coordinate
		/// </summary>
		public int Left;
		/// <summary>
		/// Top Y Bounds Coordinate
		/// </summary>
		public int Top;
		/// <summary>
		/// Right X Bounds Coordinate
		/// </summary>
		public int Right;
		/// <summary>
		/// Bottom Y Bounds Coordinate
		/// </summary>
		public int Bottom;

		public PrintRectangle(int iLeft, int iTop, int iRight, int iBottom)
		{
			Left = iLeft;
			Top = iTop;
			Right = iRight;
			Bottom = iBottom;
		}
	}


	/// <summary>
	/// This matches the Win32 NMHDR structure
	/// </summary>
	[StructLayout(LayoutKind.Sequential)]
	public struct NotifyHeader
	{
		public IntPtr hwndFrom;	// environment specific window handle/pointer
		public IntPtr idFrom;	// CtrlID of the window issuing the notification
		public uint code;		// The SCN_* notification code
	}

	[StructLayout(LayoutKind.Sequential)]
	public struct SCNotification
	{
		public NotifyHeader nmhdr;
		public int position;			// SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND, 
										// SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
		public char ch;					// SCN_CHARADDED, SCN_KEY
		public int modifiers;			// SCN_KEY
		public int modificationType;	// SCN_MODIFIED
		public IntPtr text;				// SCN_MODIFIED
		public int length;				// SCN_MODIFIED
		public int linesAdded;			// SCN_MODIFIED
		public int message;				// SCN_MACRORECORD
		public IntPtr wParam;			// SCN_MACRORECORD
		public IntPtr lParam;			// SCN_MACRORECORD
		public int line;				// SCN_MODIFIED
		public int foldLevelNow;		// SCN_MODIFIED
		public int foldLevelPrev;		// SCN_MODIFIED
		public int margin;				// SCN_MARGINCLICK
		public int listType;			// SCN_USERLISTSELECTION
		public int x;					// SCN_DWELLSTART, SCN_DWELLEND
		public int y;					// SCN_DWELLSTART, SCN_DWELLEND
	}

	[Serializable, StructLayout(LayoutKind.Sequential)]
	public struct RECT
	{
		public int Left;
		public int Top;
		public int Right;
		public int Bottom;

		public RECT(int left_, int top_, int right_, int bottom_)
		{
			Left = left_;
			Top = top_;
			Right = right_;
			Bottom = bottom_;
		}

		public int Height { get { return Bottom - Top; } }
		public int Width { get { return Right - Left; } }
		public Size Size { get { return new Size(Width, Height); } }

		public Point Location { get { return new Point(Left, Top); } }

		// Handy method for converting to a System.Drawing.Rectangle
		public Rectangle ToRectangle()
		{ return Rectangle.FromLTRB(Left, Top, Right, Bottom); }

		public static RECT FromRectangle(Rectangle rectangle)
		{
			return new RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom);
		}

		public override int GetHashCode()
		{
			return Left ^ ((Top << 13) | (Top >> 0x13))
			  ^ ((Width << 0x1a) | (Width >> 6))
			  ^ ((Height << 7) | (Height >> 0x19));
		}

		#region Operator overloads

		public static implicit operator Rectangle(RECT rect)
		{
			return rect.ToRectangle();
		}

		public static implicit operator RECT(Rectangle rect)
		{
			return FromRectangle(rect);
		}

		#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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

raygilbert
Web Developer
Australia Australia
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150723.1 | Last Updated 21 Sep 2007
Article Copyright 2007 by raygilbert
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid