예제 #1
0
        public Image GetFullScreenImage(VideoParameters v)
        {
            try
            {
                System.Drawing.Image MyImage = new Bitmap((int)SystemParameters.VirtualScreenWidth, (int)SystemParameters.VirtualScreenHeight);
                CURSORINFO           pci;
                pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
                GetCursorInfo(out pci);
                Graphics g = Graphics.FromImage(MyImage);
                g.CopyFromScreen(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, 0), new System.Drawing.Size((int)SystemParameters.VirtualScreenWidth, (int)SystemParameters.VirtualScreenHeight));

                System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);
                cur.Draw(g, new System.Drawing.Rectangle(pci.ptScreenPos.x - 10, pci.ptScreenPos.y - 10, cur.Size.Width, cur.Size.Height));


                Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
                MyImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
                Image img = MyImage.GetThumbnailImage(v.Height, v.Width, myCallback, IntPtr.Zero);
                return(img);
            }
            catch
            {
                throw;
            }
        }
예제 #2
0
 /// <summary>
 /// 桌面输出回调处理
 /// </summary>
 private void VideoNewFrameHandle(object sender, NewFrameEventArgs e)
 {
     if (IsRecording && !IsParsing)
     {
         TimeSpan time = DateTime.Now - beginTime - parseSpan;
         if (SettingHelp.Settings.捕获鼠标)
         {
             CURSORINFO pci;
             pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
             GetCursorInfo(out pci);
             try
             {
                 System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);//在每一帧上手动绘制鼠标
                 cur.Draw(Graphics.FromImage(e.Frame), new Rectangle(System.Windows.Forms.Cursor.Position.X - 10 - CurrentScreen.Bounds.X,
                                                                     System.Windows.Forms.Cursor.Position.Y - 10 - CurrentScreen.Bounds.Y, cur.Size.Width, cur.Size.Height));
             }
             catch { }//打开任务管理器时会导致异常
         }
         VideoWriter.WriteVideoFrame(e.Frame, time);//处理视频时长和实际物理时长不符,用帧间隔时长的办法指定每一帧的间隔
         FrameCount += 1;
         if (FrameCount == SettingHelp.Settings.视频帧率)
         {
             FrameCount = 0;
             Dispatcher.Invoke(new Action(() =>
             {
                 lbTime.Content = time.ToString("hh\\:mm\\:ss");
             }));
         }
     }
 }
        private Bitmap CaptureScreen()
        {
            var cursor = new System.Windows.Forms.Cursor(System.Windows.Forms.Cursor.Current.Handle);

            cursor = System.Windows.Forms.Cursors.Arrow;
            System.Drawing.Point cPoint   = System.Windows.Forms.Cursor.Position;
            System.Drawing.Point hotSpot  = cursor.HotSpot;
            System.Drawing.Point position = new System.Drawing.Point((cPoint.X - hotSpot.X), (cPoint.Y - hotSpot.Y));

            //プライマリモニタのデバイスコンテキストを取得
            IntPtr disDC = GetDC(IntPtr.Zero);
            //Bitmapの作成
            Bitmap bmp = new Bitmap(
                System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
                System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            //Graphicsの作成
            Graphics g = Graphics.FromImage(bmp);
            //Graphicsのデバイスコンテキストを取得
            IntPtr hDC = g.GetHdc();

            //Bitmapに画像をコピーする
            BitBlt(hDC, 0, 0, bmp.Width, bmp.Height,
                   disDC, 0, 0, SRCCOPY);
            //解放
            g.ReleaseHdc(hDC);

            //カーソルを追加
            cursor.Draw(g, new Rectangle(position, cursor.Size));

            g.Dispose();
            ReleaseDC(IntPtr.Zero, disDC);

            return(bmp);
        }
        private Bitmap GetScreenShot(int width, int height)
        {
            var cursor = new System.Windows.Forms.Cursor(System.Windows.Forms.Cursor.Current.Handle);

            System.Drawing.Point cPoint   = System.Windows.Forms.Cursor.Position;
            System.Drawing.Point hotSpot  = cursor.HotSpot;
            System.Drawing.Point position = new System.Drawing.Point((cPoint.X - hotSpot.X), (cPoint.Y - hotSpot.Y));

            var resizedBmp = new Bitmap(width, height);

            using (var bmp = new Bitmap((int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight))
                using (Graphics g = Graphics.FromImage(bmp))
                    using (Graphics resizedG = Graphics.FromImage(resizedBmp)) {
                        // スクリーンショットを撮る
                        g.CopyFromScreen(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, 0), bmp.Size);

                        cursor.Draw(g, new Rectangle(position, cursor.Size));

                        // 動画サイズを減らすためリサイズする
                        resizedG.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bilinear;
                        resizedG.DrawImage(bmp, 0, 0, width, height);
                    }

            return(resizedBmp);
        }
예제 #5
0
 /// <summary>
 /// 记录运行时间很长的任务的进度
 /// </summary>
 /// <param name="aCurrentPosition">任务执行的当前位置</param>
 /// <param name="aLastPosition">任务完成时的位置</param>
 public void Progress(int aCurrentPosition, int aLastPosition)
 {
     if (aCurrentPosition >= aLastPosition) //到达了进度条的最后,停止显示进度条
     {
         Program.frmMain.m_StatusBar.ProgressBarValue = aLastPosition;
         Program.frmMain.m_StatusBar.ShowProgressBar  = false;
         if (m_OrigCursor != null)
         {
             Program.frmMain.Cursor = m_OrigCursor;
         }
         else
         {
             Program.frmMain.Cursor = System.Windows.Forms.Cursors.Default;
         }
     }
     else // 长时间任务仍在执行,设置进度条值
     {
         try
         {
             if (!Program.frmMain.m_StatusBar.ShowProgressBar || m_OrigCursor == null)
             {
                 m_OrigCursor = Program.frmMain.Cursor; //保存鼠标样式,当进度条开始时使用
                 Program.frmMain.m_StatusBar.ShowProgressBar = true;
             }
             Program.frmMain.m_StatusBar.ProgressBarValue = (100 * aCurrentPosition) / aLastPosition;
             System.Windows.Forms.Cursor.Current          = System.Windows.Forms.Cursors.WaitCursor;
         }
         catch
         {
             throw new Exception("在更新进度条时出现异常!");
         }
     }
 }
예제 #6
0
        void HandleXnaUpdate()
        {
            mCursor.Activity(TimeManager.Self.CurrentTime);

            // I think we only want to do this if we're actually in the window
            // No, we want to always do it otherwise the user can't delete guides.
            // We will make checks internally
            //if (mCursor.IsInWindow)
            {
                if (mCursor.IsInWindow)
                {
                    System.Windows.Forms.Cursor cursorToSet = System.Windows.Forms.Cursors.Arrow;

                    System.Windows.Forms.Cursor.Current = cursorToSet;
                    this.mControl.Cursor = cursorToSet;
                }
                this.mLeftRuler.HandleXnaUpdate(mCursor.IsInWindow);
                this.mTopRuler.HandleXnaUpdate(mCursor.IsInWindow);
            }



            if (mCursor.IsInWindow)
            {
                StatusBarManager.Self.SetCursorPosition(
                    mCursor.GetWorldX(mManagers),
                    mCursor.GetWorldY(mManagers));
            }
        }
예제 #7
0
        public byte[] GetDesktopBitmapBytes()
        {
            Size     DesktopBitmapSize = GetDesktopBitmapSize();
            Graphics Graphic           = Graphics.FromHwnd(GetDesktopWindow());
            Bitmap   MemImage          = new Bitmap(DesktopBitmapSize.Width, DesktopBitmapSize.Height, Graphic);

            Graphics MemGraphic = Graphics.FromImage(MemImage);
            IntPtr   dc1        = Graphic.GetHdc();
            IntPtr   dc2        = MemGraphic.GetHdc();

            BitBlt(dc2, 0, 0, DesktopBitmapSize.Width, DesktopBitmapSize.Height, dc1, 0, 0, SRCCOPY);
            Graphic.ReleaseHdc(dc1);
            MemGraphic.ReleaseHdc(dc2);
            Graphic.Dispose();
            MemGraphic.Dispose();

            Graphics g = System.Drawing.Graphics.FromImage(MemImage);

            System.Windows.Forms.Cursor cur = System.Windows.Forms.Cursors.Arrow;
            //cur.Draw(g, new Rectangle(System.Windows.Forms.Cursor.Position.X - 10, System.Windows.Forms.Cursor.Position.Y - 10, cur.Size.Width, cur.Size.Height));
            cur.Draw(g, new Rectangle(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y, cur.Size.Width, cur.Size.Height));

            MemoryStream ms = new MemoryStream();

            MemImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            return(ms.GetBuffer());
        }
        /// <summary>
        /// Public function that will remove an entry for an Assignment Manager course from
        /// the user's courses.xml file.
        /// </summary>
        /// <param name="guid"> The unique GUID denoting the course </param>
        public bool UnregisterAssignmentManagerCourse(string guid)
        {
            Microsoft.Win32.RegistryKey key = null;
            string strDestinationDirectory  = "";
            string strCoursesFile           = "";
            string strURL = "";

            System.Xml.XmlDocument      xmlDoc = null;
            System.Xml.XmlNode          xmlNode = null, xmlPathNode = null;
            System.Xml.XmlNodeList      xmlNodes = null;
            System.Windows.Forms.Cursor old      = System.Windows.Forms.Cursor.Current;

            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(s_strShellFolderHive);
                strDestinationDirectory = key.GetValue(s_strAppDataValueName) + s_strLocalTabPath;
                strCoursesFile          = strDestinationDirectory + s_strCoursesFile;

                xmlDoc = new System.Xml.XmlDocument();
                try
                {
                    xmlDoc.Load(strCoursesFile);
                }
                catch (System.Exception)
                {
                    return(false);
                }

                if ((xmlNode = xmlDoc.SelectSingleNode("/studentcourses/course[assnmgr/guid='" + EscapeStringForXPath(guid) + "']")) != null)
                {
                    if (((xmlPathNode = xmlDoc.SelectSingleNode("/studentcourses/course/assnmgr[guid='" + EscapeStringForXPath(guid) + "']")) != null) &&
                        ((xmlPathNode = xmlPathNode.SelectSingleNode("amurl")) != null))
                    {
                        strURL = xmlPathNode.InnerText;
                    }
                    xmlNode.ParentNode.RemoveChild(xmlNode);
                    xmlDoc.PreserveWhitespace = true;
                    xmlDoc.Save(strCoursesFile);
                    if (((xmlNodes = xmlDoc.SelectNodes("/studentcourses/course")) == null) ||
                        (xmlNodes.Count == 0))
                    {
                        RegenerateUserCustomTab(true);
                    }
                    else
                    {
                        RegenerateUserCustomTab(false);
                    }
                }
            }
            catch (System.Exception)
            {
                System.Windows.Forms.Cursor.Current = old;
                return(false);
            }

            System.Windows.Forms.Cursor.Current = old;
            return(true);
        }
