Ejemplo n.º 1
0
 private void SetCursor(Control ctrl)
 {
     if (isShowCursor)
     {
         WindowsApiUtils.ShowCaret(ctrl.Handle);
     }
     else
     {
         WindowsApiUtils.HideCaret(ctrl.Handle);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取模板文本框
        /// </summary>
        /// <param name="name">NAME</param>
        /// <param name="val">文本</param>
        /// <returns></returns>
        private TextBox getTempTextB(string name, string val)
        {
            TextBox textBox = new TextBox();

            textBox.Name       = name;
            textBox.Size       = new Size(textBDefSize[0], textBDefSize[1]);
            textBox.Text       = val;
            textBox.Enabled    = true;
            textBox.ReadOnly   = true;
            textBox.Font       = this.Font;
            textBox.ForeColor  = Color.Black;
            textBox.BackColor  = Color.White;
            textBox.TabStop    = false;
            textBox.MouseDown += (object sender, MouseEventArgs e) => {
                WindowsApiUtils.HideCaret(((TextBox)sender).Handle);
            };
            textBox.BorderStyle = BorderStyle.None;
            return(textBox);
        }