FrmMain.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Drawing2D;
using Microsoft.Win32;
using System.Collections;
using System.Runtime.InteropServices;
using System.Xml;
using System.Drawing.Imaging;

namespace SetWallpaper
{   
    public partial class FrmMain : Form
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);

        int screenWidth = Screen.PrimaryScreen.Bounds.Width;
        int screenHeight = Screen.PrimaryScreen.Bounds.Height;          
        FileInfo[] picFiles;
        public FrmMain()
        {
            InitializeComponent();           
        }
        private void FrmMain_Load(object sender, EventArgs e)
        {
            List<DictionaryEntry> list = new List<DictionaryEntry>(){
                new DictionaryEntry(1, "居中显示"),
                new DictionaryEntry(2, "平铺显示"),
                new DictionaryEntry(3, "拉伸显示")
            };
            cbWallpaperStyle.DisplayMember = "Value";
            cbWallpaperStyle.ValueMember = "Key";
            cbWallpaperStyle.DataSource = list;

            txtPicDir.Text = XmlNodeInnerText("");
            timer1.Tick += new EventHandler(timer_Tick);
            Text = string.Format("设置桌面壁纸(当前电脑分辨率{0}×{1})", screenWidth, screenHeight);
        }     
        /// <summary>
        /// 浏览单个图片
        /// </summary>
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "Images (*.BMP;*.JPG)|*.BMP;*.JPG;";
                openFileDialog.AddExtension = true;
                openFileDialog.RestoreDirectory = true;
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    Bitmap img = (Bitmap)Bitmap.FromFile(openFileDialog.FileName);
                    pictureBox1.Image = img;
                    string msg = (img.Width != screenWidth || img.Height != screenHeight) ? ",建议选择和桌面分辨率一致图片" : "";
                    lblStatus.Text = string.Format("当前图片分辨率{0}×{1}{2}", img.Width, img.Height, msg);
后面还有 203 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。