登录
首页 » C# » 动画效果浮动窗体实例

动画效果浮动窗体实例

于 2015-06-10 发布
0 192
下载积分: 1 下载次数: 0

代码说明:

        private void StopRectTimer_Tick(object sender, EventArgs e)        {            //如果鼠标在窗体上,则根据停靠位置显示整个窗体              if (this.Bounds.Contains(Cursor.Position))            {                switch (this.StopDock)                {                    case AnchorStyles.Top:                        this.Location = new Point(this.Location.X, 0);                        break;                    case AnchorStyles.Bottom:                        this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - this.Height);                        break;                    case AnchorStyles.Left:                        this.Location = new Point(0, this.Location.Y);                        break;                    case AnchorStyles.Right:                        this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width, this.Location.Y);                        break;                }            }            else  //如果鼠标离开窗体,则根据停靠位置隐藏窗体,但须留出部分窗体边缘以便鼠标选中窗体              {                switch (this.StopDock)                {                    case AnchorStyles.Top:                        this.Location = new Point(this.Location.X, (this.Height - 3) * (-1));                        break;                    case AnchorStyles.Bottom:                        this.Location = new Point(this.Location.X, Screen.PrimaryScreen.Bounds.Height - 5);                        break;                    case AnchorStyles.Left:                        this.Location = new Point((-1) * (this.Width - 3), this.Location.Y);                        break;                    case AnchorStyles.Right:                        this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 2, this.Location.Y);                        break;                }            }        }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 海康威视摄像头抓拍展示录像功能
    【实例简介】 ------------------------------------- 1. 实现预览、抓图(BMP、JPEG)、客户端录像、云台控制(2014-7-4) 2. 设备通道号在界面上手动输入,64路以下NVR的IP通道一般从33开始 3. bin文件夹下为已编译的可执行程序(Release版本) 4. SDK日志保存路径:"C:\SdkLog\"(2014-7-4) 【注意事项】 ------------------------------------ 【库文件】里的HCNetSDK.dll、HCCore.dll、HCNetSDKCom文件夹、PlayCtrl.dll、SuperRender.dll、AudioRender.dll、ssleay32.dll、libeay32.dll、hlog.dll、hpr.dll、zlib1.dll、log4cxx.properties等文件均拷贝到bin文件夹下。HCNetSDKCom文件夹(包含里面的功能组件dll库文件)需要和HCNetSDK.dll、HCCore.dll一起加载,放在同一个目录下,且HCNetSDKCom文件夹名不能修改。 3. 如果自行开发软件不能正常实现相应功能,而且程序没有指定加载的dll库路径,请在程序运行的情况下尝试删除HCNetSDK.dll。如果可以删除,说明程序可能调用到系统盘Windows->System32目录下的dll文件,建议删除或者更新该目录下的相关dll文件;如果不能删除,dll文件右键选择属性确认SDK库版本。 4. 如按上述步骤操作后还是不能实现相应功能,请根据NET_DVR_GetLastError返回的错误号判断原因。
    2021-07-16 00:32:03下载
    积分:1
  • C# 制作系统服务 实例源码下载
    附件中有详细的安装使用文档,大概步骤如下:1.新建Windows项目,选择"Windows服务"类型的工程。2.生成的Program.cs文件中,定义了服务启动的Main函数。 代码 namespace WindowsService1{    static class Program    {        ///         /// 应用程序的主入口点。        ///         static void Main()        {            ServiceBase[] ServicesToRun;            ServicesToRun = new ServiceBase[]             {                 new Service1()             };            ServiceBase.Run(ServicesToRun);        }    }}  3.在新建的工程中,点击Service1.cs文件,切换到代码视图,生成的代码继承于ServiceBase基类,并重载了OnStart和OnStop方法。我在这个文件中进行了一些简单的操作,就是在服务开始的时候,定义一个定时器,然后每隔1秒钟,向文件中写入当前时间。 代码 namespace WindowsService1{    public partial class Service1 : ServiceBase    {        Timer timer;        public Service1()        {            InitializeComponent();        }        protected override void OnStart(string[] args)        {            timer = new Timer(1000);            timer.Elapsed  = new ElapsedEventHandler(timer_Elapsed);            timer.Start();        }        protected override void OnStop()        {            timer.Stop();            timer.Dispose();        }        void timer_Elapsed(object sender, ElapsedEventArgs e)        {            string filePath = AppDomain.CurrentDomain.BaseDirectory   "test.txt";            StreamWriter sw = null;            if (!File.Exists(filePath))            {                sw = File.CreateText(filePath);            }            else            {                sw = File.AppendText(filePath);            }            sw.Write("访问时间:" DateTime.Now.ToString() Environment.NewLine);            sw.Close();        }    }}4.向工程中添加一个安装程序类。 4.在新添加的安装程序类中,设定服务的名称,启动方式,账号名和密码等信息。 代码 namespace WindowsService1{    partial class Installer1    {        ///         /// 必需的设计器变量。        ///         private System.ComponentModel.IContainer components = null;        private System.ServiceProcess.ServiceProcessInstaller spInstaller;        private System.ServiceProcess.ServiceInstaller sInstaller;        ///          /// 清理所有正在使用的资源。        ///         /// 如果应释放托管资源,为 true;否则为 false。        protected override void Dispose(bool disposing)        {            if (disposing && (components != null))            {                components.Dispose();            }            base.Dispose(disposing);        }        #region 组件设计器生成的代码        ///         /// 设计器支持所需的方法 - 不要        /// 使用代码编辑器修改此方法的内容。        ///         private void InitializeComponent()        {            components = new System.ComponentModel.Container();            // 创建ServiceProcessInstaller对象和ServiceInstaller对象            this.spInstaller =new System.ServiceProcess.ServiceProcessInstaller();            this.sInstaller = new System.ServiceProcess.ServiceInstaller();            // 设定ServiceProcessInstaller对象的帐号、用户名和密码等信息            this.spInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;            this.spInstaller.Password = null;            this.spInstaller.Username = null;            // 设定服务的名称            this.sInstaller.ServiceName = "WindowsService1";            //设定服务启动的方式            this.sInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;            this.Installers.AddRange(new System.Configuration.Install.Installer[] {            this.spInstaller,this.sInstaller});        }        #endregion    }}5.生成工程,在bin目录下会生成exe文件。如果直接运行exe文件的话,是不能执行的,需要使用安装Windows服务用到一个名为InstallUtil.exe的命令行工具,打开命令行工具,转到InstallUtil.exe的目录下,我安装的是VS 2010,对应的目录为:C:WindowsMicrosoft.NETFrameworkv4.0.30319InstallUtil.exe,然后执行InstallUtil.exe 待执行的exe文件的目录,如:InstallUtil.exe F:MyProjectWindowsService1WindowsService1inDebugWindowsService1.exe。执行成功后,会在Windows的服务中,出现了刚刚添加的服务的名称。 6.启动该服务,这时打开binDebug文件夹,发现已经生成了一个test.txt的文件,里面记录了时间。这说明服务已经正式开始执行。7.停止服务的操作也和简单,打开命令行工具,转到C:WindowsMicrosoft.NETFrameworkv4.0.30319目录,然后执行InstallUtil.exe - u F:MyProjectWindowsService1WindowsService1inDebugWindowsService1.exe命令就可以了。
    2015-04-21下载
    积分:1
  • c# 搜片神器源码
    c# 搜片神器源码
    2013-10-19下载
    积分:1
  • 半透明示例
    半透明示例
    2013-12-01下载
    积分:1
  • 简单验证码识别
    简单验证码识别
    2013-05-26下载
    积分:1
  • Jwt Sample(asp.net core)
    [Introduction of the example] Jwt的使用Demo# 包含内容- asp.net core集成jwt权限验证- token的强制失效- 对api接口进行基于策略模式的权限验证[Screenshot of the example] [Core code]
    2019-12-24下载
    积分:1
  • combobox 绑定多列 例子
    combobox 绑定多列 例子
    2015-06-12下载
    积分:1
  • 获取CPU ID 和 HD ID
    【实例简介】获取CPU ID 和 HD ID 获取CPU和硬盘ID,适合新手,简单明了
    2022-01-17 00:31:27下载
    积分:1
  • 软件公司网站源码(含前后台完整源码以及数据库)
    1.项目前台:LYSC.CompanyWeb.UI/Index.html2.项目后台:LYSC.CompanyWeb.UI/admin/Login/Login.aspx3.项目数据库脚本:LYSC.CompanyWeb.UI/DateFile4.项目说明以及开发流程:LYSC.CompanyWeb.UI/DateFile5.此项目是基于VS2012开发的,数据库是VS20126..NET版本是.net FrameWork 4.57.如须知道开发过程中遇到的问题,可以查看第4步的文件
    2015-06-28下载
    积分:1
  • 财务收据打印程序
    【实例简介】用于固定收据打印的程序
    2021-08-06 00:30:59下载
    积分:1
  • 696518资源总数
  • 105877会员总数
  • 14今日下载