๋ฐ˜์‘ํ˜•

์ƒ˜ํ”Œ ์ฝ”๋“œ๋Š” ๋ณธ๋ฌธ ํ•˜๋‹จ์— ์ฒจ๋ถ€๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ ๊ฐ•์กฐ(Syntax Highlighting)๋ž€?

ScintillaNET๋ฅผ ์†Œ๊ฐœํ•˜๊ธฐ์— ์•ž์„œ, Syntax Highlighting์— ๋Œ€ํ•ด ๋จผ์ € ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์œ„ํ•œ ์ปดํŒŒ์ผ๋Ÿฌ ํ…์ŠคํŠธ ํŽธ์ง‘๊ธฐ ๋˜๋Š” ์ผ๋ฐ˜ ํ…์ŠคํŠธ ์—๋””ํ„ฐ(notepad++)๋ฅผ ๋ณด๋ฉด, ๊ตฌ๋ฌธ ๊ฐ•์กฐ ๋ฐ ๊ฐ€๋…์„ฑ์„ ์œ„ํ•œ ํ•˜์ด๋ผ์ดํŒ… ๊ธฐ๋Šฅ์ด ํƒ‘์žฌ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ๊ตฌ๋ฌธ ๊ฐ•์กฐ ๊ธฐ๋Šฅ์€ ๋ฐ”๋กœ ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

ํ‹ฐ์Šคํ† ๋ฆฌ ์—๋””ํ„ฐ์˜ Syntax Highlighting ๊ธฐ๋Šฅ
ํ‹ฐ์Šคํ† ๋ฆฌ ์—๋””ํ„ฐ์˜ Syntax Highlighting ๊ธฐ๋Šฅ

๋‹จ์–ด๋งŒ ๋ด์„œ๋Š” ๋ญ˜๊นŒ ์‹ถ๊ฒ ์ง€๋งŒ, ๊ทธ๋ฆผ์„ ๋ณด๋ฉด ๋ˆ„๊ตฌ๋‚˜ ๋‹ค ์•„๋Š” ๊ฒƒ์ผ ๊ฒ๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์— ์ƒ๊ด€์—†์ด ๊ฑฐ์˜ ๋ชจ๋“  ์—๋””ํ„ฐ๋Š” Syntax Highlighting ๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

ScintillaNET ์ด๋ž€?

๋ธ”๋กœ๊ทธ์ฒ˜๋Ÿผ ์›น ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Syntax Highlighting ์ปดํฌ๋„ŒํŠธ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€๊ฐ€ ์žˆ๋Š”๋ฐ์š”. ๊ทธ์ค‘์—์„œ๋„ highlight.js๊ฐ€ ์œ ๋ช…ํ•˜์ฃ .

์ถœ์ฒ˜: highlight.js ํ™ˆํŽ˜์ด์ง€
์ถœ์ฒ˜: highlight.js ํ™ˆํŽ˜์ด์ง€

์ธํ„ฐ๋„ท์— ์„ค์น˜ ๋ฐฉ๋ฒ•์ด๋‚˜ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์ด ๋งŽ์ด ๋‚˜์™€ ์žˆ์–ด, ์ ์šฉ ๋ฐ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์ด ์‰ฌ์šด ํŽธ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์œˆ๋„์šฐ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์— ํ•ด๋‹น ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์€ ์ •๋ง ๊นŒ๋‹ค๋กœ์šด ์ผ์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ MFC๋‚˜ C# ๋ชจ๋‘ ์ด๋Ÿฐ ์—๋””ํ„ฐ ์ปจํŠธ๋กค์„ ์ œ๊ณตํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ด์ฃ (๋ฌผ๋ก  ์ด๋Ÿฐ ๊ธฐ๋Šฅ์ด ํ•„์š”ํ•œ ์ผ๋„ ๊ฑฐ์˜ ์—†์ง€๋งŒ์š”).

ํ•˜์ง€๋งŒ ์œˆ๋„์šฐ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ์œ„ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ๋”ฐ๋กœ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฐ”๋กœ, Scintilla์ธ๋ฐ์š”. Scintilla๋Š” ๋ฌด๋ฃŒ ์†Œ์Šค ์ฝ”๋“œ ์—๋””ํ„ฐ ์ปดํฌ๋„ŒํŠธ๋กœ, ๊ฐœ์ธ์ด๋‚˜ ์ƒ์šฉ ๋ชฉ์ ์œผ๋กœ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  .Net์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ Wrapping ๋œ ๊ฒƒ์ด ScintillaNET์ด์ฃ .

Scintilla ํ™ˆํŽ˜์ด์ง€: https://www.scintilla.org/index.html

 

Scintilla and SciTE

Scintilla is a free source code editing component. It comes with complete source code and a license that permits use in any free project or commercial product. As well as features found in standard text editing components, Scintilla includes features espec

www.scintilla.org

ScintillaNET GitHub: https://github.com/jacobslusser/ScintillaNET

 

GitHub - jacobslusser/ScintillaNET: A Windows Forms control, wrapper, and bindings for the Scintilla text editor.

