C# 02 控件

1. 焦点状态

ActiveControl 和 Focus
ActiveControl = textBox1; 默认光标焦点在文本框textBox1处
textBox1.Focus(); 焦点转移到textBox1

2. 日期选择显示在文本框

创建伪 DateTimePicker: TextBox文本框并上DateTimePicker缩小至箭头版。
image

image
image

    private void dateTimePicker1_CloseUp(object sender, EventArgs e)
        {
            textBox1.Text = dateTimePicker1.Value.ToString("yyyy/MM/dd");
        }
posted @ 2024-03-22 15:24  OYそ  阅读(3)  评论(0编辑  收藏  举报