*추가기능

-1.저장시 디폴드명,파일형식선택하게.

-2.컨트롤+s 저장하면안되게 (아무것도없을때)

-3.열기할때 기존정보가 있으면 기존정보가 있을때 저장하시겠습니까?

-4.크기늘릴때 텍스트박스도 같이 커지게(패널, 도킹 (사이즈))

//5.인코딩 combobox 찾아보기.

-6.행열 오른쪽 하단.

-7.왼쪽상단 제목 현재파일 이름으로 바꾸기.

 

1.

 public void SaveFile(bool bMessage)

        {

            try

            {

                saveFileDialog1.FileName = "*.txt";

                saveFileDialog1.ShowHelp = true;

                saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";

                saveFileDialog1.FilterIndex = 1;

              . . . 생략

파일을 저장하는 함수에 저장다이얼로그의 파일 이름을 바꿧다.

2.

 private bool EditText = false; 변수를 하나둬서

RichTextBox 이벤트중 TextChagned(text속성값변경시)이벤트가 발생할때

EditText =true 바꿔서 ctrl+s 파일저장할때 EditText==true일때만 한다.

3.

열기 이벤트에서

   private void menu_OpenFile_Click(object sender, EventArgs e)

        {

            try

            {

                if (menu_File.Text != "")

                {

...생략

일때 저장하게하고 열기를 진행한다.

 

  1. 해당 컨트롤을 위치에맞게 도킹한다.
  2. 못찾음
  3. RichTextBox 이벤트중 TextChagned(text속성값변경시)이벤트가 발생할때

Colored By Color Scripter

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

   private void menu_File_TextChanged(object sender, EventArgs e)

        {

            EditText = true;

            bool bfirstLine = false;

            int caretLine = 0;

            int caretPos = menu_File.TextLength; //테그트박스의 전체 문자열 길이를 반환.

            char[] charText = menu_File.Text.ToCharArray(); //전체 문자를 유니코드 배열에 복사.

            for (int i = 0; i < caretPos; ++i)//처음부터 문자열 끝까지 검사

            {

                if (charText[i].ToString().Equals("\n"))

                {

                    caretLine++;

                    bfirstLine = true;

                    moveLine = -1;

                }

                if(bfirstLine==true)

                moveLine += 1;

            }

            if (bfirstLine == false)

                moveLine += 1;

            toolStripStatusLabel1.Text = caretLine.ToString(); //행

            toolStripStatusLabel2.Text = moveLine.ToString(); //열

        }

  1. 열기할때 this.Text = openFileDialog1.FileName; 추가.

'ASP.NET(윈폼)' 카테고리의 다른 글

[ASP.NET] 2.HTML Server Control Class 정리  (0) 2018.08.06
[ASP.NET] 1.Web Form으로 시작하는 ASP.NET  (0) 2018.08.06
[윈폼] 탐색기 추가기능  (1) 2018.07.26
[윈폼] 탐색기  (0) 2018.07.24
[윈폼] 메모장  (0) 2018.07.24

+ Recent posts