剑来_LoadFrame-code

看完剑来第一部的动漫啦,做的真心不错,虽然书没读多少,太长啦,怕开了这本书收不住,现阶段好像没有这么多时间去看网文小说,真怀念读书的日子。

想了一下,如果有一个剑来的武侠游戏,想必做好了,也很好玩吧。剑来世界挺不错的,雪中也不错。

所以,闲着给剑来做个登录界面吧。

有背景音乐的,就是剑妈选择陈平安的插曲,不知道园子什么时候能支持直接放点短的视频,还能听到歌,讲道理我还挺喜欢这首歌的。

OK, show code first!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Net.Mime.MediaTypeNames;
using Image = System.Drawing.Image;

namespace LoadFrame
{
    public partial class Form1 : Form
    {
        Image image1 = null;
        public Form1()
        {
            InitializeComponent();
            this.FormBorderStyle = FormBorderStyle.None;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
            this.comboBox1.AutoSize = false;
            this.comboBox1.Width = 160;
            this.comboBox1.Height = 80;
            addHeadPicture();
            PlayViedo();
        }

        private void addHeadPicture()
        {

            image1 =Image.FromFile(System.Windows.Forms.Application.StartupPath + @"\Background" + @"\head.jpg");
        }

        private class LibWrap
        {
            [DllImport(("winmm.dll"), EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
            public static extern int mciSendString(string lpszCommand, string lpszReturnString, uint cchReturn, IntPtr hwndCallback);
        }
        #region
        private void PlayViedo()
        {
            PictureBox PlayScreen = this.pictureBox1;
            string mciCommand;
            string path = string.Empty;
            path = System.Windows.Forms.Application.StartupPath + @"\Background";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            path += @"\jianlai.wmv";
            mciCommand = "open " + path + " alias MyAVI";
            mciCommand = mciCommand + " parent " + PlayScreen.Handle.ToInt32() + " style child";
            LibWrap.mciSendString(mciCommand, null, 0, IntPtr.Zero);
            Rectangle r = PlayScreen.ClientRectangle;
            mciCommand = "put MyAVI window at 0 0 " + r.Width + " " + r.Height;
            LibWrap.mciSendString(mciCommand, null, 0, IntPtr.Zero);
            // LibWrap.mciSendString("play MyAVI", null, 0, IntPtr.Zero);
            LibWrap.mciSendString("play MyAVI repeat", null, 0, IntPtr.Zero);
        }
        #endregion

        private void Form1_Load(object sender, EventArgs e)
        {
            //绘制圆形picturebox
            //GraphicsPath gp = new GraphicsPath();
            //gp.AddEllipse(this.pictureBox2.ClientRectangle);
            //Region region = new Region(gp);
            //this.pictureBox2.Region = region;
            //gp.Dispose();
            //region.Dispose();
            ////取消跨线程的资源检查
            //Control.CheckForIllegalCrossThreadCalls = false;
        }

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Rectangle destRect = new Rectangle(10, 10, 100, 100);

            // 要绘制的图像
            Image imageToDraw = Image.FromFile(System.Windows.Forms.Application.StartupPath + @"\Background" + @"\head.jpg");

            // 在PictureBox的限定区域内绘制图像
            e.Graphics.DrawImage(imageToDraw, destRect);
        }
    }
}

 

posted @ 2025-07-20 22:17  Wind_Swing_Dunn  阅读(6)  评论(0)    收藏  举报