예제 #9
0
파일: awt.cs 프로젝트: kixtarte/cadencii
 public Cursor( int type ) {
     m_type = type;
     if ( m_type == CROSSHAIR_CURSOR ) {
         cursor = System.Windows.Forms.Cursors.Cross;
     } else if ( m_type == HAND_CURSOR ) {
         cursor = System.Windows.Forms.Cursors.Hand;
     } else if ( m_type == TEXT_CURSOR ) {
         cursor = System.Windows.Forms.Cursors.IBeam;
     } else if ( m_type == E_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanEast;
     } else if ( m_type == NE_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanNE;
     } else if ( m_type == N_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanNorth;
     } else if ( m_type == NW_RESIZE_CURSOR ) {
         cursor = System.Windows.Forms.Cursors.PanNW;
     } else if ( m_type == SE_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanSE;
     } else if ( m_type == S_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanSouth;
     } else if ( m_type == SW_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanSW;
     } else if( m_type == W_RESIZE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.PanWest;
     } else if ( m_type == MOVE_CURSOR ){
         cursor = System.Windows.Forms.Cursors.SizeAll;
     }
 }
예제 #10
0
        //------------------------------------------------------------------------------------------07.03.2005
    #if !WindowsCE
        /// <summary>Shows the specified PDF document in a maximized window after that it has been created.</summary>
        /// <param name="report">Report object that creates the PDF document</param>
        /// <exception cref="ReportException">
        /// The acrobat reader has not been installed, the registry entry is invalid or the reader cannot be started.
        /// </exception>
        /// <remarks>
        /// This method will create the specified PDF document.
        /// The resulting file will be stored in the current user's temporary folder.
        /// After that the document will be displayed in the acrobat reader in a maximized window.
        /// </remarks>
        /// <example>
        /// <code>
        /// RT.ViewPDF(new DetailReport());
        /// </code>
        /// </example>
        public static void ViewPDF(Report report)
        {
      #if !NETCOREAPP
            System.Windows.Forms.Form   form    = System.Windows.Forms.Form.ActiveForm;
            System.Windows.Forms.Cursor cur_Old = System.Windows.Forms.Cursors.Default;
            try {
                if (form != null)
                {
                    cur_Old     = form.Cursor;
                    form.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                }
      #endif

            String sFileName = Path.GetTempFileName();
            report.Save(sFileName);
            ViewPDF(sFileName);

      #if !NETCOREAPP
        }
        finally {
            if (form != null)
            {
                form.Cursor = cur_Old;
            }
        }
      #endif
        }
