DCAgile
发表于 2015-10-28 17:00:00
回复 10楼iceman的帖子
问题:
1.选择 红色字体后颜色会自动变黑
2.“打印” 菜单 希望将字体整体设置为 “黑色”——实际设为红色
iceman
发表于 2015-10-28 17:10:00
回复 11楼DCAgile的帖子
问题1,需要加判断条件。
问题2,如果希望当前tx 界面无变化,建议通过 Servertextcontrol 实现:http://blog.gcpowertools.com.cn/post/2014/06/26/nonUI-servertextcontrol.aspx
iceman
发表于 2015-10-29 13:44:00
回复 11楼DCAgile的帖子
问题1需要在以下时间中判断:
private void textControl1_Changed(object sender, EventArgs e)
{
}
Changed事件在文本内容改变时触发。
DCAgile
发表于 2015-10-29 17:09:00
回复 13楼iceman的帖子
问题1: 对于问题1 在Changed事件中进行判断 测试过,问题还是存在, 或许是这边对控件了解程度不到位,,,, 麻烦您进行处理一下,,???
iceman
发表于 2015-10-29 17:18:00
回复 14楼DCAgile的帖子
private void textControl1_InputPositionChanged(object sender, EventArgs e)
{
if (this.textControl1.Selection.Length==0)
{
this.textControl1.Selection.ForeColor = Color.Black;
}
}
DCAgile
发表于 2015-10-29 17:28:00
回复 15楼iceman的帖子
功能需求:
1.假设textControl1.Text="你好,上你好下ABC1123"; (其中“上”需要显示为红色,其他为黑色字体)
2.当用户用鼠标进行选择TXControl 的Text内容时,需要保持内容原有颜色
3.当用户选择 “上” 进行更改,如果改为其他内容,将字体改为黑色
问题: 使用目前提供的方式进行更改,仍存在问题
iceman
发表于 2015-10-30 14:16:00
回复 16楼DCAgile的帖子
问题我重现了,当选择红色字体再修改是即使不是关键字仍然是红色,有进一步结果通知你。
DCAgile
发表于 2015-11-2 13:37:00
回复 17楼iceman的帖子
当前问题处理的怎么样了????
gw0506
发表于 2015-11-2 18:36:00
还在等待厂商的回复,有消息会立刻通知你。
iceman
发表于 2015-11-3 18:15:00
回复 18楼DCAgile的帖子
这个问题详细考虑了一下,还需要把所有文字都重置成黑色,再搜索处理:
private void SetSpecialStyle()
{
this.textControl1.SuspendLayout();
this.textControl1.Selection.Start = 0;
this.textControl1.Selection.Length = this.textControl1.Text.Length;
this.textControl1.Selection.ForeColor = Color.Black;
List<string> list = new List<string>();
list.Add("上");
list.Add("下");
list.Add("重病");
list.Add("可见");
int index = -1;
for (int i = 0; i < list.Count; i++)
{
do
{
index = this.textControl1.Find(list, index + 1, TXTextControl.FindOptions.NoMessageBox);
this.textControl1.Selection.ForeColor = Color.Red;
} while (index != -1);
}
this.textControl1.Select(this.textControl1.Text.Length-1,0);
this.textControl1.ResumeLayout();
}