一些知识点

关闭程序用哪个方法好

This.close();只关闭当前窗口,不关非主线程

Application.exit();关闭所有窗体,不关非主线程

Application.exitthread();不关非主线程

System.environment.thread();关闭一切


遍历所有控件并找到textbox

 foreach (Control cur in Controls)//遍历所有控件找出textbox加换行
            {
                if (cur is TextBox && cur.Text.Length <=2)
                {
                    cur.Text = "";
                    
                }
                else if (cur is TextBox && cur.Text.Length > 5)
                    cur.Text ="    "+ cur.Text + "\n";
            }



button随机跳动不让鼠标碰到

private void button3_MouseEnter(object sender, EventArgs e)
        {
            int x = this.ClientSize.Width - button3.Width;
            int y = this.ClientSize.Height - button3.Height;
            Random r = new Random();
            button3.Location = new Point(r.Next(0, x + 1), r.Next(0, y + 1));
        }


引用mysqlclient连接mysql数据库并把查询放到dgv里(查)

ps:DataSet与DataAdapter对象读取数据前不需要手动写代码连接数据库,会自动识别,若数据库连接没开,则开启,如果没有关闭,则自动关闭。

            string strconn = "server=localhost;Database=world;port=3306;User Id=root;Password=pass";
            MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(strconn);
            conn.Open();
            string sql = "select* from city";
            //MySqlCommand comm = new MySqlCommand(sql, conn);
            MySqlDataAdapter ad = new MySqlDataAdapter(sql, conn);
            DataTable ds = new DataTable();
            ad.Fill(ds);
            dataGridView1.DataSource = ds;
            conn.Close();conn.Dispose();

从datatable改变数据update到mysql里

            MySqlDataAdapter ad = new MySqlDataAdapter(sql, conn);
            MySqlCommandBuilder cb = new MySqlCommandBuilder(ad);
            ds.Tables["cityy"].Rows[0]["population"] = 1991;
            ad.Update(ds, "cityy");


直接用sql修改DB(增删改)

            MySqlCommand cmd = new MySqlCommand(sql, conn);
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


基本冒泡排序

int[] a = { 1, 3, 2,4,9,6,5,7,22 };
            for(int i=0;i<a.Length-1;i++)
            {
                for (int j = 0; j < a.Length - 1-i; j++)
                {
                    if (a[j] > a[j+1])
                    {
                        a[j] = a[j+1] + a[j];
                        a[j + 1] = a[j] - a[j + 1];
                        a[j] = a[j] - a[j + 1];
                    }
                }
            }
            foreach (var i in a)
            {
                textBox1.Text += i.ToString()+",";
            }


使用图片查看器或画图全屏打开相应jpg图片
private void button_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = @"C:\Users\DELL-KEVIN\Pictures\Camera Roll\ironman.png";
            process.StartInfo.Arguments = "rundll32.exe C://WINDOWS//system32//shimgvw.dll,ImageView_Fullscreen";
            process.StartInfo.UseShellExecute = true;//此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true  
            process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;//窗体显示样式
            //System.Diagnostics.Process.Start("mspaint.exe", @"C:\ironman.png");
            process.Start();
            process.Close();//可以不写
        }


把每一笔操作写入日志文件

public void WriteLog(string msg)
        {
            string filePath = AppDomain.CurrentDomain.BaseDirectory + "Log";//appdomain在解决方案debug下,当然也可以在别的地方
            if (!Directory.Exists(filePath))//LOG文件夹是否存在,如果不存在
            {
                Directory.CreateDirectory(filePath);//生成文件夹
            }
            string logPath = AppDomain.CurrentDomain.BaseDirectory + "Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//文本文件名
            try
            {
                using (StreamWriter sw = File.AppendText(logPath))
                {
                    sw.WriteLine("消息:" + msg);//将后跟行结束符的字符串写入文本字符串或流
                    sw.WriteLine("时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));//将后跟行结束符的字符串写入文本字符串或流
                    sw.WriteLine("**************************************************");//将后跟行结束符的字符串写入文本字符串或流
                    sw.WriteLine(); //将行结束符的字符串写入文本字符串或流。
                    sw.Flush();//清理当前写入器的所有缓冲区,并使所有缓冲数据写入基础流
                    sw.Close();//关闭当前 StreamWriter 对象和基础流
                    sw.Dispose(); //释放由 TextWriter 对象使用的所有资源。
                }
            }
            catch (IOException e)//出现错误的写入方法
            {
                using (StreamWriter sw = File.AppendText(logPath))
                {
                    sw.WriteLine("异常:" + e.Message);
                    sw.WriteLine("时间:" + DateTime.Now.ToString("yyy-MM-dd HH:mm:ss"));
                    sw.WriteLine("**************************************************");
                    sw.WriteLine();
                    sw.Flush();
                    sw.Close();
                    sw.Dispose();
                }
            }
        }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
小程序做虚拟数字人需要掌握以下一些知识点: 1. 3D建模技术:虚拟数字人需要有一个3D模型来进行渲染与展示,在小程序中也是如此。因此,需要掌握3D建模技术,包括建模软件的使用、模型制作的流程等。 2. 渲染技术:虚拟数字人的渲染效果对于用户体验至关重要。需要掌握基本的渲染技术,包括光照、纹理、材质等方面的知识。 3. 动画技术:虚拟数字人需要能够进行动作,因此需要掌握动画技术,包括关键帧动画、骨骼动画等方面的知识。 4. 小程序开发技术:虚拟数字人需要在小程序中进行展示,因此需要掌握小程序开发技术,包括小程序框架、组件、API等方面的知识。 在开发小程序虚拟数字人时,可能会遇到以下一些问题: 1. 性能问题:虚拟数字人需要进行复杂的渲染和动画,可能会占用较多的系统资源,导致性能下降。需要进行合理的优化,包括模型的优化、渲染效果的降低等。 2. 兼容性问题:不同的设备和浏览器可能存在兼容性问题,需要进行兼容性测试和调试。 3. 用户体验问题:虚拟数字人需要具备良好的用户体验,需要考虑用户的交互方式、动画效果等方面,进行合理的设计和调整。 4. 数据安全问题:虚拟数字人可能会涉及到用户的敏感数据,需要进行合理的数据保护和隐私保护措施,确保数据安全。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值