예제 #11
0
        public MusicList()
        {
            DuiBaseControl b = new DuiBaseControl();

            b.Size      = new Size(Width, 35);
            b.BackColor = Color.Transparent;
            DuiLabel l = new DuiLabel();

            l.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
            l.Location       = new Point(30, 8);
            l.AutoSize       = true;
            l.Font           = new Font("微软雅黑", 11F, FontStyle.Bold);
            l.ForeColor      = Color.White;
            l.Text           = "这个列表没有音乐哦\n您可以直接把音乐拖到这里来";
            l.Name           = "name";
            b.Controls.Add(l);
            b.Name      = "no";
            b.Visible   = false;
            no          = b;
            tx.Interval = 100;
            tx.Tick    += Tx_Tick;
            t.Interval  = 100;
            t.Tick     += T_Tick;
            t1.Interval = 500;
            t1.Tick    += T1_Tick;
            cs          = new System.Windows.Forms.Cursor(Properties.Resources.music_move.GetHicon());
            MouseMove  += MusicList_MouseMove;
        }
예제 #12
0
        public override void OnCreate(object hook)
        {
            _context        = hook as IAppContext;
            this.m_caption  = "旋转要素";
            this.m_category = "编辑器";
            this.m_name     = "Edit_RotateFeature";
            this._key       = "Edit_RotateFeature";
            this.m_message  = "旋转要素";
            this.m_toolTip  = "旋转要素";
            this.m_bitmap   = Properties.Resources.icon_edit_rotate;
            this.m_cursor   = new System.Windows.Forms.Cursor(new MemoryStream(Resource.Digitise));
            this.bool_2     = false;

            this.cursor_0 =
                new System.Windows.Forms.Cursor(
                    base.GetType()
                    .Assembly.GetManifestResourceStream("Yutai.Plugins.Editor.Resources.Cursor.RotateFeature.cur"));

            this.isimpleMarkerSymbol_0.Style   = esriSimpleMarkerStyle.esriSMSCircle;
            this.isimpleMarkerSymbol_0.Size    = 8.0;
            this.isimpleMarkerSymbol_0.Outline = true;
            this.isimpleMarkerSymbol_0.Color   = ColorManage.GetRGBColor(0, 255, 255);
            this.cursor_1 =
                new System.Windows.Forms.Cursor(
                    base.GetType()
                    .Assembly.GetManifestResourceStream("Yutai.Plugins.Editor.Resources.Cursor.VertexEdit.cur"));
            this.m_cursor = this.cursor_0;

            DisplayStyleYT                   = DisplayStyleYT.Image;
            base.TextImageRelationYT         = TextImageRelationYT.ImageAboveText;
            base.ToolStripItemImageScalingYT = ToolStripItemImageScalingYT.None;
            _itemType         = RibbonItemType.Button;
            this.snapHelper_0 = new SnapHelper(_context.FocusMap as IActiveView,
                                               _context.Config.EngineSnapEnvironment);
        }
예제 #13
0
        public static Rectangle Bounds(this System.Windows.Forms.Cursor cursor)
        {
            using (var bmp = new Bitmap(cursor.Size.Width, cursor.Size.Height))
            {
                using (var g = Graphics.FromImage(bmp))
                {
                    g.Clear(Color.Transparent);
                    cursor.Draw(g, new Rectangle(Point.Empty, bmp.Size));

                    var xMin = bmp.Width;
                    var xMax = -1;
                    var yMin = bmp.Height;
                    var yMax = -1;

                    for (var x = 0; x < bmp.Width; x++)
                    {
                        for (var y = 0; y < bmp.Height; y++)
                        {
                            if (bmp.GetPixel(x, y).A > 0)
                            {
                                xMin = Math.Min(xMin, x);
                                xMax = Math.Max(xMax, x);
                                yMin = Math.Min(yMin, y);
                                yMax = Math.Max(yMax, y);
                            }
                        }
                    }
                    return(new Rectangle(new Point(xMin, yMin), new Size((xMax - xMin) + 1, (yMax - yMin) + 1)));
                }
            }
        }
예제 #14
0
#pragma warning disable VSTHRD100 // Avoid async void methods - ok as an event handler
        private async void Execute(object sender, EventArgs e)
#pragma warning restore VSTHRD100 // Avoid async void methods
        {
            System.Windows.Forms.Cursor previousCursor = System.Windows.Forms.Cursor.Current;
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

            try
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                this.Logger?.RecordFeatureUsage(nameof(AnalyzeCurrentDocumentCommand));

                var dte = await Instance.AsyncPackage.GetServiceAsync <DTE, DTE>();

                var vs = new VisualStudioAbstraction(this.Logger, this.AsyncPackage, dte);

                var filePath = vs.GetActiveDocumentFilePath();

                // Ensure that the open document has been saved so get latest version
                var rdt = new RunningDocumentTable(Package);
                rdt.SaveFileIfDirty(filePath);

                RapidXamlDocumentCache.Invalidate(filePath);
                RapidXamlDocumentCache.TryUpdate(filePath);
            }
            catch (Exception exc)
            {
                this.Logger?.RecordException(exc);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = previousCursor;
            }
        }
예제 #15
0
        /// <returns>Returns the cursor object from the stream.</returns>
        /// <param name="existingInstance">Existing cursor object to read into.</param>
        /// <param name="input">Content reader used to read the cursor.</param>
        /// <summary>
        /// Reads a cursor type from the current stream.
        /// </summary>
        protected override Cursor Read(ContentReader input, Cursor existingInstance)
        {
            if (existingInstance == null)
            {
                var count = input.ReadInt32();
                var data  = input.ReadBytes(count);

                var path = Path.GetTempFileName();
                File.WriteAllBytes(path, data);
                var tPath = Path.GetTempFileName();
                using (var i = Icon.ExtractAssociatedIcon(path))
                {
                    using (var b = i.ToBitmap())
                    {
                        b.Save(tPath, ImageFormat.Png);
                        b.Dispose();
                    }

                    i.Dispose();
                }
                var handle = NativeMethods.LoadCursor(path);
                var c      = new System.Windows.Forms.Cursor(handle);
                var hs     = new Vector2(c.HotSpot.X, c.HotSpot.Y);
                var w      = c.Size.Width;
                var h      = c.Size.Height;
                c.Dispose();
                File.Delete(path);

                return(new Cursor(tPath, hs, w, h));
            }

            return(existingInstance);
        }
