본문 바로가기
프로그래밍/C# (WinForms)

WinForms ] Label vs TextBox 컨트롤

by eteo 2023. 4. 9.

 

 

결론 : 사용자가 편집할 수 있게끔 하려면 TextBox, 아닌 경우 Label 사용 추천

 

There are a few pro's and con's to both.

Label

Pro's:

  • Text is not copy able
  • Cursor does not change
  • Sets size based on text (if autosize is on, I think its on by default)
  • Option to align text to the right (autosize off)

Con's:

  • Text is not selectable/copy able
  • Text might outgrow form/parent with autosize

TextBox

Pro's:

  • Text is copy able
  • Fixed size (also a con)

Con's:

  • Does not autosize
  • Height not adjustable (does not apply to rich textbox/multiline = true)

 

Reference : https://stackoverflow.com/questions/42764020/using-a-label-vs-using-a-textbox%EF%BB%BF

 

Using a Label vs using a Textbox

I have a C# Application where I am using Serial communication with a Microcontroller to Display data on the application. I have used a text box to display the data : public void

stackoverflow.com

https://stackoverflow.com/questions/489220/text-box-vs-labels%EF%BB%BF