본문 바로가기

   
Programming/Winform

TextBox Multiline, PasswordChar, WordWrap, ScrollBar, ReedOnly, HideSelection

반응형
블럭은 포커스가 읽어 버린 경우에는 저장은 되있지만 보이는 것은 안잡혀있는것으로 보인다.


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace WindowsForms01

{

       public partial class TextBox01 : Form

       {

             public TextBox01()

             {

                    InitializeComponent();

             }

 

             private void button1_Click(object sender, EventArgs e)

             {

                    //스크롤바

                    this.textBox2.ScrollBars = ScrollBars.None;

             }

 

             private void button2_Click(object sender, EventArgs e)

             {

                    //개행

 

                    this.textBox2.WordWrap = !this.textBox2.WordWrap;

                    this.textBox2.WordWrap = false;

             }

 

             private void button3_Click(object sender, EventArgs e)

             {

                    this.textBox2.ReadOnly = !this.textBox2.ReadOnly;

             }

       }

}

 

  

텍스트 박스 컨트롤 

문자열 작업을 많이 하게 된다.
 using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace WindowsForms01

{

       public partial class TextBox02 : Form

       {

             public TextBox02()

             {

                    InitializeComponent();

             }

 

             private void button1_Click(object sender, EventArgs e)

             {

                    textBox1.Text = "하하하";

             }

 

             private void textBox1_TextChanged(object sender, EventArgs e)

             {

                    //MessageBox.MessageBox.Show("변경됨");

                    //this.label1.Text = this.textBox1.Text;

                    if (this.textBox1.Text.IndexOf("-") > -1)

                    {

                           //경고

                           MessageBox.Show("하이퍼는 사용 불가능 합니다.");

                           this.textBox1.Text = this.textBox1.Text.Replace("-", "");

                    }

             }

 

             private void textBox2_Enter(object sender, EventArgs e)

             {

                    this.textBox2.Text = "활성화됨";

             }

 

             private void textBox2_Leave(object sender, EventArgs e)

             {

                    this.textBox2.Text = "비활성화됨";

             }

 

             private void button2_Click(object sender, EventArgs e)

             {

                    //강제로 포커스를 이동할때 많이 쓰인다.

                    //웹에서 검색 사이트 포커스를 사용한다. 검색란에 마우스

                    this.textBox3.Focus();

             }

       }

}

 

 


창최대화가 아닌 포커스 이동

반응형