예제 #16
0
        public override System.Windows.Forms.Cursor GetWindowsCursorToShow(
            System.Windows.Forms.Cursor defaultCursor, float worldXAt, float worldYAt)
        {
            System.Windows.Forms.Cursor cursorToSet = defaultCursor;


            switch (SideOver)
            {
            case ResizeSide.TopLeft:
            case ResizeSide.BottomRight:
                cursorToSet = System.Windows.Forms.Cursors.SizeNWSE;
                break;

            case ResizeSide.TopRight:
            case ResizeSide.BottomLeft:
                cursorToSet = System.Windows.Forms.Cursors.SizeNESW;
                break;

            case ResizeSide.Top:
            case ResizeSide.Bottom:
                cursorToSet = System.Windows.Forms.Cursors.SizeNS;
                break;

            case ResizeSide.Left:
            case ResizeSide.Right:
                cursorToSet = System.Windows.Forms.Cursors.SizeWE;
                break;

            case ResizeSide.None:

                break;
            }
            return(cursorToSet);
        }
예제 #17
0
파일: DrawArgs.cs 프로젝트: Fav/testww
        public void Dispose()
        {
            foreach (IDisposable font in fontList.Values)
            {
                if (font != null)
                {
                    font.Dispose();
                }
            }
            fontList.Clear();

            if (measureCursor != null)
            {
                measureCursor.Dispose();
                measureCursor = null;
            }

            if (DownloadQueue != null)
            {
                DownloadQueue.Dispose();
                DownloadQueue = null;
            }

            GC.SuppressFinalize(this);
        }
예제 #18
0
        public override void OnCreate(object hook)
        {
            _context        = hook as IAppContext;
            base.m_caption  = "三点矩形工具";
            base.m_category = "Editor";
            base.m_bitmap   = Properties.Resources.icon_sketch_rectangle;
            m_cursor        = new Cursor(new MemoryStream(Resource.Digitise));
            base.m_name     = "Editor_Sketch_Rectangle2";
            base._key       = "Editor_Sketch_Rectangle2";
            base.m_toolTip  = "三点矩形工具";
            base._itemType  = RibbonItemType.Tool;
            this.simpleMarkerSymbol.Style   = esriSimpleMarkerStyle.esriSMSCircle;
            this.simpleMarkerSymbol.Size    = 8;
            this.simpleMarkerSymbol.Outline = true;
            this.simpleMarkerSymbol.Color   = ColorManage.GetRGBColor(0, 255, 255);

            simpleFillSymbol.Style   = esriSimpleFillStyle.esriSFSSolid;
            simpleFillSymbol.Color   = ColorManage.GetRGBColor(0, 255, 255);
            simpleFillSymbol.Outline = new SimpleLineSymbol()
            {
                Width = 1,
                Color = ColorManage.GetRGBColor(255, 0, 0)
            };
            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            simpleLineSymbol.Width = 1;
            simpleLineSymbol.Color = ColorManage.GetRGBColor(255, 0, 0);
        }
예제 #19
0
 /// <summary>
 /// 桌面输出回调
 /// </summary>
 private void VideoNewFrame(object sender, NewFrameEventArgs e)
 {
     if (isRecording && !isParsing)
     {
         if (SettingHelp.Settings.捕获鼠标)
         {
             var        g = System.Drawing.Graphics.FromImage(e.Frame);
             CURSORINFO pci;
             pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
             GetCursorInfo(out pci);
             try
             {
                 System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);
                 cur.Draw(g, new System.Drawing.Rectangle(System.Windows.Forms.Cursor.Position.X - 10, System.Windows.Forms.Cursor.Position.Y - 10, cur.Size.Width, cur.Size.Height));
             }
             catch { }//打开任务管理器时会导致异常
         }
         videoWriter.WriteVideoFrame(e.Frame);
         System.Threading.Tasks.Task.Factory.StartNew(() =>
         {
             FrameCount += 1;
             if (FrameCount == SettingHelp.Settings.视频帧率)//凑够一个帧组加1s1,一切努力都是为了使实际视频时长和显示的时长高度匹配
             {
                 FrameCount = 0;
                 videoSpan  = videoSpan.Add(new TimeSpan(0, 0, 0, 1));
                 Dispatcher.Invoke(new Action(() =>
                 {
                     lbTime.Content = videoSpan.ToString("hh\\:mm\\:ss");
                 }));
             }
         });
     }
 }
예제 #20
0
 public static void SetCursor(System.Windows.Forms.Cursor cursor)
 {
     if (SetCursorEvent != null)
     {
         SetCursorEvent(cursor);
     }
 }
예제 #21
0
        public override void Stop()
        {
            if (timer != null)
            {
                timer.Stop();
            }
            foreach (KeyValuePair <IntPtr, CursorData> pair in deviceList)
            {
                pair.Value.CloseCursor();
            }
            if (lowLevelMouseHook != null)
            {
                lowLevelMouseHook.Unhook();
            }
            WFCursor.Show();
            RawDevice.UnregisterRawDevices(0x01, 0x02);
            RawDevice.RawInput -= RawDevice_RawInput;
            isRunning           = false;

            System.Windows.Forms.Application.Exit();

            deviceList.Clear();
            historyList.Clear();
            currentList.Clear();
        }
예제 #22
0
 /// <summary>
 /// Creates new instance and changes current cursor to WaitCursor.
 /// </summary>
 public WaitCursor()
 {
     lock (_syncRoot) {
         _oldCursor = System.Windows.Forms.Cursor.Current;
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
     }
 }
예제 #23
0
 /// <summary>
 /// Display an appropriate cursor while the drag is in progress:
 /// Up-down arrow if we are inside the original compartment.
 /// No entry if we are elsewhere.
 /// </summary>
 /// <param name="currentCursor"></param>
 /// <param name="diagramClientView"></param>
 /// <param name="mousePosition"></param>
 /// <returns></returns>
 public override System.Windows.Forms.Cursor GetCursor(System.Windows.Forms.Cursor currentCursor, DiagramClientView diagramClientView, PointD mousePosition)
 {
     // If the cursor is inside the original compartment, show up-down cursor.
     return(sourceCompartmentBounds.Contains(mousePosition)
      ? System.Windows.Forms.Cursors.SizeNS // Up-down arrow.
      : System.Windows.Forms.Cursors.No);
 }
예제 #24
0
파일: BaseTool.cs 프로젝트: secondii/Yutai
 protected BaseTool(Bitmap bitmap_0, string string_0, string string_1, System.Windows.Forms.Cursor cursor_0,
                    int int_0, string string_2, string string_3, string string_4, string string_5)
     : base(bitmap_0, string_0, string_1, int_0, string_2, string_3, string_4, string_5)
 {
     this.m_deactivate = true;
     this.m_cursor     = cursor_0;
 }
