zoukankan      html  css  js  c++  java
  • C# Winform 自适应大小 按上下键切换控件焦点

    按上下键切换控件焦点(只对textbox有效)

    private void textBox2_KeyDown(object sender, KeyEventArgs e)
    {
    if (e.KeyValue == 40 || e.KeyValue == 13)
    {
    SendKeys.Send(
    "{TAB}");
    }
    if (e.KeyValue == 38)
    {
    int index= this.textBox2.TabIndex;
    for (int i = 0; i < this.Controls.Count; i++)
    {
    if (this.Controls[i].TabIndex == (index - 1))
    {
    this.Controls[i].Focus();
    break;
    }
    }
    }
    }

    自适应大小

    private void Form1_SizeChanged(object sender, EventArgs e)
    {

    if (this.WindowState.ToString() == "Maximized")
    {
    this.dataGridView1.Width = this.Size.Width-35;
    }
    else if (this.WindowState.ToString() == "Normal")
    {
    this.dataGridView1.Width = this.Size.Width-35;
    }
    else
    {
    this.dataGridView1.Width = this.Size.Width-35;
    }
    }
  • 相关阅读:
    jQuery的选择器
    01-jQuery的介绍
    client、offset、scroll系列
    BOM
    定时器
    js中的面向对象
    javascript小练手
    DOM介绍
    关于DOM的事件操作
    伪数组 arguments
  • 原文地址:https://www.cnblogs.com/XuYiHe/p/2171398.html
Copyright © 2011-2022 走看看