zoukankan      html  css  js  c++  java
  • C#Windows Forms (Demo.SYS)--xdd

     1 private void Show_background_picture()//随机更换背景
     2         {
     3             string img_no = "01";//默认值
     4             Random ran = new Random();
     5             int bg_index = ran.Next(1, 3);//返回一个1到3之间的随机数(1,2,3)
     6             if (bg_index < 10)//防止背景图片大于9张,图片文件名为01 02 03...
     7                 img_no = "0" + bg_index.ToString();
     8             else
     9                 img_no = bg_index.ToString();
    10             //if 没有end
    11             //设置背景图片   @"picture"等效于"\picture\"
    12             this.BackgroundImage = Image.FromFile(Application.StartupPath + @"picture" + img_no + ".png");//参数:存储图片文件的路径
    13         }

    write bu xdd       2019-08-22  00:21:20


     


    转载仅为学习,不会商用。
    欢迎转载原创,附文链接。
  • 相关阅读:
    context:component-scan报错
    goland 实用键
    React-Native 指定模拟器RUN-IOS
    mac 卸载编辑器卸不干净
    go 区分指针
    go 学习Printf
    我的命令行
    mysql8的坑
    小三角
    eslint 禁用命令
  • 原文地址:https://www.cnblogs.com/xdd1997/p/11392081.html
Copyright © 2011-2022 走看看