""와 ''는 동일하다

"String" === 'String'

"String" == 'String'


비어있는 문자열,

0 문자열,

공백 문자열,

숫자 0


위의 4가지는 false를 의미하기도 함


ex)

''        ==   '0'                 // false

0         ==   ''                 // true

0         ==   '0'                // true

false     ==   'false'           // false

false     ==   '0'               // true

false     ==   undefined     // false

false     ==   null             // false

null      ==   undefined     // true

" \t\r\n" ==   0             // true


이와 같은것을 Truthy, Falsy라고 한다.


참조사이트

https://developer.mozilla.org/en-US/docs/Glossary/Truthy

https://developer.mozilla.org/en-US/docs/Glossary/Falsy


truthy와 falsy를 단순히 더블이퀄(==)비교 하게되면 혼돈이 생기기 쉽습니다.

변수 값이 존재하느냐 마느냐는 느낌표를 붙여 판단하면 좋으며,

비교를 위해서는

타입까지 체크하는 트리플이퀄(===)을 사용하는 것이 좋다.

'Programming > JavaScript' 카테고리의 다른 글

값 전달 방법  (0) 2016.05.25
블로그 이미지

SherryBirkin

,

window.onload = function() {} - html이 처음 열렸을때 한번 실행 함수


listBox는 text만 바로 넣을 수 없고 형 변환을 해야함

 ex) var option = new Option();

option.text = sInput;

list.options.add(option); 


listbox item초기화방법

-  list.options.length = 0


string문자열 자르는방법

- string.substr(index, length);


배열에서 특정된번호부터 삭제하는 방법

     - Array.splice(index, count);


label에 값 전달방법

- var label = document.getElementById('Label_ID');

label.innerHTML = String;




'Programming > JavaScript' 카테고리의 다른 글

데이터 비교시 유의해야할점  (0) 2016.05.27
블로그 이미지

SherryBirkin

,

TrayIcon에서 


우클릭했을떄랑, 좌클릭했을때 ContextMenu를 다르게 보는 방법


private void notifyIcon1_MouseClick(object senderMouseEventArgs e)

        {

            if (e.Button == MouseButtons.Left)

            {

                notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;

                System.Reflection.MethodInfo methodInfo = 

                       typeof(NotifyIcon).GetMethod("ShowContextMenu"

                       System.Reflection.BindingFlags.Instance | 

System.Reflection.BindingFlags.NonPublic);

                methodInfo.Invoke(notifyIcon1null);

            }

            else if (e.Button == MouseButtons.Right)

            {

                notifyIcon1.ContextMenuStrip = contextMenuStrip2;

                System.Reflection.MethodInfo methodInfo = 

                       typeof(NotifyIcon).GetMethod("ShowContextMenu",

                        System.Reflection.BindingFlags.Instance |

                           System.Reflection.BindingFlags.NonPublic);

                methodInfo.Invoke(notifyIcon1null);

            }

        }




코드에 관한 설명 - 질문자 우시와카는 본인임.


http://www.hoons.net/Board/QACSHAP/Content/31613?Key=Name&Value=%EC%9A%B0%EC%8B%9C%EC%99%80%EC%B9%B4

'Programming > C#' 카테고리의 다른 글

DataTable 사용방법  (0) 2016.08.14
ComboBox에 항목별로 Tag를 사용하는 방법 (DataTable)  (0) 2016.08.14
xml Element  (0) 2016.08.02
메시지박스 자동 종료하기  (0) 2016.04.24
DataGridView RowHeader에 숫자 넣는법  (0) 2016.02.26
블로그 이미지

SherryBirkin

,

종료버튼 눌렀을 때 메시지 박스가 뜨면,


1000ms(1s)후에 자동 종료되는 형태이다.


다른 방법도 있지만 Action으로 사용 하는 방법


private void MessageBoxFormClosing(Form fm)
{
    if (fm.InvokeRequired)
    {
        Action<Form> closeform = new Action<Form>(MessageBoxFormClosing);
        this.Invoke(closeform, fm);
    }
    else
    {
        if (fm != null)
            fm.Close();
    }
}
 
private void button1_Click(object sender, EventArgs e)
{
    Form msgfm = new Form();
    Action clse = new Action(() = >
    {
        while (true)
        {
            System.Threading.Thread.Sleep(1000);
            break;
        }
        MessageBoxFormClosing(msgfm);
    });
    clse.BeginInvoke(ir = > clse.EndInvoke(ir), null);
    MessageBox.Show(msgfm, "닫혀~");
}


블로그 이미지

SherryBirkin

,

DataGridView 이벤트에서 RowPostPaint를 추가하고


아래와 같이 코드를 넣으면 된다.

// 주석은 16진수 (4자리)


private void Gridview_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
            DataGridView grid = sender as DataGridView;
            //String rowIdx = (e.RowIndex + 1).ToString("X4");
            String rowIdx = (e.RowIndex + 1).ToString();
 
            StringFormat centerFormat = new StringFormat()
            {
                Alignment = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };
 
            Rectangle headerBounds = new Rectangle(e.RowBounds.Left, e.RowBounds.Top,
                                                    grid.RowHeadersWidth, e.RowBounds.Height);
            e.Graphics.DrawString(rowIdx, this.Font, SystemBrushes.ControlText,
                                  headerBounds,centerFormat);
}


블로그 이미지

SherryBirkin

,