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;
    }
    }
  • 相关阅读:
    Flask——session
    UISB ScrollView
    UISB 登陆
    UISB TextField
    UISB 进步器 分栏控制器
    UISB UISlider ProgressView
    UISB Switch
    UISB 定时器
    Django-Celery文档
    UISB UIViewController
  • 原文地址:https://www.cnblogs.com/XuYiHe/p/2171398.html
Copyright © 2011-2022 走看看