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.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace ScintillaNet
{
[TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class Selection : ScintillaHelperBase
{
protected internal Selection(Scintilla scintilla) : base(scintilla)
{
NativeScintilla.SetSelBack(true, Utilities.ColorToRgb(BackColor));
NativeScintilla.SetSelFore(true, Utilities.ColorToRgb(ForeColor));
}
internal bool ShouldSerialize()
{
return ShouldSerializeBackColor() |
ShouldSerializeBackColorUnfocused() |
ShouldSerializeForeColor() |
ShouldSerializeForeColorUnfocused() |
ShouldSerializeHidden() |
ShouldSerializeHideSelection() |
ShouldSerializeMode();
}
#region Non-designable Properties
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Range Range
{
get
{
return new Range(NativeScintilla.GetSelectionStart(), NativeScintilla.GetSelectionEnd(), Scintilla);
}
set
{
NativeScintilla.SetSel(value.Start, value.End);
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Start
{
get
{
return NativeScintilla.GetSelectionStart();
}
set
{
NativeScintilla.SetSelectionStart(value);
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int End
{
get
{
return NativeScintilla.GetSelectionEnd();
}
set
{
NativeScintilla.SetSelectionEnd(value);
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Length
{
get
{
return Math.Abs(End - Start);
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Text
{
get
{
string s;
NativeScintilla.GetSelText(out s);
return s;
}
set
{
if(string.IsNullOrEmpty(value))
Clear();
else
NativeScintilla.ReplaceSel(value);
}
}
#endregion
#region Designable Properties
#region ForeColor
public Color ForeColor
{
get
{
if (Scintilla.ColorBag.ContainsKey("Selection.ForeColor"))
return Scintilla.ColorBag["Selection.ForeColor"];
return SystemColors.HighlightText;
}
set
{
if (ForeColor == SystemColors.HighlightText)
Scintilla.ColorBag.Remove("Selection.ForeColor");
else
Scintilla.ColorBag["Selection.ForeColor"] = value;
if (Scintilla.ContainsFocus)
NativeScintilla.SetSelFore(true, Utilities.ColorToRgb(value));
}
}
private bool ShouldSerializeForeColor()
{
return ForeColor != SystemColors.HighlightText;
}
private void ResetForeColor()
{
ForeColor = SystemColors.HighlightText;
}
#endregion
#region ForeColorUnfocused
public Color ForeColorUnfocused
{
get
{
if (Scintilla.ColorBag.ContainsKey("Selection.ForeColorUnfocused"))
return Scintilla.ColorBag["Selection.ForeColorUnfocused"];
return SystemColors.HighlightText;
}
set
{
if (value == ForeColorUnfocused)
return;
if (ForeColorUnfocused == SystemColors.HighlightText)
Scintilla.ColorBag.Remove("Selection.ForeColorUnfocused");
else
Scintilla.ColorBag["Selection.ForeColorUnfocused"] = value;
if(!Scintilla.ContainsFocus)
NativeScintilla.SetSelFore(true, Utilities.ColorToRgb(value));
}
}
private bool ShouldSerializeForeColorUnfocused()
{
return ForeColorUnfocused != SystemColors.HighlightText;
}
private void ResetForeColorUnfocused()
{
ForeColorUnfocused = SystemColors.HighlightText;
}
#endregion
#region BackColorUnfocused
private Color _backColorUnfocused = Color.LightGray;
public Color BackColorUnfocused
{
get
{
if (Scintilla.ColorBag.ContainsKey("Selection.BackColorUnfocused"))
return Scintilla.ColorBag["Selection.BackColorUnfocused"];
return Color.LightGray;
}
set
{
if (value == BackColorUnfocused)
return;
if (BackColorUnfocused == Color.LightGray)
Scintilla.ColorBag.Remove("Selection.BackColorUnfocused");
else
Scintilla.ColorBag["Selection.BackColorUnfocused"] = value;
if(!Scintilla.ContainsFocus)
NativeScintilla.SetSelBack(true, Utilities.ColorToRgb(value));
}
}
private bool ShouldSerializeBackColorUnfocused()
{
return BackColorUnfocused != Color.LightGray;
}
private void ResetBackColorUnfocused()
{
BackColorUnfocused = Color.LightGray;
}
#endregion
#region BackColor
public Color BackColor
{
get
{
if (Scintilla.ColorBag.ContainsKey("Selection.BackColor"))
return Scintilla.ColorBag["Selection.BackColor"];
return SystemColors.Highlight;
}
set
{
if (value == BackColor)
return;
if (BackColor == SystemColors.Highlight)
Scintilla.ColorBag.Remove("Selection.BackColor");
else
Scintilla.ColorBag["Selection.BackColor"] = value;
if (Scintilla.ContainsFocus)
NativeScintilla.SetSelBack(true, Utilities.ColorToRgb(value));
}
}
private bool ShouldSerializeBackColor()
{
return BackColor != SystemColors.Highlight;
}
private void ResetBackColor()
{
BackColor = SystemColors.Highlight;
}
#endregion
#region Hidden
private bool _hidden = false;
public bool Hidden
{
get
{
return _hidden;
}
set
{
_hidden = value;
NativeScintilla.HideSelection(value);
}
}
private bool ShouldSerializeHidden()
{
return _hidden;
}
private void ResetHidden()
{
Hidden = false;
}
#endregion
#region HideSelection
private bool _hideSelection = false;
public bool HideSelection
{
get
{
return _hideSelection;
}
set
{
_hideSelection = value;
if (!Scintilla.ContainsFocus)
NativeScintilla.HideSelection(value);
}
}
private bool ShouldSerializeHideSelection()
{
return _hideSelection;
}
private void ResetHideSelection()
{
_hideSelection = false;
}
#endregion
#region Mode
public SelectionMode Mode
{
get
{
return (SelectionMode)NativeScintilla.GetSelectionMode();
}
set
{
NativeScintilla.SetSelectionMode((int)value);
}
}
private bool ShouldSerializeMode()
{
return Mode != SelectionMode.Stream;
}
private void ResetMode()
{
Mode = SelectionMode.Stream;
}
#endregion
[Browsable(false)]
public bool IsRectangle
{
get
{
return NativeScintilla.SelectionIsRectangle();
}
}
#endregion
#region Methods
public void SelectAll()
{
NativeScintilla.SelectAll();
}
public void SelectNone()
{
NativeScintilla.SetSel(-1, -1);
}
public void Clear()
{
NativeScintilla.Clear();
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of use 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.
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