博客
关于我
学生优化(二)——密码框不可输入空格、查询学籍信息窗体添加提示框、下拉框只能选择不可输入
阅读量:607 次
发布时间:2019-03-12

本文共 628 字,大约阅读时间需要 2 分钟。

一、密码框不可输入空格

为了确保密码框不允许输入空格,我们需要采取以下措施:

  • 首先,将用户表中的PWD字段的数据类型更改为varchar(20),这样可以自动截断或截断密码末尾的空格。若未更改数据类型,在特定情况下可能会导致用户名后跟空格也能成功登录,这显然是不安全的。
  • 接下来,限制密码的输入字符以及空格。为此,可以在密码输入框的KeyPress事件中任意处 spiritually@examples.com 添加判断语句,若检测到空格(ASCII码32)输入则自动转换为空或提示用户。
  • 此外,我们还需要清空剪贴板,以防止用户通过粘贴操作绕过我们的密码限制。可以在密码输入框的KeyDown和MouseDown事件中,检测到Ctrl+V或右键操作时清空剪贴板,确保用户无法粘贴非法字符。
  • 二、查询学籍信息添加提示框

    为了提升用户体验,可以在查询学籍信息时添加一个简单的提示框:

  • 在窗体初始化阶段,设置一个Label,默认显示“等待查询”。
  • 在查询按钮的点击事件中,根据实际情况设置Label的显示内容,即“查询到”以及总记录数。
  • 这样既能让用户了解系统处理状态,又能在完成查询后明确显示结果数量,提升用户体验。

    三、下拉框只能选择不可输入

    为了确保下拉框中的组别只允许选择不可输入的项目,可以采取以下方法:

  • 添加KeyPress事件处理,在下拉框中检测到用户输入空格时,将空格字符(ASCII码32)转换为空或直接舍去,避免用户通过空格操作绕过选择限制。
  • 转载地址:http://cqmxz.baihongyu.com/

    你可能感兴趣的文章
    NO 157 去掉禅道访问地址中的zentao
    查看>>
    no available service ‘default‘ found, please make sure registry config corre seata
    查看>>
    No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    查看>>
    no connection could be made because the target machine actively refused it.问题解决
    查看>>
    No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
    查看>>
    No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
    查看>>
    No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
    查看>>
    No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
    查看>>
    No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
    查看>>
    No module named 'crispy_forms'等使用pycharm开发
    查看>>
    No module named cv2
    查看>>
    No module named tensorboard.main在安装tensorboardX的时候遇到的问题
    查看>>
    No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
    查看>>
    No new migrations found. Your system is up-to-date.
    查看>>
    No qualifying bean of type XXX found for dependency XXX.
    查看>>
    No qualifying bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>‘ available
    查看>>
    No resource identifier found for attribute 'srcCompat' in package的解决办法
    查看>>
    no session found for current thread
    查看>>
    No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
    查看>>
    NO.23 ZenTaoPHP目录结构
    查看>>