A Windows Forms control, wrapper, and bindings for the Scintilla text editor. - GitHub - jacobslusser/ScintillaNET: A Windows Forms control, wrapper, and bindings for the Scintilla text editor.

github.com

ScintillaNET ์ ์šฉ ๋ชจ์Šต

๊ทธ๋Ÿผ ScintillaNET์„ ์ ์šฉํ•˜๋ฉด ์–ด๋–ค ๋ชจ์Šต์ธ์ง€ ๋จผ์ € ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ์ด๋ฏธ์ง€์™€ ์• ๋‹ˆ๋ฉ”์ด์…˜์€ ํ‹ฐ์Šคํ† ๋ฆฌ ์—๋””ํ„ฐ์˜ ์ƒ‰์ƒ์„ ๋งž์ถ˜ ๋ชจ์Šต์ž…๋‹ˆ๋‹ค.

Tistory HTML Editor ์ƒ‰์ƒ์œผ๋กœ ๋งž์ถ˜ ๋ชจ์Šต
Tistory HTML Editor ์ƒ‰์ƒ์œผ๋กœ ๋งž์ถ˜ ๋ชจ์Šต
HTML ์ƒ‰์ƒ์ด ์ž…ํ˜€์ง„ ScintillaNET
HTML ์ƒ‰์ƒ์ด ์ž…ํ˜€์ง„ ScintillaNET

C# Windows Forms ํ”„๋กœ์ ํŠธ์—์„œ ScintillaNET ์ค€๋น„ํ•˜๊ธฐ

Windows Forms ์•ฑ ์„ ํƒ ํ›„ ExamScintillaNET ์ด๋ฆ„์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑํ•˜๊ธฐ
ํ”„๋กœ์ ํŠธ ์ƒ์„ฑํ•˜๊ธฐ

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ํ›„ NuGet ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ ๋ฉ”๋‰ด๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

NuGet ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ ๋ฉ”๋‰ด ํด๋ฆญ
NuGet ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ ๋ฉ”๋‰ด ํด๋ฆญ

NuGet ํŒจํ‚ค์ง€ ํ™”๋ฉด์—์„œ ScintillaNET์„ ๊ฒ€์ƒ‰ํ•˜๊ณ , ์ตœ์‹  ๋ฒ„์ „์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

NuGet์—์„œ ํ”„๋กœ์ ํŠธ์— ScintillaNET ์„ค์น˜ํ•˜๊ธฐ
NuGet์—์„œ ํ”„๋กœ์ ํŠธ์— ScintillaNET ์„ค์น˜ํ•˜๊ธฐ

Form ๋””์ž์ธ ํ™”๋ฉด์—์„œ ๋„๊ตฌ ์ƒ์ž์˜ ๋ชฉ๋ก์„ ๋ณด๋ฉด Scintilla ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ถ”๊ฐ€๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋„๊ตฌ ์ƒ์ž์˜ Scitilla ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ
๋„๊ตฌ ์ƒ์ž์˜ Scitilla ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ

๋งŒ์•ฝ, ๋ชฉ๋ก์— Scintilla ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์—†๋‹ค๋ฉด ํ•ญ๋ชฉ ์„ ํƒ ๋ฉ”๋‰ด์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์ˆ˜๋™์œผ๋กœ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Scintilla dll์€ ํ”„๋กœ์ ํŠธ ํด๋”์˜ packages ํด๋” ์•ˆ์— dll์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ˆ˜๋™์œผ๋กœ Scintilla dll ์ถ”๊ฐ€ํ•˜๊ธฐ
์ˆ˜๋™์œผ๋กœ Scintilla dll ์ถ”๊ฐ€ํ•˜๊ธฐ

์—ฌ๊ธฐ๊นŒ์ง€ C# Windows Forms ์•ฑ์— ScintillaNET์„ ์ค€๋น„ํ•˜๋Š” ๊ณผ์ •์ด์—ˆ์Šต๋‹ˆ๋‹ค.

ScintillaNET CPP ์Šคํƒ€์ผ๋กœ ์ƒ‰์ƒ ์„ค์ •ํ•˜๊ธฐ

๊ทธ๋Ÿผ, ์ด์ œ ๊ตฌ๋ฌธ์— ๋”ฐ๋ฅธ ์ƒ‰์ƒ์„ ์ ์šฉํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ScintillaNET;

