Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            // this.ShowTitleBar = false;
            this.ShowIconOnTitleBar   = true;
            this.ShowMinButton        = true;
            this.ShowMaxRestoreButton = false;
            this.ShowCloseButton      = true;
            this.ResizeMode           = ResizeMode.CanMinimize;
            // this.SaveWindowPosition = true;
            this.LeftWindowCommandsOverlayBehavior  = WindowCommandsOverlayBehavior.Never;
            this.RightWindowCommandsOverlayBehavior = WindowCommandsOverlayBehavior.Never;
            this.image1.Source = EyeHelper.ChangeBitmapToImageSource(softwatcher.Properties.Resources.drag);

            // this.Flyouts1.Items.Add(new LoginFlyout());
            this.Flyouts1.Items.Add(new SettingsView());
            this.Flyouts1.Items.Add(new SetXiaohaoFlyout());
            new SoftContext(this);
            try
            {
                this.Topmost = bool.Parse(INIHelper.IniReadValue("BaseConfig", "Topmost", AppDomain.CurrentDomain.BaseDirectory + "\\config.ini"));
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 捕获或释放鼠标
        /// </summary>
        /// <param name="captured">true捕获,false释放</param>
        private void CaptureMouse(bool captured)
        {
            if (captured)
            {
                var hwnd = EyeHelper.SetCapture(new WindowInteropHelper(this).Handle);
                this.Cursor        = new Cursor(new MemoryStream(softwatcher.Properties.Resources.eye));
                this.image1.Source = EyeHelper.ChangeBitmapToImageSource(softwatcher.Properties.Resources.drag2);
            }
            else
            {
                this.image1.Source = EyeHelper.ChangeBitmapToImageSource(softwatcher.Properties.Resources.drag);
                this.Cursor        = Cursors.Arrow;

                var ret = EyeHelper.ReleaseCapture();
                if (this._hWndCurrent != IntPtr.Zero)
                {
                    // EyeHelper.DrawRevFrame(this._hWndCurrent); //还原边框
                    //this._hWndCurrent = IntPtr.Zero;
                }
            }
        }