SelText 属 性

SelText 属 性 - 图1SelText 属 性 - 图2SelText 属 性 - 图3返回用户控件的文本区中选定的文本 如果没有选定任何文本 则返回空字符串 ("")

SelText 属 性 - 图4SelText 属 性 - 图5SelText 属 性 - 图6指定包含选定文本的字符串 设计时不可用 运行时可读写

语 法

[ Form .] contro l.SelText[= cString ]

参 数 描 述

cString

SelText 属 性 - 图7SelText 属 性 - 图8SelText 属 性 - 图9SelText 属 性 - 图10指 定 包 含 选 定 文 本 的 字 符 串 当 没 有 选 定 文 本 时 指 定 空 字 符 串 选 定 的 文本 带 底 纹 显 示

说 明

SelText 属 性 - 图11SelText 属 性 - 图12把本属性同 SelLength 和 SelText 属性结合起来使用 可完成以下任务

  • SelText 属 性 - 图13

    字 符 串 中 设 置 插 入 点

  • SelText 属 性 - 图14SelText 属 性 - 图15

    立 一 个 插 入 范 围 限 制 插 入 点 的 位 置

  • SelText 属 性 - 图16SelText 属 性 - 图17SelText 属 性 - 图18

    控 件 中 选 择 一 组 指 定 的 字 符 子 字 符 串

  • SelText 属 性 - 图19

    除 文 本

SelText 属 性 - 图20SelText 属 性 - 图21当 使 用 上 述 属 性 时 要 注 意 下 列 操 作

  • SelText 属 性 - 图22

    SelLength 设 置 为 小 于 0 的 值 时 会 引 起 运 行 错 误

  • SelText 属 性 - 图23如 果

    将 SelStart 设 置 为 大 于 文 本 长 度 的 值 则 实 际 上 是 将 该 属 性 设 置 为 现

SelText 属 性 - 图24SelText 属 性 - 图25有 文 本 的 长 度 改 变 SelStart 则 将 选 择 区 改 变 为 一 个 插 入 点 并 把 SelLength

SelText 属 性 - 图26设 置 为 0

  • SelText 属 性 - 图27SelText 属 性 - 图28SelText 属 性 - 图29

    将 SelText 设 置 为 新 值 时 SelLength 会设置为 0 并 用 新 字 符 串 代 替 选 择 的文 本

应 用 于

SelText 属 性 - 图30SelText 属 性 - 图31SelText 属 性 - 图32组合框 编辑框 微调 文本框

请 参 阅

SelLength 属 性 , SelStart 属 性