예제 #25
0
        void IPdfOverlayView.SetCursor(System.Windows.Forms.Cursor cursor)
        {
            Cursor c;

            if (cursor == System.Windows.Forms.Cursors.Arrow)
            {
                c = Cursors.Arrow;
            }
            else if (cursor == System.Windows.Forms.Cursors.Hand)
            {
                c = Cursors.Hand;
            }
            else if (cursor == System.Windows.Forms.Cursors.UpArrow)
            {
                c = Cursors.UpArrow;
            }
            else if (cursor == System.Windows.Forms.Cursors.Cross)
            {
                c = Cursors.Cross;
            }
            else if (cursor == System.Windows.Forms.Cursors.No)
            {
                c = Cursors.No;
            }
            else
            {
                throw new NotImplementedException();
            }

            canvas1.Cursor = c;
        }
예제 #26
0
        public void TranslateEdi860File(string sPath, string sSefPath, string sAcceptPath, string sEdiDonePath)
        {
            try
            {
                string sPrevEdiFile = "";
                //string sPath = AppDomain.CurrentDomain.BaseDirectory;
                //string sSefPath = sPath + ConfigurationManager.AppSettings["Seffolder"] + @"\";
                //string sAcceptPath = sPath + ConfigurationManager.AppSettings["EDI_Accepted"] + @"\860\";
                //string sEdiDonePath = sPath + ConfigurationManager.AppSettings["EDI_DONE"] + @"\";

                int nFileCount = 0;

                string[] sEdiPathFiles = Directory.GetFiles(sAcceptPath);

                if (sEdiPathFiles.Length == 0)
                {
                    //MessageBox.Show("There are no files in the EDI_Accepted folder.");
                }
                else
                {
                    System.Windows.Forms.Cursor Cursor = System.Windows.Forms.Cursors.WaitCursor;

                    PetSmart860 oPetSmart860 = new PetSmart860(sSefPath + "PetSmart_860_006010.EVAL30.SEF");

                    foreach (string sEdiPathFile in sEdiPathFiles)
                    {
                        oPetSmart860.Translate(sEdiPathFile);

                        string sEdiFile = Path.GetFileName(sEdiPathFile);

                        File.Copy(sAcceptPath + sEdiFile, sEdiDonePath + sEdiFile, true);

                        if (File.Exists(sEdiDonePath + sPrevEdiFile))
                        {
                            File.Delete(sAcceptPath + sPrevEdiFile);
                        }

                        sPrevEdiFile = sEdiFile;

                        nFileCount = nFileCount + 1;
                    } // foreach

                    oPetSmart860.Close();

                    if (File.Exists(sEdiDonePath + sPrevEdiFile))
                    {
                        File.Delete(sAcceptPath + sPrevEdiFile);
                    }

                    //MessageBox.Show("Done. " + nFileCount.ToString() + " file(s) translated.");

                    Cursor = System.Windows.Forms.Cursors.Default;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public static void Collected(Int32 numberIterations)
 {
     for (int i = 0; i < numberIterations; ++i)
     {
         System.Windows.Forms.Cursor cu = new System.Windows.Forms.Cursor(ms);
         ms.Position = 0;
     }
 }
예제 #28
0
 public void OnCreate(object hook)
 {
     m_pHookHelper.Hook = hook;
     m_enabled          = true;
     m_check            = false;
     m_cursor           = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "Hand.cur"));
     m_cursorMove       = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "MoveHand.cur"));
 }
예제 #29
0
        public static void Load()
        {
            using (var stream = GetGrabCursor())
                GrabCursor = new System.Windows.Forms.Cursor(stream);

            using (var stream = GetGrabbingCursor())
                GrabbingCursor = new System.Windows.Forms.Cursor(stream);
        }
        private static void ResizeCursor(System.Windows.Forms.Cursor cursor,
                                         int newSize, CursorShift cursorShift)
        {
            Bitmap cursorImage = GetSystemCursorBitmap(cursor);

            cursorImage = ResizeCursorBitmap(cursorImage, new Size(newSize, newSize), cursorShift);
            SetCursor(cursorImage, getResourceId(cursor));
        }
        private static uint getResourceId(System.Windows.Forms.Cursor cursor)
        {
            FieldInfo fi = typeof(System.Windows.Forms.Cursor).GetField(
                "resourceId", BindingFlags.NonPublic | BindingFlags.Instance);
            object obj = fi.GetValue(cursor);

            return(Convert.ToUInt32((int)obj));
        }
예제 #32
0
		public void ApplyCursor(System.Windows.Forms.Control control)
		{
			if (mControl == null)
			{
				mControl = control;
				mOldCursor = mControl.Cursor;
				mControl.Cursor = mCursor;
			}
		}
예제 #33
0
 static Resources()
 {
     using (System.IO.MemoryStream mem = new System.IO.MemoryStream(Properties.Resources.CURSOR_Right))
     {
         mRightArrow = new System.Windows.Forms.Cursor(mem);
     }
     using (System.IO.MemoryStream mem = new System.IO.MemoryStream(Properties.Resources.CURSOR_Left))
     {
         mLeftArrow = new System.Windows.Forms.Cursor(mem);
     }
 }
예제 #34
0
        public Image GetFullScreenImage(VideoParameters v)
        {
            try
            {
                System.Drawing.Image MyImage = new Bitmap((int)SystemParameters.VirtualScreenWidth, (int)SystemParameters.VirtualScreenHeight);
                CURSORINFO pci;
                pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
                GetCursorInfo(out pci);
                Graphics g = Graphics.FromImage(MyImage);
                g.CopyFromScreen(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, 0), new System.Drawing.Size((int)SystemParameters.VirtualScreenWidth, (int)SystemParameters.VirtualScreenHeight));

                System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);
                cur.Draw(g, new System.Drawing.Rectangle(pci.ptScreenPos.x - 10, pci.ptScreenPos.y - 10, cur.Size.Width, cur.Size.Height));

                Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
                MyImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
                Image img = MyImage.GetThumbnailImage(v.Height, v.Width, myCallback, IntPtr.Zero);
                return img;
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// Returns move cursor. Methods creates it if necessary.
        /// </summary>
        /// <returns>Returns move cursor.</returns>
        private System.Windows.Forms.Cursor _GetMoveCursor()
        {
            if (_moveCursor == null)
                _moveCursor = _CreateCursor(System.Windows.Forms.Cursors.Arrow);

            return _moveCursor;
        }
        /// <summary>
        /// Create cursor from canvas.
        /// </summary>
        /// <param name="canvas">Input canvas.</param>
        /// <param name="hotSpotPoint">Hotspot cursor point.</param>
        /// <returns>Created cursor.</returns>
        private System.Windows.Forms.Cursor _CreateCursorFromCanvas(Canvas canvas, System.Drawing.Point hotSpotPoint)
        {
            // Render canvas to bitmap.
            RenderTargetBitmap targetBitmap = new RenderTargetBitmap((int)canvas.ActualWidth, (int)canvas.ActualHeight, BASIC_DPI, BASIC_DPI, PixelFormats.Pbgra32);
            targetBitmap.Render(canvas);

            // Create PNG encoder.
            PngBitmapEncoder encoder = new PngBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(targetBitmap));

            // Render target bitmap to System.Drawing bitmap.
            System.Drawing.Bitmap bmp;
            using (MemoryStream stream = new MemoryStream())
            {
                encoder.Save(stream);
                bmp = new System.Drawing.Bitmap(stream);
            }

            // Create cursor.
            WinAPIHelpers.IconInfo iconInfo = new WinAPIHelpers.IconInfo();
            IntPtr hIcon = bmp.GetHicon();
            WinAPIHelpers.GetIconInfo(hIcon, ref iconInfo);
            iconInfo.xHotspot = hotSpotPoint.X;
            iconInfo.yHotspot = hotSpotPoint.Y;
            iconInfo.fIcon = false;
            IntPtr cursorHandle = WinAPIHelpers.CreateIconIndirect(ref iconInfo);

            // Destroy icon obtained from GetHicon method.
            if (hIcon != IntPtr.Zero)
                WinAPIHelpers.DestroyIcon(hIcon);

            // Free resources.
            if (iconInfo.hbmColor != IntPtr.Zero)
                WinAPIHelpers.DeleteObject(iconInfo.hbmColor);
            if (iconInfo.hbmMask != IntPtr.Zero)
                WinAPIHelpers.DeleteObject(iconInfo.hbmMask);

            System.Windows.Forms.Cursor cursor = null;
            if (cursorHandle != null)
                cursor = new System.Windows.Forms.Cursor(cursorHandle);

            return cursor;
        }
