zoukankan      html  css  js  c++  java
  • 重写/覆盖基类的事件

    对于从父类继承来的事件,若子类需要在触发之后,进行 一些“特殊处理时”,建议:覆盖或重写父类的 <抽闲或虚的> OnXXX函数,若还需要保留父类事件触发后的某些特性,则需要  base.OnXXX()函数。PS:这些函数 <直接> 来自父类(注:这些函数在父类中是虚函数 或 抽象函数才可以),但源头可能是更底层的基类。

     public class CCIntAndUpperLetterBox : TextBox
        {
            private string lastText = "";

            protected override void OnTextChanged(TextChangedEventArgs e)
            {
                if (Text.Length > 0)
                {
                    if (Text.Contains(" "))
                    {
                        Text = Text.Replace(" ", "");
                        SelectionStart = Text.Length;
                    }
                    else
                    {
                        if (StringHelper.IntAndUpper(Text))
                        {
                            Text = Text.ToUpper();
                            lastText = Text;
                        }
                        else
                        {
                            Text = lastText;
                        }
                    }
                }
                else
                {
                    lastText = "";
                }
                base.OnTextChanged(e);
            }
        }

  • 相关阅读:
    httprunner 3.x学习12
    httprunner 3.x学习11
    PyTorch中.view()与.reshape()方法以及.resize_()方法的对比
    算术编码简介
    量化参数QP:quantization parameter 以及 HEVC
    H.265/HEVC编码结构
    H.265 视频编码中的 CTU, CU, PU, TU
    I帧、P帧、B帧、GOP、IDR 和PTS, DTS之间的关系
    视频编码 率失真性能评价指标:PSNR SSIM BD-rate BD-PSNR
    矢量量化(VQ,Vector Quantization)
  • 原文地址:https://www.cnblogs.com/changbaishan/p/11208591.html
Copyright © 2011-2022 走看看