using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using UtilLib; namespace Webview2WinFormsApp { public partial class ProofreadItem : UserControl { private readonly Color BG_NORMAL = Color.WhiteSmoke; private readonly Color BG_HOVER = Color.AliceBlue; private readonly Color BG_ACTIVE = Color.AliceBlue; public ProofreadItem() { InitializeComponent(); this.BackColor = BG_NORMAL; } private void ProofreadItem_MouseEnter(object sender, EventArgs e) { this.BackColor = BG_HOVER; Console.WriteLine("ProofreadItem_MouseEnter"); } private void ProofreadItem_MouseLeave(object sender, EventArgs e) { this.BackColor = BG_NORMAL; Console.WriteLine("ProofreadItem_MouseLeave"); } private void ProofreadItem_Click(object sender, EventArgs e) { this.BackColor = BG_ACTIVE; Console.WriteLine("ProofreadItem_Click"); } public void SetProofreadItem(DiffItem it) { var typeConfig = TypeConfig.Get(it.Type); type.Text = typeConfig.Text; type.Visible = false; if (it.Type == ProofreadType.blackWord || it.Type == ProofreadType.blackWordBlock || it.Type == ProofreadType.sensitive) { description.Text = "【敏感词】建议查看"; } else { if (it.Tag == "r") { origin.Text = it.Origin + ">" + it.Text; description.Text = string.Format("【{0}】建议选用“{1}”", typeConfig.Text, it.Text); } else if (it.Tag == "i") { origin.Text = it.Text + " 新增"; description.Text = string.Format("【{0}】建议新增", typeConfig.Text); } else { origin.Text = it.Origin + " 删除"; description.Text = string.Format("【{0}】建议删除", typeConfig.Text); } } } private void ProofreadItem_Load(object sender, EventArgs e) { } } }