예제 #37
0
파일: RPG.cs 프로젝트: ChrisVolkoff/DeRPG
 public static System.Windows.Forms.Cursor LoadCustomCursor(string path)
 {
     IntPtr hCurs = LoadCursorFromFile(path);
     if (hCurs == IntPtr.Zero) throw new Win32Exception();
     var curs = new System.Windows.Forms.Cursor(hCurs);
     // Note: force the cursor to own the handle so it gets released properly
     var fi = typeof(System.Windows.Forms.Cursor).GetField("ownHandle", BindingFlags.NonPublic | BindingFlags.Instance);
     fi.SetValue(curs, true);
     return curs;
 }
        /// <summary>
        /// Returns none cursor. Methods creates it if necessary.
        /// </summary>
        /// <returns>Returns none cursor.</returns>
        private System.Windows.Forms.Cursor _GetNoneCursor()
        {
            if (_noneCursor == null)
                _noneCursor = _CreateCursor(System.Windows.Forms.Cursors.No);

            return _noneCursor;
        }
예제 #39
0
		public Pan()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Pan";
			base.m_toolTip = "Pan";
			base.m_name = "Sample_SceneControl(C#)/Pan";
			base.m_message = "Pans the scene";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.pan.bmp"));
			}
			m_pCursorStop = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.HAND.CUR"));
			m_pCursorMove = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.movehand.cur"));
		
			m_pSceneHookHelper = new SceneHookHelperClass ();
		}
		public SelectFeatures()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Select Features";
			base.m_toolTip = "Select Features";
			base.m_name = "Sample_SceneControl(C#)/SelectFeatures";
			base.m_message = "Select features by clicking";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.SelectFeatures.bmp"));
			}
			m_pCursor = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.SelectFeatures.cur"));
		
			m_pSceneHookHelper = new SceneHookHelperClass ();
		}
		public ZoomInOut()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Zoom In/Out";
			base.m_toolTip = "Zoom In/Out";
			base.m_name = "Sample_SceneControl(C#)/Zoom In/Out";
			base.m_message = "Dynamically zooms in and out on the scene";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.ZoomInOut.bmp"));
			}
			m_pCursor = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.ZOOMINOUT.CUR"));
		
			m_pSceneHookHelper = new SceneHookHelperClass ();
		}
예제 #42
0
 void setCursor(Canguro.Controller.WaitingFor selectionFilter)
 {
     // Set cursor
     if (selectionFilter == Canguro.Controller.WaitingFor.Point)
         cursor = cursorSelect;
     else if ((selectionFilter == Canguro.Controller.WaitingFor.SimpleValue) ||
             (selectionFilter == Canguro.Controller.WaitingFor.Text) ||
             (selectionFilter == Canguro.Controller.WaitingFor.None))
         cursor = cursorDefault;
     else
         cursor = cursorPick;
 }
		public TargetZoom()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Target Zoom";
			base.m_toolTip = "Zoom to Target";
			base.m_name = "Sample_SceneControl(C#)/TargetZoom";
			base.m_message = "Zoom to selected target";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.TargetZoom.bmp"));
			}
			m_pCursor = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.targetzoom.cur"));
		
			m_pSceneHookHelper = new SceneHookHelperClass ();
		}
		public void OnCreate(object hook)
		{
			m_pHookHelper.Hook = hook;
			m_zoomOutCur = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "ZoomOut.cur"));
			m_moveZoomOutCur = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "MoveZoomOut.cur"));
		}
예제 #45
0
		public ControlCursor(System.Windows.Forms.Cursor pCursor)
		{
			mCursor = pCursor;
		}
예제 #46
0
        public void UpdateMouseCursor(System.Windows.Forms.Control parent)
        {
            if(lastCursor == mouseCursor)
                return;

            switch( mouseCursor )
            {
                case CursorType.Hand:
                    parent.Cursor = System.Windows.Forms.Cursors.Hand;
                    break;
                case CursorType.Cross:
                    parent.Cursor = System.Windows.Forms.Cursors.Cross;
                    break;
                case CursorType.Measure:
                    if(measureCursor == null)
                        measureCursor = ImageHelper.LoadCursor("measure.cur");
                    parent.Cursor = measureCursor;
                    break;
                case CursorType.SizeWE:
                    parent.Cursor = System.Windows.Forms.Cursors.SizeWE;
                    break;
                case CursorType.SizeNS:
                    parent.Cursor = System.Windows.Forms.Cursors.SizeNS;
                    break;
                case CursorType.SizeNESW:
                    parent.Cursor = System.Windows.Forms.Cursors.SizeNESW;
                    break;
                case CursorType.SizeNWSE:
                    parent.Cursor = System.Windows.Forms.Cursors.SizeNWSE;
                    break;
                default:
                    parent.Cursor = System.Windows.Forms.Cursors.Arrow;
                    break;
            }
            lastCursor = mouseCursor;
        }