namespace ExamScintillaNET
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            scintilla1.Margins[0].Type = MarginType.Number;
            scintilla1.Margins[0].Width = 35;

            scintilla1.StyleResetDefault();
            scintilla1.Styles[Style.Default].Font = "Consolas";
            scintilla1.Styles[Style.Default].Size = 14;
            scintilla1.StyleClearAll();

            // CPP Lexer Style ์„ค์ •
            scintilla1.Styles[Style.Cpp.Default].ForeColor = Color.Silver;
            scintilla1.Styles[Style.Cpp.Comment].ForeColor = Color.FromArgb(0, 128, 0);
            scintilla1.Styles[Style.Cpp.CommentLine].ForeColor = Color.FromArgb(0, 128, 0);
            scintilla1.Styles[Style.Cpp.CommentLineDoc].ForeColor = Color.FromArgb(128, 128, 128);
            scintilla1.Styles[Style.Cpp.Number].ForeColor = Color.Olive;
            scintilla1.Styles[Style.Cpp.Word].ForeColor = Color.Blue;
            scintilla1.Styles[Style.Cpp.Word2].ForeColor = Color.Blue;
            scintilla1.Styles[Style.Cpp.String].ForeColor = Color.FromArgb(163, 21, 21);
            scintilla1.Styles[Style.Cpp.Character].ForeColor = Color.FromArgb(163, 21, 21);
            scintilla1.Styles[Style.Cpp.Verbatim].ForeColor = Color.FromArgb(163, 21, 21);
            scintilla1.Styles[Style.Cpp.StringEol].BackColor = Color.Pink;
            scintilla1.Styles[Style.Cpp.Operator].ForeColor = Color.Purple;
            scintilla1.Styles[Style.Cpp.Preprocessor].ForeColor = Color.Maroon;
            scintilla1.Lexer = Lexer.Cpp;

            // keywords ์„ค์ •
            scintilla1.SetKeywords(0, "abstract as base break case catch checked continue default delegate do else event explicit extern false finally fixed for foreach goto if implicit in interface internal is lock namespace new null object operator out override params private protected public readonly ref return sealed sizeof stackalloc switch this throw true try typeof unchecked unsafe using virtual while");
            scintilla1.SetKeywords(1, "bool byte char class const decimal double enum float int long sbyte short static string struct uint ulong ushort void");
        }
    }
}

์œ„ ์ฝ”๋“œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์ ์šฉํ•œ ์ƒ‰์ƒ
์˜ˆ์ œ ์ฝ”๋“œ๋ฅผ ์ ์šฉํ•œ ์ƒ‰์ƒ

์›ํ•˜๋Š” ์Šคํƒ€์ผ์ด ์žˆ๋‹ค๋ฉด ์œ„ ์ฝ”๋“œ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์ƒ‰์ƒ์„ ๋ณ€๊ฒฝํ•˜๋ฉด ๋˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋˜๋Š” ์ธํ„ฐ๋„ท์— ๊ฒ€์ƒ‰ํ•˜๋ฉด ํŠน์ • ์–ธ์–ด์— ๋Œ€ํ•œ ํ…œํ”Œ๋ฆฟ ์ƒ‰์ƒ์„ ๊ตฌํ˜„ํ•ด ๋†“์€ ๊ณณ๋„ ์žˆ์–ด, ํ•ด๋‹น ์ƒ˜ํ”Œ ์ฝ”๋“œ๋ฅผ ์ฐธ๊ณ ํ•˜๋ฉด ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ ์•„๋ž˜ ์ฒจ๋ถ€๋œ ์ƒ˜ํ”Œ ์ฝ”๋“œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š” :)

ExamScintillaNET.zip
2.49MB

๋ฐ˜์‘ํ˜•

'Programming > .Net' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[.Net] C# WinForm์—์„œ ์Šฌ๋ผ์ด๋”ฉ ๋ฉ”๋‰ด(Sliding menu), ์‚ฌ์ด๋“œ๋ฐ”(Sidebar) ์‰ฝ๊ฒŒ ๋งŒ๋“ค๊ธฐ (์˜ˆ์ œ ํฌํ•จ)  (2) 2021.09.26
[.Net] C#์—์„œ CefSharp์œผ๋กœ ํฌ๋กฌ ๋ธŒ๋ผ์šฐ์ € ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• (์˜ˆ์ œ ํฌํ•จ)  (1) 2021.09.11
[.Net] C#์—์„œ JPEG, PNG๋ฅผ WebP๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ• (์˜ˆ์ œ ํฌํ•จ)  (0) 2021.08.30
[.Net] C#์—์„œ ์—‘์…€(Excel) ํŒŒ์ผ ๋‹ค๋ฃจ๋Š” ๋ฐฉ๋ฒ• (์˜ˆ์ œ ํฌํ•จ)  (1) 2021.05.01
[.Net] C#์œผ๋กœ ๋Œ€์‹ ์ฆ๊ถŒ ์ฃผ์‹ ์ž๋™ ๋งค๋งค ํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“ค๊ธฐ - ํฌ๋ ˆ์˜จ ํ”Œ๋Ÿฌ์Šค ์ค€๋น„ ๋‹จ๊ณ„  (0) 2021.04.12
[.Net] C#์œผ๋กœ ๋Œ€์‹ ์ฆ๊ถŒ ์ฃผ์‹ ์ž๋™ ๋งค๋งค ํ”„๋กœ๊ทธ๋žจ ๋งŒ๋“ค๊ธฐ  (2) 2021.04.09
[.Net] C#์—์„œ ์นด์นด์˜คํ†ก ์˜คํ”ˆAPI/REST API๋กœ ๋‚˜์—๊ฒŒ ๋ฉ”์‹œ์ง€ ๋ณด๋‚ด๊ธฐ (์˜ˆ์ œ ํฌํ•จ)  (10) 2021.03.23