本文整理汇总了C#中ScintillaNet.ScintillaControl.SetYCaretPolicy方法的典型用法代码示例。如果您正苦于以下问题:C# ScintillaControl.SetYCaretPolicy方法的具体用法?C# ScintillaControl.SetYCaretPolicy怎么用?C# ScintillaControl.SetYCaretPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScintillaNet.ScintillaControl
的用法示例。
在下文中一共展示了ScintillaControl.SetYCaretPolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateControl
/// <summary>
/// Creates a new editor control for the document
/// </summary>
public static ScintillaControl CreateControl(String file, String text, Int32 codepage)
{
ScintillaControl sci = new ScintillaControl();
sci.AutoCSeparator = 32;
sci.AutoCTypeSeparator = 63;
sci.IsAutoCGetAutoHide = true;
sci.IsAutoCGetCancelAtStart = false;
sci.IsAutoCGetChooseSingle = false;
sci.IsAutoCGetDropRestOfWord = false;
sci.IsAutoCGetIgnoreCase = false;
sci.ControlCharSymbol = 0;
sci.CurrentPos = 0;
sci.CursorType = -1;
sci.Dock = System.Windows.Forms.DockStyle.Fill;
sci.DocPointer = 187541976;
sci.EndAtLastLine = 1;
sci.EdgeColumn = 0;
sci.EdgeMode = 0;
sci.IsHScrollBar = true;
sci.IsMouseDownCaptures = true;
sci.IsBufferedDraw = true;
sci.IsOvertype = false;
sci.IsReadOnly = false;
sci.IsUndoCollection = true;
sci.IsVScrollBar = true;
sci.IsUsePalette = true;
sci.IsTwoPhaseDraw = true;
sci.LayoutCache = 1;
sci.Lexer = 3;
sci.Location = new System.Drawing.Point(0, 0);
sci.MarginLeft = 5;
sci.MarginRight = 5;
sci.ModEventMask = (Int32)ScintillaNet.Enums.ModificationFlags.InsertText | (Int32)ScintillaNet.Enums.ModificationFlags.DeleteText | (Int32)ScintillaNet.Enums.ModificationFlags.RedoPerformed | (Int32)ScintillaNet.Enums.ModificationFlags.UndoPerformed;
sci.MouseDwellTime = ScintillaControl.MAXDWELLTIME;
sci.Name = "sci";
sci.PasteConvertEndings = false;
sci.PrintColourMode = (Int32)ScintillaNet.Enums.PrintOption.Normal;
sci.PrintWrapMode = (Int32)ScintillaNet.Enums.Wrap.Word;
sci.PrintMagnification = 0;
sci.SearchFlags = 0;
sci.SelectionEnd = 0;
sci.SelectionMode = 0;
sci.SelectionStart = 0;
sci.SmartIndentType = ScintillaNet.Enums.SmartIndent.CPP;
sci.Status = 0;
sci.StyleBits = 7;
sci.TabIndex = 0;
sci.TargetEnd = 0;
sci.TargetStart = 0;
sci.WrapStartIndent = Globals.Settings.IndentSize;
sci.WrapVisualFlagsLocation = (Int32)ScintillaNet.Enums.WrapVisualLocation.EndByText;
sci.WrapVisualFlags = (Int32)ScintillaNet.Enums.WrapVisualFlag.End;
sci.XOffset = 0;
sci.ZoomLevel = 0;
sci.UsePopUp(false);
sci.SetMarginTypeN(0, 0);
sci.SetMarginWidthN(0, 14);
sci.SetMarginTypeN(1, 1);
sci.SetMarginMaskN(1, 0);
sci.SetMarginTypeN(2, 0);
sci.SetMarginMaskN(2, -33554432 | 1 << 2);
sci.MarginSensitiveN(2, true);
sci.MarkerDefinePixmap(0, XpmBookmark);
sci.SetMarginMaskN(0, MarkerManager.MARKERS);
sci.MarkerDefine(2, ScintillaNet.Enums.MarkerSymbol.Fullrect);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.Folder, ScintillaNet.Enums.MarkerSymbol.BoxPlus);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderOpen, ScintillaNet.Enums.MarkerSymbol.BoxMinus);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderSub, ScintillaNet.Enums.MarkerSymbol.VLine);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderTail, ScintillaNet.Enums.MarkerSymbol.LCorner);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderEnd, ScintillaNet.Enums.MarkerSymbol.BoxPlusConnected);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderOpenMid, ScintillaNet.Enums.MarkerSymbol.BoxMinusConnected);
sci.MarkerDefine((Int32)ScintillaNet.Enums.MarkerOutline.FolderMidTail, ScintillaNet.Enums.MarkerSymbol.TCorner);
sci.SetYCaretPolicy((Int32)(ScintillaNet.Enums.CaretPolicy.Jumps | ScintillaNet.Enums.CaretPolicy.Even), 0);
sci.SetXCaretPolicy((Int32)(ScintillaNet.Enums.CaretPolicy.Even), 0);
sci.CodePage = SelectCodePage(codepage);
sci.Encoding = Encoding.GetEncoding(codepage);
sci.SaveBOM = (sci.CodePage == 65001) && Globals.Settings.SaveUnicodeWithBOM;
sci.Text = text; sci.FileName = file; // Set text and save file name
sci.Modified += new ModifiedHandler(Globals.MainForm.OnScintillaControlModified);
sci.MarginClick += new MarginClickHandler(Globals.MainForm.OnScintillaControlMarginClick);
sci.UpdateUI += new UpdateUIHandler(Globals.MainForm.OnScintillaControlUpdateControl);
sci.URIDropped += new URIDroppedHandler(Globals.MainForm.OnScintillaControlDropFiles);
sci.ModifyAttemptRO += new ModifyAttemptROHandler(Globals.MainForm.OnScintillaControlModifyRO);
String untitledFileStart = TextHelper.GetString("Info.UntitledFileStart");
if (!file.StartsWith(untitledFileStart)) sci.IsReadOnly = FileHelper.FileIsReadOnly(file);
sci.SetFoldFlags((Int32)Globals.Settings.FoldFlags);
sci.EmptyUndoBuffer(); ApplySciSettings(sci);
UITools.Manager.ListenTo(sci);
return sci;
}
示例2: CreateControl
public static ScintillaControl CreateControl( )
{
ScintillaControl sci = new ScintillaControl();
sci.AutoCSeparator = 32;
sci.AutoCTypeSeparator = 63;
sci.IsAutoCGetAutoHide = true;
sci.IsAutoCGetCancelAtStart = false;
sci.IsAutoCGetChooseSingle = false;
sci.IsAutoCGetDropRestOfWord = false;
sci.IsAutoCGetIgnoreCase = false;
sci.ControlCharSymbol = 0;
sci.CurrentPos = 0;
sci.CursorType = -1;
sci.Dock = System.Windows.Forms.DockStyle.Fill;
sci.DocPointer = 187541976;
sci.EndAtLastLine = 1;
sci.EdgeColumn = 0;
sci.EdgeMode = 0;
sci.IsHScrollBar = true;
sci.IsMouseDownCaptures = true;
sci.IsBufferedDraw = true;
sci.IsOvertype = false;
sci.IsReadOnly = false;
sci.IsUndoCollection = true;
sci.IsVScrollBar = true;
sci.IsUsePalette = true;
sci.IsTwoPhaseDraw = true;
sci.LayoutCache = 1;
sci.Lexer = 3;
sci.Location = new System.Drawing.Point(0, 0);
sci.MarginLeft = 0;
sci.MarginRight = 0;
sci.ModEventMask = (Int32)ScintillaNet.Enums.ModificationFlags.InsertText | (Int32)ScintillaNet.Enums.ModificationFlags.DeleteText | (Int32)ScintillaNet.Enums.ModificationFlags.RedoPerformed | (Int32)ScintillaNet.Enums.ModificationFlags.UndoPerformed;
sci.MouseDwellTime = ScintillaControl.MAXDWELLTIME;
sci.Name = "sci";
sci.PasteConvertEndings = false;
sci.PrintColourMode = (Int32)ScintillaNet.Enums.PrintOption.Normal;
sci.PrintWrapMode = (Int32)ScintillaNet.Enums.Wrap.Word;
sci.PrintMagnification = 0;
sci.SearchFlags = 0;
sci.SelectionEnd = 0;
sci.SelectionMode = 0;
sci.SelectionStart = 0;
sci.SmartIndentType = ScintillaNet.Enums.SmartIndent.CPP;
sci.Status = 0;
sci.StyleBits = 7;
sci.TabIndex = 0;
sci.TargetEnd = 0;
sci.TargetStart = 0;
sci.WrapStartIndent = 4;
sci.WrapVisualFlagsLocation = (Int32)ScintillaNet.Enums.WrapVisualLocation.EndByText;
sci.WrapVisualFlags = (Int32)ScintillaNet.Enums.WrapVisualFlag.End;
sci.XOffset = 0;
sci.ZoomLevel = 0;
sci.UsePopUp(true);
sci.SetMarginTypeN(0, 1);
sci.SetMarginMaskN(0, 0);
sci.SetYCaretPolicy((Int32)(ScintillaNet.Enums.CaretPolicy.Jumps | ScintillaNet.Enums.CaretPolicy.Even), 0);
/*try
{
sci.Encoding = Encoding.GetEncoding((Int32)MainForm.Settings.DefaultCodePage);
}
catch(Exception error)
{
sci.Encoding = Encoding.GetEncoding(65001);
}*/
sci.Encoding = Encoding.UTF8;
sci.EmptyUndoBuffer();
ApplySciSettings(sci);
return sci;
}
示例3: ApplySciSettings
public static void ApplySciSettings(ScintillaControl sci, Boolean hardUpdate)
{
try
{
ISettings settings = PluginBase.Settings;
sci.CaretPeriod = settings.CaretPeriod;
sci.CaretWidth = settings.CaretWidth;
sci.EOLMode = LineEndDetector.DetectNewLineMarker(sci.Text, (Int32)settings.EOLMode);
sci.IsBraceMatching = settings.BraceMatchingEnabled;
sci.UseHighlightGuides = !settings.HighlightGuide;
sci.Indent = settings.IndentSize;
sci.SmartIndentType = settings.SmartIndentType;
sci.IsBackSpaceUnIndents = settings.BackSpaceUnIndents;
sci.IsCaretLineVisible = settings.CaretLineVisible;
sci.IsIndentationGuides = settings.ViewIndentationGuides;
sci.IndentView = settings.IndentView;
sci.IsTabIndents = settings.TabIndents;
sci.IsUseTabs = settings.UseTabs;
sci.IsViewEOL = settings.ViewEOL;
sci.ScrollWidth = Math.Max(settings.ScrollWidth, 1);
sci.ScrollWidthTracking = settings.ScrollWidth == 0 || settings.ScrollWidth == 3000;
sci.TabWidth = settings.TabWidth;
sci.ViewWS = Convert.ToInt32(settings.ViewWhitespace);
sci.WrapMode = Convert.ToInt32(settings.WrapText);
sci.SetProperty("fold", Convert.ToInt32(settings.UseFolding).ToString());
sci.SetProperty("fold.comment", Convert.ToInt32(settings.FoldComment).ToString());
sci.SetProperty("fold.compact", Convert.ToInt32(settings.FoldCompact).ToString());
sci.SetProperty("fold.preprocessor", Convert.ToInt32(settings.FoldPreprocessor).ToString());
sci.SetProperty("fold.at.else", Convert.ToInt32(settings.FoldAtElse).ToString());
sci.SetProperty("fold.html", Convert.ToInt32(settings.FoldHtml).ToString());
sci.SetProperty("lexer.cpp.track.preprocessor", "0");
sci.SetVirtualSpaceOptions((Int32)settings.VirtualSpaceMode);
sci.SetFoldFlags((Int32)settings.FoldFlags);
/**
* Set if themes should colorize the first margin
*/
Language language = SciConfig.GetLanguage(sci.ConfigurationLanguage);
if (language != null && language.editorstyle != null)
{
Boolean colorizeMarkerBack = language.editorstyle.ColorizeMarkerBack;
if (colorizeMarkerBack) sci.SetMarginTypeN(0, (Int32)MarginType.Fore);
else sci.SetMarginTypeN(0, (Int32)MarginType.Symbol);
}
/**
* Set correct line number margin width
*/
Boolean viewLineNumbers = settings.ViewLineNumbers;
if (viewLineNumbers) sci.SetMarginWidthN(1, ScaleArea(sci, 36));
else sci.SetMarginWidthN(1, 0);
/**
* Set correct bookmark margin width
*/
Boolean viewBookmarks = settings.ViewBookmarks;
if (viewBookmarks) sci.SetMarginWidthN(0, ScaleArea(sci, 14));
else sci.SetMarginWidthN(0, 0);
/**
* Set correct folding margin width
*/
Boolean useFolding = settings.UseFolding;
if (!useFolding && !viewBookmarks && !viewLineNumbers) sci.SetMarginWidthN(2, 0);
else if (useFolding) sci.SetMarginWidthN(2, ScaleArea(sci, 15));
else sci.SetMarginWidthN(2, ScaleArea(sci, 2));
/**
* Adjust caret policy based on settings
*/
if (settings.KeepCaretCentered)
{
sci.SetXCaretPolicy((Int32)(CaretPolicy.Jumps | CaretPolicy.Even), 30);
sci.SetYCaretPolicy((Int32)(CaretPolicy.Jumps | CaretPolicy.Even), 2);
}
else // Match edge...
{
sci.SetXCaretPolicy((Int32)CaretPolicy.Even, 0);
sci.SetYCaretPolicy((Int32)CaretPolicy.Even, 0);
}
sci.SetVisiblePolicy((Int32)(CaretPolicy.Strict | CaretPolicy.Even), 0);
/**
* Adjust the print margin
*/
sci.EdgeColumn = settings.PrintMarginColumn;
if (sci.EdgeColumn > 0) sci.EdgeMode = 1;
else sci.EdgeMode = 0;
/**
* Add missing ignored keys
*/
foreach (Keys keys in ShortcutManager.AllShortcuts)
{
if (keys != Keys.None && !sci.ContainsIgnoredKeys(keys))
{
sci.AddIgnoredKeys(keys);
}
}
if (hardUpdate)
{
String lang = sci.ConfigurationLanguage;
sci.ConfigurationLanguage = lang;
}
sci.Colourise(0, -1);
sci.Refresh();
}
//.........这里部分代码省略.........