예제 #47
0
        public void Dispose()
        {
            foreach(IDisposable font in fontList.Values)
            {
                if(font!=null)
                {
                    font.Dispose();
                }
            }
            fontList.Clear();

            if(measureCursor!=null)
            {
                measureCursor.Dispose();
                measureCursor = null;
            }

            if(DownloadQueue != null)
            {
                DownloadQueue.Dispose();
                DownloadQueue = null;
            }

            GC.SuppressFinalize(this);
        }
예제 #48
0
 public ApplyCursorMessage(int id, System.Windows.Forms.Cursor cursor) : base(id) {
     gCursor = cursor;
 }
		public SelectFeatures()
		{
			//Create an IHookHelper object
            m_hookHelper = new HookHelperClass();

			//Set the tool properties
			base.m_caption = "Select Features";
			base.m_category = "Sample_Select(C#)";
			base.m_name = "Sample_Select(C#)_Select Features";
			base.m_message = "Selects Features By Rectangle Or Single Click";
			base.m_toolTip = "Selects Features";
			base.m_deactivate = true;
			base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream(GetType(), "SelectFeatures.bmp"));
            m_CursorMove = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "SelectFeatures.cur"));
		}
예제 #50
0
		public Fly()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Fly";
			base.m_toolTip = "Fly";
			base.m_name = "Sample_SceneControl(C#)/Fly";
			base.m_message = "Flies through the scene";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.fly.bmp"));
			}
			m_flyCur = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.fly.cur"));
			m_moveFlyCur = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.fly1.cur"));
			m_pSceneHookHelper = new SceneHookHelperClass ();
			m_iSpeed = 0;
		}
예제 #51
0
 private Selection()
 {
     cursor = cursorDefault;
 }
예제 #52
0
        public Image GetRectangleScreenshot(VideoParameters v)
        {
            try
            {
                int videoWidth = (int)SystemParameters.VirtualScreenWidth;
                int videoHeight = (int)SystemParameters.VirtualScreenHeight;
                System.Drawing.Image MyImage = new Bitmap(v.Width,v.Height );
                CURSORINFO pci;
                pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO));
                GetCursorInfo(out pci);
                Graphics g = Graphics.FromImage(MyImage);
                int px = 0;
                int py = 0;
                int wx= videoWidth - pci.ptScreenPos.x;
                int wy = videoHeight - pci.ptScreenPos.y;
                int mouseX=0;
                int mouseY=0;
                if(pci.ptScreenPos.x>v.Width && wx<v.Width)
                {
                    px = videoWidth - v.Width;
                    mouseX=pci.ptScreenPos.x-(videoWidth - v.Width);
                }
                else if(pci.ptScreenPos.x<v.Width && wx>v.Width)
                {
                    px = 0;
                    mouseX=pci.ptScreenPos.x;
                }
                else if(pci.ptScreenPos.x-(v.Width/2)>0 && pci.ptScreenPos.x+(v.Width/2)<videoWidth)
                {
                    px = pci.ptScreenPos.x - (v.Width / 2);
                    mouseX=v.Width/2;
                }

                if(pci.ptScreenPos.y>v.Height && wy<v.Height)
                {
                    py = videoHeight - v.Height;
                    mouseY=pci.ptScreenPos.y-(videoHeight-v.Height);
                }
                else if (pci.ptScreenPos.y < v.Height && wy > v.Height)
                {
                    py = 0;
                    mouseY=pci.ptScreenPos.y;
                }
                else if(pci.ptScreenPos.y-(v.Height/2)>0 && pci.ptScreenPos.y+(v.Height/2)<videoHeight)
                {
                    py = pci.ptScreenPos.y - (v.Height / 2);
                    mouseY=v.Height/2;
                }

                g.CopyFromScreen(new System.Drawing.Point(px, py), new System.Drawing.Point(0, 0), new System.Drawing.Size(v.Width, v.Height));

                System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor);
                cur.Draw(g, new System.Drawing.Rectangle(mouseX,mouseY, cur.Size.Width, cur.Size.Height));

                Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCallback);
                MyImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
                Image img = MyImage.GetThumbnailImage(v.Height, v.Width, myCallback, IntPtr.Zero);
                //img.Save(@"D:\1.jpg");
                return img;
            }
            catch
            {
                throw;
            }
        }
예제 #53
0
        public override void Init()
        {
            Application.Log("Program.Init");

            ClientXmlFormatterBinder.Instance.BindClientTypes();

            LoadControls();
            SignalEvent(ProgramEventType.ProgramStarted);

#if DEBUG
            RedGate.Profiler.UserEvents.ProfilerEvent.SignalEvent("Init start");
#endif
            Content.ContentPath = Program.DataPath;
            Game.Map.GameEntity.ContentPool = Content;
            
            Bitmap b = new Bitmap(Common.FileSystem.Instance.OpenRead(Content.ContentPath + "/Interface/Cursors/MenuCursor1.png"));
            Graphics.Cursors.Arrow = NeutralCursor = Cursor = new System.Windows.Forms.Cursor(b.GetHicon());

            Graphics.Interface.InterfaceScene.DefaultFont = Fonts.Default;

            if (Settings.DeveloperMainMenu)
            {
                MainMenuDefault = MainMenuType.DeveloperMainMenu;
                ProfileMenuDefault = ProfileMenuType.DeveloperMainMenu;
            }
            else if (Settings.ChallengeMapMode)
            {
                MainMenuDefault = MainMenuType.ChallengeMap;
                ProfileMenuDefault = ProfileMenuType.ChallengeMap;
            }
            else
            {
                MainMenuDefault = MainMenuType.MainMenu;
                ProfileMenuDefault = ProfileMenuType.ProfileMenu;
            }

            if (Settings.DisplaySettingsForm)
            {
                OpenDeveloperSettings();
            }
            
            //Graphics.Content.DefaultModels.Load(Content, Device9);
            InterfaceScene = new Graphics.Interface.InterfaceScene();
            InterfaceScene.View = this;
            ((Graphics.Interface.Control)InterfaceScene.Root).Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height);
            InterfaceScene.Add(Interface);
            InterfaceScene.Add(AchievementsContainer);
            InterfaceScene.Add(PopupContainer);
            InterfaceScene.Add(FeedackOnlineControl);
            if (!String.IsNullOrEmpty(Program.Settings.BetaSurveyLink))
            {
                var u = new Uri(Program.Settings.BetaSurveyLink);
                var s = u.ToString();
                if (!u.IsFile)
                {
                    Button survey = new Button
                    {
                        Text = "Beta survey",
                        Anchor = Orientation.BottomRight,
                        Position = new Vector2(10, 50),
                        Size = new Vector2(110, 30)
                    };
                    survey.Click += new EventHandler((o, e) =>
                    {
                        Util.StartBrowser(s);
                    });
                    InterfaceScene.Add(survey);
                }
            }
            InterfaceScene.Add(Tooltip);
            InterfaceScene.Add(MouseCursor);
            InputHandler = InterfaceManager = new Graphics.Interface.InterfaceManager { Scene = InterfaceScene };

            // Adjust the main char skin mesh; remove the dummy weapons
            var mainCharSkinMesh = Program.Instance.Content.Acquire<SkinnedMesh>(
                new SkinnedMeshFromFile("Models/Units/MainCharacter1.x"));
            mainCharSkinMesh.RemoveMeshContainerByFrameName("sword1");
            mainCharSkinMesh.RemoveMeshContainerByFrameName("sword2");
            mainCharSkinMesh.RemoveMeshContainerByFrameName("rifle");

            try
            {
                SoundManager = new Client.Sound.SoundManager(Settings.SoundSettings.AudioDevice, Settings.SoundSettings.Engine, Settings.SoundSettings.MinMaxDistance.X, Settings.SoundSettings.MinMaxDistance.Y, Common.FileSystem.Instance.OpenRead);
                SoundManager.Settings = Settings.SoundSettings;
                SoundManager.ContentPath = Program.DataPath + "/Sound/";
                SoundManager.Muted = Settings.SoundSettings.Muted;
                SoundManager.LoadSounds(!Settings.ChallengeMapMode);
                if (SoundLoaded != null)
                    SoundLoaded(SoundManager, null);

                SoundManager.Volume = Settings.SoundSettings.MasterVolume;

                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Ambient).Volume = Settings.SoundSettings.AmbientVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Music).Volume = Settings.SoundSettings.MusicVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.SoundEffects).Volume = Settings.SoundSettings.SoundVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Interface).Volume = Settings.SoundSettings.SoundVolume;
            }
            catch (Client.Sound.SoundManagerException ex)
            {
                SendSoundFailureLog(ex);
                SoundManager = new Client.Sound.DummySoundManager();
                System.Windows.Forms.MessageBox.Show(
                    Locale.Resource.ErrorFailInitSoundDevice,
                    Locale.Resource.ErrorFailInitSoundDeviceTitle,
                    System.Windows.Forms.MessageBoxButtons.OK, 
                    System.Windows.Forms.MessageBoxIcon.Error);
            }

            //StateManager = new DummyDevice9StateManager(Device9);
            StateManager = new Device9StateManager(Device9);
            InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9)
            {
                Scene = InterfaceScene,
                StateManager = StateManager,
#if PROFILE_INTERFACERENDERER
                PeekStart = () => ClientProfilers.IRPeek.Start(),
                PeekEnd = () => ClientProfilers.IRPeek.Stop()
#endif
            };
            InterfaceRenderer.Initialize(this);

            BoundingVolumesRenderer = new BoundingVolumesRenderer
            {
                StateManager = Program.Instance.StateManager,
                View = Program.Instance
            };

