找回密码
 立即注册

QQ登录

只需一步,快速开始

DCAgile
中级会员   /  发表于:2015-10-28 17:00:00
11#
回复 10楼iceman的帖子

问题:

1.选择    红色  字体后颜色会自动变黑

2.“打印” 菜单 希望将字体整体设置为 “黑色”——实际设为红色

CombineDocs.rar

64.79 KB, 下载次数: 53

回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-10-28 17:10:00
12#
回复 11楼DCAgile的帖子

问题1,需要加判断条件。
问题2,如果希望当前tx 界面无变化,建议通过 Servertextcontrol 实现:http://blog.gcpowertools.com.cn/ ... vertextcontrol.aspx
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-10-29 13:44:00
13#
回复 11楼DCAgile的帖子

问题1需要在以下时间中判断:

  1.         private void textControl1_Changed(object sender, EventArgs e)
  2.         {
  3.          }
复制代码


Changed事件在文本内容改变时触发。
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-10-29 17:09:00
14#
回复 13楼iceman的帖子

问题1: 对于问题  1   在Changed事件中进行判断   测试过,问题还是存在,    或许是这边对控件了解程度不到位  ,,,, 麻烦您进行处理一下,,???
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-10-29 17:18:00
15#
回复 14楼DCAgile的帖子


  1.         private void textControl1_InputPositionChanged(object sender, EventArgs e)
  2.         {
  3.             if (this.textControl1.Selection.Length==0)
  4.             {
  5.                 this.textControl1.Selection.ForeColor = Color.Black;

  6.             }
  7.         }
复制代码
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-10-29 17:28:00
16#
回复 15楼iceman的帖子

功能需求:
1.假设textControl1.Text="你好,上你好下ABC1123";         (其中“上”需要显示为红色,其他为黑色字体)

2.当用户用鼠标进行选择TX  Control 的Text内容时,需要保持内容原有颜色

3.当用户选择 “上” 进行更改,如果改为其他内容,将字体改为黑色

问题: 使用目前提供的方式进行更改,仍存在问题
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-10-30 14:16:00
17#
回复 16楼DCAgile的帖子

问题我重现了,当选择红色字体再修改是即使不是关键字仍然是红色,有进一步结果通知你。
回复 使用道具 举报
DCAgile
中级会员   /  发表于:2015-11-2 13:37:00
18#
回复 17楼iceman的帖子

当前问题处理的怎么样了????
回复 使用道具 举报
gw0506
超级版主   /  发表于:2015-11-2 18:36:00
19#
还在等待厂商的回复,有消息会立刻通知你。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-11-3 18:15:00
20#
回复 18楼DCAgile的帖子

这个问题详细考虑了一下,还需要把所有文字都重置成黑色,再搜索处理:

  1. private void SetSpecialStyle()
  2.         {
  3.             this.textControl1.SuspendLayout();
  4.             this.textControl1.Selection.Start = 0;
  5.             this.textControl1.Selection.Length = this.textControl1.Text.Length;
  6.             this.textControl1.Selection.ForeColor = Color.Black;
  7.             List<string> list = new List<string>();
  8.             list.Add("上");
  9.             list.Add("下");
  10.             list.Add("重病");
  11.             list.Add("可见");
  12.             int index = -1;
  13.             for (int i = 0; i < list.Count; i++)
  14.             {
  15.                 do
  16.                 {
  17.                     index = this.textControl1.Find(list[i], index + 1, TXTextControl.FindOptions.NoMessageBox);
  18.                     this.textControl1.Selection.ForeColor = Color.Red;
  19.                 } while (index != -1);
  20.             }
  21.             this.textControl1.Select(this.textControl1.Text.Length-1,0);
  22.             this.textControl1.ResumeLayout();
  23.         }
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部