编程语言
首页 > 编程语言> > C# 记录

C# 记录

作者:互联网

1. 添加 icon

选择图片并转换成ico格式:https://convertio.co/zh/download/8441dcb3979589069571b8c7295903474957c6/

然后右键属性中添加icon

 

2. Regex的replace方法替换,实现首字母大写

        private void Add_Click(object sender, RoutedEventArgs e)
        {
            Button btn = (Button)sender;
            btn_content = (String)btn.Content;
            if (total.Equals("") || total.EndsWith('!') || total.EndsWith('.') || total.EndsWith('?'))
            {
                // capitalize the first letter
                firstContent = btn_content[1].ToString().ToUpper();
                // original first letter that need to be replaced
                Regex regex = new Regex(btn_content[1].ToString());
                // only replace once
                btn_content = regex.Replace(btn_content, firstContent, 1);
            }
            total += btn_content;
            Result.Content = total;
        }

 

标签:Regex,total,记录,C#,replace,content,EndsWith,btn
来源: https://www.cnblogs.com/sabertobih/p/15317077.html