#if BETA_RELEASE
            Client.Settings defaultSettings = new Settings();
            ValidateSettings("", defaultSettings, Settings);
#endif

            if (Settings.QuickStartMap != null && Settings.QuickStartMap != "" &&
                Common.FileSystem.Instance.FileExists("Maps/" + Settings.QuickStartMap + ".map"))
            {
                LoadNewState(new Game.Game("Maps/" + Settings.QuickStartMap));
                return;
            }

            UpdateFeedbackOnlineControl();
            
            System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
            p.PingCompleted += new System.Net.NetworkInformation.PingCompletedEventHandler((o, e) =>
            {
                FeedbackOnline = e.Reply != null && 
                    e.Reply.Status == System.Net.NetworkInformation.IPStatus.Success;
                UpdateFeedbackOnlineControl();
            });
            var statsUri = new Uri(Settings.StatisticsURI);
            p.SendAsync(statsUri.DnsSafeHost, null);

            if (Settings.DeveloperMainMenu)
                InitDeveloperMenu();
            else if (Settings.ChallengeMapMode)
                InitChallengeMapMode();
            else
                InitFullGame();

            EnterMainMenuState(false);

            if(WindowMode == WindowMode.Fullscreen)
                MouseCursor.BringToFront();

            AskAboutUpdate();

            if (!String.IsNullOrEmpty(Program.Settings.StartupMessage))
            {
                Dialog.Show(Program.Settings.StartupMessageTitle ?? "", Program.Settings.StartupMessage);
            }


            fixedFrameStepSW.Start();

            Application.Log("Program.Init completed");
#if DEBUG
            RedGate.Profiler.UserEvents.ProfilerEvent.SignalEvent("Init end");
#endif
        }
 public void Backup()
 {
     ContextMenuStrip = Source.ContextMenuStrip;
     ChartArea ptrChartArea = Source.ChartAreas[0];
     CursorXUserEnabled = ptrChartArea.CursorX.IsUserEnabled;
     CursorYUserEnabled = ptrChartArea.CursorY.IsUserEnabled;
     Cursor = Source.Cursor;
     CursorXInterval = ptrChartArea.CursorX.Interval;
     CursorYInterval = ptrChartArea.CursorY.Interval;
     CursorXAutoScroll = ptrChartArea.CursorX.AutoScroll;
     CursorYAutoScroll = ptrChartArea.CursorY.AutoScroll;
     ScrollBarX = ptrChartArea.AxisX.ScrollBar.Enabled;
     ScrollBarX2 = ptrChartArea.AxisX2.ScrollBar.Enabled;
     ScrollBarY = ptrChartArea.AxisY.ScrollBar.Enabled;
     ScrollBarY2 = ptrChartArea.AxisY2.ScrollBar.Enabled;
 }
		public Navigate()
		{
			base.m_category = "Sample_SceneControl(C#)";
			base.m_caption = "Navigate";
			base.m_toolTip = "Navigate";
			base.m_name = "Sample_SceneControl(C#)/Navigate";
			base.m_message = "Navigates the scene";

			//Load resources
			string[] res = GetType().Assembly.GetManifestResourceNames();
			if(res.GetLength(0) > 0)
			{
				base.m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("sceneTools.Navigation.bmp"));
			}
			m_pCursorNav = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.navigation.cur"));
			m_pCursorPan = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.movehand.cur"));
			m_pCursorZoom = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.ZOOMINOUT.CUR"));
			m_pCursorGest = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("sceneTools.gesture.cur"));

			m_pSceneHookHelper = new SceneHookHelperClass ();
		}
예제 #56
0
 public MouseCursor(System.Windows.Forms.Cursor cursor, bool applyOnMouseEnter)
 {
     mApplyOnMouseEnter = applyOnMouseEnter;
     mCursor = cursor;
 }
예제 #57
0
		public void OnCreate(object hook)
		{
			m_pHookHelper.Hook = hook;
            m_enabled = true;
			m_check = false;
			m_cursor = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream (GetType(), "Hand.cur"));
			m_cursorMove = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream(GetType(), "MoveHand.cur"));
		}