• 大小: 2.15MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-09-08
  • 语言: 其他
  • 标签:

资源简介

非常好的关于不规则窗口的学习资料,项目效果是创建一条游动的金鱼,在屏幕上运动,窗口是不规则的并且带有部分半透明效果。

资源截图

代码片段和文件信息

//##########################################################################
//★★★★★★★           http://www.cnpopsoft.com           ★★★★★★★
//★★          VB & C# source code and articles for free !!!           ★★
//★★★★★★★                Davidwu                       ★★★★★★★
//##########################################################################

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RotateTransformDemo
{
    public partial class FishForm : Form
    {
        Point oldPoint = new Point(0 0);
        bool mouseDown = false;
        bool haveHandle = false;
        Timer timerSpeed = new Timer();
        int MaxCount = 50;
        float stepX = 2f;
        float stepY = 0f;
        int count = 0;
        bool speedMode = false;
        float left = 0f top = 0f;

        bool toRight = true;
        int frameCount = 20;
        int frame = 0; 
        int frameWidth = 100;
        int frameHeight = 100; 

        public FishForm()
        {
            InitializeComponent();
            this.TopMost = true;
            toRight = true;
            frame = 20;
            frame = 0;
            frameWidth = FullImage.Width / 20;
            frameHeight = FullImage.Height;
            left = -frameWidth;
            top = Screen.PrimaryScreen.WorkingArea.Height / 2f;

            timerSpeed.Interval = 50;
            timerSpeed.Enabled = true;
            timerSpeed.Tick += new EventHandler(timerSpeed_Tick);

            this.DoubleClick += new EventHandler(Form2_DoubleClick);
            this.MouseDown += new MouseEventHandler(Form2_MouseDown);
            this.MouseUp += new MouseEventHandler(Form2_MouseUp);
            this.MouseMove += new MouseEventHandler(Form2_MouseMove);
        }

        #region Override

        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = true;
            base.OnClosing(e);
            haveHandle = false;
        }

        protected override void OnHandleCreated(EventArgs e)
        {
            Initializestyles();
            base.OnHandleCreated(e);
            haveHandle = true;
        }

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cParms = base.CreateParams;
                cParms.Exstyle |= 0x00080000; // WS_EX_layerED
                return cParms;
            }
        }

        #endregion

        void Form2_MouseUp(object sender MouseEventArgs e)
        {
            count = 0;
            MaxCount = new Random().Next(70) + 40;
            timerSpeed.Interval = new Random().Next(20) + 2;
            speedMode = true;
            mouseDown = false;
        }

        private void Initializestyles()
        {
            Setstyle(Controlstyles.AllPaintingIn

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     462336  2017-03-27 21:13  GoldFishProject\bin\Debug\RotateTransformDemo.exe

     文件      28160  2017-03-27 21:13  GoldFishProject\bin\Debug\RotateTransformDemo.pdb

     文件      21680  2017-04-09 20:23  GoldFishProject\bin\Debug\RotateTransformDemo.vshost.exe

     文件        490  2016-07-16 19:44  GoldFishProject\bin\Debug\RotateTransformDemo.vshost.exe.manifest

     文件       7861  2008-09-09 17:00  GoldFishProject\FishForm.cs

     文件       2035  2008-09-09 16:59  GoldFishProject\FishForm.Designer.cs

     文件       5814  2008-09-08 20:36  GoldFishProject\FishForm.resx

     文件     861793  2017-03-24 21:32  GoldFishProject\GoldFish.rar

     文件       3753  2017-03-27 21:12  GoldFishProject\GoldFishProject.csproj

     文件       6283  2017-03-27 21:12  GoldFishProject\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        813  2017-04-09 20:23  GoldFishProject\obj\Debug\GoldFishProject.csproj.FileListAbsolute.txt

     文件        927  2017-03-27 21:13  GoldFishProject\obj\Debug\GoldFishProject.csproj.GenerateResource.Cache

     文件       1340  2017-03-27 21:13  GoldFishProject\obj\Debug\GoldFishProject.csprojResolveAssemblyReference.cache

     文件     462336  2017-03-27 21:13  GoldFishProject\obj\Debug\RotateTransformDemo.exe

     文件        180  2017-03-27 21:13  GoldFishProject\obj\Debug\RotateTransformDemo.FishForm.resources

     文件      28160  2017-03-27 21:13  GoldFishProject\obj\Debug\RotateTransformDemo.pdb

     文件     449405  2017-03-27 21:13  GoldFishProject\obj\Debug\RotateTransformDemo.Properties.Resources.resources

     文件       4096  2017-03-27 21:12  GoldFishProject\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        885  2008-09-09 16:59  GoldFishProject\Program.cs

     文件        657  2008-09-09 17:02  GoldFishProject\Properties\AssemblyInfo.cs

     文件       3612  2017-03-27 21:12  GoldFishProject\Properties\Resources.Designer.cs

     文件       6435  2008-09-08 19:44  GoldFishProject\Properties\Resources.resx

     文件       1119  2017-03-27 21:12  GoldFishProject\Properties\Settings.Designer.cs

     文件        249  2008-09-08 15:19  GoldFishProject\Properties\Settings.settings

     文件     205721  2008-09-08 18:40  GoldFishProject\Resources\Left.png

     文件     204894  2008-09-08 18:40  GoldFishProject\Resources\Right.png

     文件       2783  2008-09-09 16:59  GoldFishProject\Win32.cs

     目录          0  2017-03-27 21:12  GoldFishProject\obj\Debug\TempPE

     目录          0  2017-04-09 20:22  GoldFishProject\bin\Debug

     目录          0  2017-03-27 21:12  GoldFishProject\bin\Release

............此处省略9个文件信息

评论

共有 条评论