public RectangleTransparent() { clearPen = new Pen(Color.FromArgb(1, 0, 0, 0)); borderDotPen = new Pen(Color.Black, 1); borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; penTimer = Stopwatch.StartNew(); ScreenRectangle = CaptureHelpers.GetScreenBounds(); surface = new Bitmap(ScreenRectangle.Width, ScreenRectangle.Height); gSurface = Graphics.FromImage(surface); gSurface.InterpolationMode = InterpolationMode.NearestNeighbor; gSurface.SmoothingMode = SmoothingMode.HighSpeed; gSurface.CompositingMode = CompositingMode.SourceCopy; gSurface.CompositingQuality = CompositingQuality.HighSpeed; gSurface.Clear(Color.FromArgb(1, 0, 0, 0)); StartPosition = FormStartPosition.Manual; Bounds = ScreenRectangle; Text = "ShareX - " + Resources.RectangleTransparent_RectangleTransparent_Rectangle_capture_transparent; Shown += RectangleLight_Shown; KeyUp += RectangleLight_KeyUp; MouseDown += RectangleLight_MouseDown; MouseUp += RectangleLight_MouseUp; using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } timer = new Timer { Interval = 10 }; timer.Tick += timer_Tick; timer.Start(); }
/// <summary> /// Creates an instance of this class /// </summary> public MagnifierTool(MapBox parentMapBox) : base("Magnifier", "A tool to magnify the portion of the map below the cursor") { _parentMapBox = parentMapBox; _parentMapBox.MapChanged += HandleMapChanged; Map = _parentMapBox.Map; MagnificationFactor = 1.10; Offset = new Size(5,5); _magnified = new PictureBox(); _magnified.Size = new Size(75, 75); _magnified.BorderStyle = BorderStyle.FixedSingle; _magnified.Visible = false; _parentMapBox.Controls.Add(_magnified); Map = _parentMapBox.Map; _map = Map.Clone(); _map.Size = _magnified.Size; _map.Zoom = _map.Size.Width*(Map.Envelope.Width/Map.Size.Width) / _magnification; _map.Center = _map.Center; _magnified.Image = _map.GetMap(); Enabled = true; var ms = Assembly.GetExecutingAssembly().GetManifestResourceStream("WinFormSamples.Magnifier.cur"); if (ms != null) Cursor = new Cursor(ms); }
public Surface() { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle); InitializeComponent(); using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } DrawableObjects = new List<DrawableObject>(); Config = new SurfaceOptions(); timerStart = new Stopwatch(); timerFPS = new Stopwatch(); borderPen = new Pen(Color.Black); borderDotPen = new Pen(Color.White); borderDotPen.DashPattern = new float[] { 5, 5 }; nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Verdana", 16, FontStyle.Bold); infoFont = new Font("Verdana", 9); textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black)); textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White)); textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black)); markerPen = new Pen(Color.FromArgb(200, Color.Red)) { DashStyle = DashStyle.Dash }; }
} // HandleMouseDown /// <summary> /// 以重载:处理鼠标移动事件 /// </summary> /// <param name="x">鼠标光标在文档中的X坐标</param> /// <param name="y">鼠标光标在文档中的Y坐标</param> /// <param name="Button">鼠标按键</param> /// <returns>是否处理了该事件</returns> /// <seealso>ZYTextDocumentLib.ZYTextElement.HandleMouseMove</seealso> public override bool HandleMouseMove(int x, int y, System.Windows.Forms.MouseButtons Button) { int size = myOwnerDocument.PixelToDocumentUnit(DragBoxSize); if (ShowDragRect()) { System.Drawing.Rectangle[] DragRects = DrectSoft.Library.EmrEditor.Src.Common.DocumentView.GetDragRects(new System.Drawing.Rectangle(this.RealLeft, this.RealTop, this.Width - 1, this.Height - 1), size, true); for (int iCount = 0; iCount < DragRects.Length; iCount++) { if (DragRects[iCount].Contains(x, y)) { System.Windows.Forms.Cursor myCursor = DrectSoft.Library.EmrEditor.Src.Common.DocumentView.GetDragRectCursor(iCount); if (myCursor != null) { myOwnerDocument.SetCursor(myCursor); //myOwnerDocument.SetCursor(Cursors.Cross); //this.OwnerDocument.OwnerControl.Cursor = myCursor; Debug.WriteLine("图片的拖动光标"); } return(true); } } } if (this.Bounds.Contains(x, y)) { myOwnerDocument.SetCursor(System.Windows.Forms.Cursors.Default); } return(false); }
public Cursor GetCursor(CursorType pCursorType) { string sImageName = null; switch (pCursorType) { case CursorType.Hand: break; case CursorType.Pan: sImageName = "Pan.png"; break; case CursorType.Pointer: break; default: break; } string sCursorPath = Application.StartupPath + "\\" + sImageName; System.Windows.Forms.Cursor cursor = new System.Windows.Forms.Cursor(Cursor.Current.Handle); IntPtr cursorhandle = LoadCursorFromFile(sCursorPath); cursor.GetType().InvokeMember("handle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, cursor, new object[] { cursorhandle }); return(cursor); }
private void PerformCursorUpdateLogic() { System.Windows.Forms.Cursor cursorToAssign = Cursors.Arrow; bool isCtrlDown = keyboard.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || keyboard.KeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl);; if (isCtrlDown && WireframeEditControlsViewModel.IsMagicWandSelected && SelectedState.Self.SelectedChain != null) { cursorToAssign = addCursor; } else { foreach (var selector in mControl.RectangleSelectors) { var cursorFromRect = selector.GetCursorToSet(mControl.XnaCursor); if (cursorFromRect != null) { cursorToAssign = cursorFromRect; break; } } } if (System.Windows.Forms.Cursor.Current != cursorToAssign) { System.Windows.Forms.Cursor.Current = cursorToAssign; mControl.Cursor = cursorToAssign; } }
/// <summary> /// Initialize the view to be shown /// </summary> private void InitializeModel() { System.Windows.Forms.Cursor currentCursor = System.Windows.Forms.Cursor.Current; System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { this.m_model.SourcePathName = "杭州..."; this.m_model.DesPathName = "玉山..."; this.m_view.Ctrl.DataBindings.Add(new Binding("SourcePathName", this.m_model, "SourcePathName", false, DataSourceUpdateMode.OnPropertyChanged)); this.m_view.Ctrl.DataBindings.Add(new Binding("DesPathName", this.m_model, "DesPathName", false, DataSourceUpdateMode.OnPropertyChanged)); this.m_view.OnSelectSourcePath += BtnSelectFromPath_Click; this.m_view.OnSelectDesPath += BtnSelectToPath_Click; this.m_view.OnCopyFile += BtnCopy_Click; } catch (Exception) { throw; } finally { System.Windows.Forms.Cursor.Current = currentCursor; } }
/// <summary> /// 获取屏幕的bmp(带光标) /// </summary> /// <returns></returns> private static Bitmap getScreen() { #region int width = Screen.PrimaryScreen.Bounds.Width; int height = Screen.PrimaryScreen.Bounds.Height; Bitmap bmp = new Bitmap(width, height); using (Graphics g = Graphics.FromImage(bmp)) { g.CopyFromScreen(0, 0, 0, 0, new Size(width, height)); CURSORINFO pci; pci.cbSize = Marshal.SizeOf(typeof(CURSORINFO)); while (true) { bool issuccess = GetCursorInfo(out pci); if (issuccess && pci.hCursor != IntPtr.Zero) { break; } Thread.Sleep(100); } System.Windows.Forms.Cursor cur = new System.Windows.Forms.Cursor(pci.hCursor); cur.Draw(g, new Rectangle(pci.ptScreenPos.x - 10, pci.ptScreenPos.y - 10, cur.Size.Width, cur.Size.Height)); } //bmp.compress() return(bmp); #endregion }
public MeasuredisTool() { // // TODO: Define values for the public properties // base.m_category = ""; //localizable text base.m_caption = ""; //localizable text base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl"; //localizable text base.m_toolTip = ""; //localizable text base.m_name = ""; //unique id, non-localizable (e.g. "MyCategory_MyTool") //frm = new FrmMeasure(m_hookHelper); m_Cursor = System.Windows.Forms.Cursors.Cross; try { // // TODO: change resource name if necessary // string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur"); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
protected override void AfterActivate() { WinForms.Cursor oldCursor = WinForms.Cursor.Current; WinForms.Cursor.Current = WinForms.Cursors.WaitCursor; try { try { try { UpdateActiveControl(null); UpdateBackgroundImage(); UpdateImage(); UpdateTopMost(); } finally { base.AfterActivate(); } } finally { _form.ResumeLayout(false); } } finally { WinForms.Cursor.Current = oldCursor; } ((Session)HostNode.Session).DoAfterFormActivate(this); }
public MeasureDisTool(IHookHelper m_hookHelper0) { if (m_hookHelper0 != null) { m_hookHelper = m_hookHelper0; } else { return; } // // TODO: Define values for the public properties // base.m_category = ""; //localizable text base.m_caption = "measure"; //localizable text base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl"; //localizable text base.m_toolTip = "量测"; //localizable text base.m_name = "measure"; //unique id, non-localizable (e.g. "MyCategory_MyTool") //frm = new FrmMeasure(m_hookHelper); m_Cursor = System.Windows.Forms.Cursors.Cross; try { // // TODO: change resource name if necessary // string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur"); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
private void btnPopulate_Click(object sender, EventArgs e) { // shows wait cursor while populating comboboxes of Web Apps and Site Colls System.Windows.Forms.Cursor currentCurser = this.Cursor; this.Cursor = System.Windows.Forms.Cursors.WaitCursor; try { cbWebApps.DataSource = deLogin.getAvailableWebAppsOnMachine(); // here cbSiteCollections will get populated in an event of cbWebApps item selection cbWebApps.Enabled = true; cbSiteCollections.Enabled = true; } catch (Exception exp) { MessageBox.Show("An error occured. \n\rPlease make sure that current user is a Farm Administrator.", "Error"); } finally { this.Cursor = currentCurser; } // only enable 'Next' button only when valid Site Coll. selection made string s = (string)cbSiteCollections.SelectedItem; if (s != null && s != "") { btnLogin.Enabled = true; } btnPopulate.Text = "Refresh"; }
/// <summary>Construct the applet /// </summary> public Ground() { // // Required for Windows Form Designer support // InitializeComponent(); this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.Ground_MouseWheel); this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); New(); m_Rechen = new Rechen(this, m_Stones); m_Grass = new Grass(); System.Windows.Forms.Cursor temp_Cursor; temp_Cursor = System.Windows.Forms.Cursors.Cross; m_RechenCursor = temp_Cursor; System.Windows.Forms.Cursor temp_Cursor2; temp_Cursor2 = System.Windows.Forms.Cursors.Hand; m_StoneCursor = temp_Cursor2; System.Windows.Forms.Cursor temp_Cursor3; temp_Cursor3 = System.Windows.Forms.Cursors.SizeAll; m_GrassCursor = temp_Cursor3; }
static Drawing() { m_drawLineCursor = LoadCursor(Resources.DrawLineCursor); m_drawLineInvertedCursor = LoadCursor(Resources.DrawLineInvertedCursor); m_moveLineCursor = LoadCursor(Resources.MoveLineCursor); m_moveLineInvertedCursor = LoadCursor(Resources.MoveLineInvertedCursor); }
public void SetCursor(System.Windows.Forms.Cursor cursor) { if (_container != null) { _container.SetCursor(cursor); } }
public FormAllIdeas() { InitializeComponent(); if (Program.p.AdminMode) { lbUserName.Visible = false; label4.Visible = false; } this.FormClosing += Program.ApplicationQuit; this.Size = Program.currentSize; this.Location = Program.currentLocation; lbUserName.Text = Program.p.CurrentFullName; lGiven.Text = answer._givenByUser; lToFind.Text = answer._ToFindByUser; btnLogoCreativeThinker.MouseEnter += Program.LogoMouseEnter; btnLogoCreativeThinker.MouseLeave += Program.LogoMouseLeave; btnLogoEducationEra.MouseEnter += Program.LogoMouseEnter; btnLogoEducationEra.MouseLeave += Program.LogoMouseLeave; btnEditIdea.Enabled = false; btnEditIdea.BackColor = Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); btnRemoveIdea.Enabled = false; btnRemoveIdea.BackColor = Color.FromArgb(((int)(((byte)(226)))), ((int)(((byte)(226)))), ((int)(((byte)(226))))); try { Cursor myCursor = new Cursor("grab.cur"); lAllHypo.Cursor = myCursor; } catch (System.IO.FileNotFoundException) { lAllHypo.Cursor = Cursors.Hand; } }
protected override void OnDeactivate() { if (cursorZoom != null) { cursorZoom.Dispose(); cursorZoom = null; } if (cursorZoomIn != null) { cursorZoomIn.Dispose(); cursorZoomIn = null; } if (cursorZoomOut != null) { cursorZoomOut.Dispose(); cursorZoomOut = null; } if (cursorZoomPan != null) { cursorZoomPan.Dispose(); cursorZoomPan = null; } this.RendererList.Remove(this.outlineRenderer); this.outlineRenderer.Dispose(); this.outlineRenderer = null; base.OnDeactivate(); }
private string RunProcess(string commandName, string arguments, bool useShell) { System.Windows.Forms.Cursor oldCursor = System.Windows.Forms.Cursor.Current; System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; Process p = new Process(); p.StartInfo.CreateNoWindow = !useShell; p.StartInfo.UseShellExecute = useShell; p.StartInfo.Arguments = arguments; p.StartInfo.RedirectStandardOutput = !useShell; p.StartInfo.RedirectStandardError = !useShell; p.StartInfo.FileName = commandName; p.Start(); if (!useShell) { string output = p.StandardOutput.ReadToEnd(); string error = p.StandardError.ReadToEnd(); p.WaitForExit(); WriteToConsole(error); WriteToConsole(output); System.Windows.Forms.Cursor.Current = oldCursor; return(output); } return(""); }
/// <summary> /// Adds a web transform reference. /// </summary> public void AddWebTransformReference() { dlgOpenFile.CheckFileExists = true; dlgOpenFile.InitialDirectory = Application.StartupPath; dlgOpenFile.RestoreDirectory = true; dlgOpenFile.Filter = "Component files (*.dll)|*.dll"; dlgOpenFile.Title = "Add Web Transform Reference"; if ( dlgOpenFile.ShowDialog() == DialogResult.OK ) { Application.DoEvents(); tempCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { AddAssembly(dlgOpenFile.FileName); } catch ( Exception ex ) { MessageBox.Show(ex.Message, AppLocation.ApplicationName, MessageBoxButtons.OK,MessageBoxIcon.Error); } } Cursor.Current = tempCursor; }
protected override void OnActivate() { base.OnActivate(); cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursorMouseDown.cur")); cursorMouseDownSetSource = new Cursor(PdnResources.GetResourceStream("Cursors.CloneStampToolCursorSetSource.cur")); cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.CloneStampToolCursor.cur")); this.Cursor = cursorMouseUp; this.rendererDst = new BrushPreviewRenderer(this.RendererList); this.RendererList.Add(this.rendererDst, false); this.rendererSrc = new BrushPreviewRenderer(this.RendererList); this.rendererSrc.BrushLocation = GetStaticData().takeFrom; this.rendererSrc.BrushSize = AppEnvironment.PenInfo.Width / 2.0f; this.rendererSrc.Visible = (GetStaticData().takeFrom != Point.Empty); this.RendererList.Add(this.rendererSrc, false); if (ActiveLayer != null) { switchedTo = true; historyRects = new Vector<Rectangle>(); if (GetStaticData().wr != null && GetStaticData().wr.IsAlive) { takeFromLayer = (BitmapLayer)GetStaticData().wr.Target; } else { takeFromLayer = null; } } AppEnvironment.PenInfoChanged += new EventHandler(Environment_PenInfoChanged); }
/// <summary> /// Import a Journal note file /// </summary> /// <param name="path">path of journal note</param> private void Import(string filename, int type) { System.Windows.Forms.Cursor currentCursor = Cursor.Current; Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; try { using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) { switch (type) { case 1: fNoteBox.Document = Agilix.Ink.Converters.Journal.ImportNote(fs, null); break; case 2: fNoteBox.Document = Agilix.Ink.Converters.Isf.ImportNote(fs, null); break; case 3: fNoteBox.Document = Agilix.Ink.Converters.Image.ImportNote(fs, null); break; } fFilePath = null; fFileName = System.IO.Path.GetFileNameWithoutExtension(filename); Text = fFileName + " - " + TITLE; fNoteBox.Modified = true; } } catch (Exception e) { MessageBox.Show(this, "Unable to import file: " + filename + "\n" + e.Message, "Error importing file", MessageBoxButtons.OK, MessageBoxIcon.Error); } Cursor.Current = currentCursor; }
private void CompareGraphForm_Load(object sender, EventArgs e) { this.Text = getTitle(); string sError = string.Empty; bool bError = false; bError = (!sadBin.isDisassembled); if (bError) { sError += "Binary is not disassembled."; MessageBox.Show(sError, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } System.Windows.Forms.Cursor processPreviousCursor = Cursor; Cursor = System.Windows.Forms.Cursors.WaitCursor; string[] arrSBytes = sadBin.Calibration.getBytesArray(sadBin.Calibration.AddressBankInt, sadBin.Calibration.Size); arrCurBytes = new byte[arrSBytes.Length]; for (int iPos = 0; iPos < arrCurBytes.Length; iPos++) { arrCurBytes[iPos] = Convert.ToByte(arrSBytes[iPos], 16); } setupChart(ref calibCurrentChart, ref arrCurBytes, ref sadBin, ref sadS6x); Cursor = processPreviousCursor; calibCurrentChart.Visible = true; }
public ViewportControl() { this.InitializeComponent(); this.BackColor = SystemColors.AppWorkspace; base.MouseWheel += new MouseEventHandler(this.ViewportControl_MouseWheel); this.m_invisibleCursor = new Cursor(new MemoryStream(Resources.invisible_cursor)); }
protected override void OnDeactivate() { base.OnDeactivate(); if (cursorMouseUp != null) { cursorMouseUp.Dispose(); cursorMouseUp = null; } if (cursorMouseDown != null) { cursorMouseDown.Dispose(); cursorMouseDown = null; } if (mouseDown) { OnMouseUp(new MouseEventArgs(mouseButton, 0, lastMouseXY.X, lastMouseXY.Y, 0)); } this.RendererList.Remove(this.previewRenderer); this.previewRenderer.Dispose(); this.previewRenderer = null; this.savedRects.Clear(); if (renderArgs != null) { renderArgs.Dispose(); renderArgs = null; } bitmapLayer = null; }
protected override Cursor CreateCursorImpl(CursorRequest cursorReq) { MyCursor myCursor = new MyCursor(); //load cursor from input file //assume cursor is square //resolve if (cursorReq.Url.StartsWith("system:")) { System.Windows.Forms.Cursor selectedCursor = System.Windows.Forms.Cursors.Default; switch (cursorReq.Url.Substring(7)) { case "Arrow": selectedCursor = System.Windows.Forms.Cursors.Arrow; break; case "Pointer": selectedCursor = System.Windows.Forms.Cursors.Hand; break; case "IBeam": selectedCursor = System.Windows.Forms.Cursors.IBeam; break; } myCursor.LoadSystemCursor(selectedCursor); } else { myCursor.LoadFromFile(cursorReq.Url, cursorReq.Width); } return(myCursor); }
public byte[] GetDesktop_ResizedBytes(int w, int h) { 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)); Image img = Get_Resized_Image(w, h, MemImage); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); return(ms.GetBuffer()); }
private static Cursor LoadCursorFromResource(string resourceName) { Cursor result; try { var tempFile = Path.GetTempFileName(); using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) using (var resourceFile = new FileStream(tempFile, FileMode.Create)) { if (s != null) { var b = new byte[s.Length + 1]; s.Read(b, 0, Convert.ToInt32(s.Length)); resourceFile.Write(b, 0, Convert.ToInt32(b.Length - 1)); } resourceFile.Flush(); } result = new Cursor(NativeMethods.LoadCursorFromFile(tempFile)); File.Delete(tempFile); } catch { result = Cursors.Cross; } return result; }
// nothing = replace // Ctrl = union // RMB = exclude // Ctrl+RMB = xor protected override void OnActivate() { DocumentWorkspace.EnableSelectionTinting = true; this.cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.MagicWandToolCursor.cur")); this.Cursor = cursorMouseUp; base.OnActivate(); }
public void OnInitial(Controller controller,Cursor palmCursor,Form targetForm) { this.palmCursor = palmCursor; this.targetForm = targetForm; this.targetForm = targetForm; }
protected override void OnActivate() { base.OnActivate(); // cursor-transitions this.cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursor.cur")); this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursorMouseDown.cur")); this.Cursor = cursorMouseUp; this.savedRects = new List<Rectangle>(); if (ActiveLayer != null) { bitmapLayer = (BitmapLayer)ActiveLayer; renderArgs = new RenderArgs(bitmapLayer.Surface); } else { bitmapLayer = null; renderArgs = null; } this.previewRenderer = new BrushPreviewRenderer(this.RendererList); this.RendererList.Add(this.previewRenderer, false); }
public UcExtentSetting() { InitializeComponent(); this.Enabled = false; _defaultCursor = System.Windows.Forms.Cursors.Default; _drawCursor = System.Windows.Forms.Cursors.Cross; }
public void MouseEnter(MouseEventArgs e) { previousColor = this.Shape.ShapeColor; this.Shape.ShapeColor = Color.GreenYellow; previousCursor = Cursor.Current; this.Shape.Model.RaiseOnCursorChange(Cursors.Hand); }
public void AddCursor(object key, string resourcename) { string name = "Resources." + resourcename; Type type = GetType(); Cursor cursor = new Cursor(GetType(), name); m_map[key] = cursor; }
internal void LoadFromFile(string cursorUrl, int width) { //TODO: review here, //we should load from 'virtual disk' _nativeCursorHandler = LoadImage(IntPtr.Zero, cursorUrl, 2, width, width, LR_DEFAULTSIZE | LR_LOADFROMFILE); _cursor = new System.Windows.Forms.Cursor(_nativeCursorHandler); }
public Surface(Image backgroundImage = null) { ScreenRectangle = CaptureHelpers.GetScreenBounds(); ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle); InitializeComponent(); using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } if (backgroundImage != null) { SurfaceImage = backgroundImage; Prepare(); } DrawableObjects = new List<DrawableObject>(); Config = new SurfaceOptions(); timer = new Stopwatch(); borderPen = new Pen(Color.Black); borderDotPen = new Pen(Color.Black, 1); borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; nodeBackgroundBrush = new SolidBrush(Color.White); textFont = new Font("Arial", 17, FontStyle.Bold); }
public RectangleAnnotateForm(RectangleAnnotateOptions options) { Options = options; backgroundImage = Screenshot.CaptureFullscreen(); borderDotPen = new Pen(Color.Black, 1); borderDotPen2 = new Pen(Color.White, 1); borderDotPen2.DashPattern = new float[] { 5, 5 }; textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black)); textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White)); textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black)); infoFont = new Font("Verdana", 9); penTimer = Stopwatch.StartNew(); ScreenRectangle = CaptureHelpers.GetScreenBounds(); InitializeComponent(); Icon = ShareXResources.Icon; using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair)) { Cursor = new Cursor(cursorStream); } timer = new Timer { Interval = 10 }; timer.Tick += timer_Tick; timer.Start(); }
public ToolPolygon() { System.IO.MemoryStream ms = new System.IO.MemoryStream(Genetibase.NuGenAnnotation.Properties.Resources.Pencil); Cursor = new Cursor(ms); ms.Close(); //Cursor = new Cursor(GetType(), "Pencil.cur"); }
static GutterMargin() { Stream cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("GodLesZ.eAthenaEditor.Library.Resources.RightArrow.cur"); if (cursorStream == null) throw new Exception("could not find cursor resource"); RightLeftCursor = new Cursor(cursorStream); cursorStream.Close(); }
protected override void OnDeactivate() { base.OnDeactivate(); if (this.pencilToolCursor != null) { this.pencilToolCursor.Dispose(); this.pencilToolCursor = null; } if (mouseDown) { Point lastTracePoint = (Point)tracePoints[tracePoints.Count - 1]; OnMouseUp(new MouseEventArgs(mouseButton, 0, lastTracePoint.X, lastTracePoint.Y, 0)); } this.savedRects = null; this.tracePoints = null; this.bitmapLayer = null; if (this.renderArgs != null) { this.renderArgs.Dispose(); this.renderArgs = null; } this.mouseDown = false; if (clipRegion != null) { clipRegion.Dispose(); clipRegion = null; } }
//Using a worker thread is required for thread safety private void SetCursorUnsafe(System.Windows.Forms.Cursor cursor) { if (cursor == null) { Logger.Log( "LMCMainForm.SetCursorWorker called cursor=null", Logger.manageLogLevel); return; } if (cursor == Cursors.Default) { Logger.Log("LMCMainForm.SetCursor: DEFAULT", Logger.manageLogLevel); } else if (cursor == Cursors.WaitCursor) { Logger.Log("LMCMainForm.SetCursor: WAIT", Logger.manageLogLevel); } else { Logger.Log("LMCMainForm.SetCursor: OTHER", Logger.manageLogLevel); } this.Cursor = cursor; }
protected override void OnActivate() { base.OnActivate(); this.pencilToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.PencilToolCursor.cur")); this.Cursor = this.pencilToolCursor; this.savedRects = new List<Rectangle>(); if (ActiveLayer != null) { bitmapLayer = (BitmapLayer)ActiveLayer; renderArgs = new RenderArgs(bitmapLayer.Surface); tracePoints = new List<Point>(); } else { bitmapLayer = null; if (renderArgs != null) { renderArgs.Dispose(); renderArgs = null; } } }
private void custom_OnMouseEnter(object sender, EventArgs e) { if (this.Cursor != Cursors.WaitCursor) { this.outCursor = this.Cursor; } }
public StatusBusy(string statusText) { _oldStatus = MainForm.Instance.StatusLabel.Text; MainForm.Instance.StatusLabel.Text = statusText; _oldCursor = MainForm.Instance.Cursor; MainForm.Instance.Cursor = Cursors.WaitCursor; }
/// <summary> /// Creates a new crosshair control. /// </summary> public Crosshair() { InitializeComponent(); myImage = new Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ManagedWinapi.crosshair.ico")); myCursor = new Cursor(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ManagedWinapi.crosshair.ico")); dragger.Image = myImage; }
/// <summary> /// Obtient les images et curseur associé à un composant. /// </summary> /// <param name="type">descripteur de type du composant</param> /// <param name="small">image bitmap 16x16 associée au composant (ou null)</param> /// <param name="large">image bitmap 32x32 associée au composant (ou null)</param> /// <param name="cursor">curseur de dépôt associé au composant (ou <see cref="Cursors.Cross"/>)</param> /// <returns>true si l'image du composant a pu être obtenue</returns> public static bool GetComponentImages( // <wao spécif> Type type, out Image small, out Image large, out Cursor cursor ) { // <wao spécif code.&body> // valeurs par défaut small = null; large = null; cursor = Cursors.Cross; // tenter de récupérer l'image du composant via l'attribut ToolboxBitmap object[] attrs = type.GetCustomAttributes( typeof( ToolboxBitmapAttribute ), false ); if ( attrs.Length > 0 ) { small = (attrs[ 0 ] as ToolboxBitmapAttribute).GetImage( type, false ); large = (attrs[ 0 ] as ToolboxBitmapAttribute).GetImage( type, true ); } // tenter de récupérer l'image du composant via son nom par défaut if ( small == null ) { small = ToolboxBitmapAttribute.GetImageFromResource( type, type.Name + ".bmp", false ); large = ToolboxBitmapAttribute.GetImageFromResource( type, type.Name + ".bmp", true ); } // aucune image trouvée if ( small == null ) return false; // composer le cross-cursor pour le dépôt cursor = CursorHelper.ImageToCrossCursor( small ); return true; }
public override void SetCursor(System.Windows.Forms.Cursor cursor) { if (cursor == Cursors.SizeNS) { SetGameCursor(game.Cursors["size_ver"]); } else if (cursor == Cursors.SizeWE) { SetGameCursor(game.Cursors["size_hor"]); } else if (cursor == Cursors.SizeNWSE) { SetGameCursor(game.Cursors["size_nwse"]); } else if (cursor == Cursors.SizeNESW) { SetGameCursor(game.Cursors["size_nesw"]); } else if (cursor == Cursors.Default) { SetGameCursor(game.Cursors["default"]); } else { Debug.WriteLine("Unknown mouse cursor was set"); } }
static GutterMargin() { Stream cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("SAF.Framework.Controls.TextEditor.Resources.RightArrow.cur"); if (cursorStream == null) throw new Exception("could not find cursor resource"); RightLeftCursor = new Cursor(cursorStream); cursorStream.Close(); }
public void DecodeCaptureCursor(int owner, byte[] data) { if (this.ReceivedCursor != null) { System.Windows.Forms.Cursor c = null; MemoryStream ms = new MemoryStream(data); CursorType ct = (CursorType)ms.ReadByte(); this._neuroLog.WriteFormat("Decode Cursor", "Type: {0}", ct); if (ct == CursorType.Custom) { c = this.CreateCursor(new Icon(ms).ToBitmap(), 0, 0); this._neuroLog.Write("Creating Cursor"); } else { //byte[] b = new byte[(ms.Length - ms.Position)]; //ms.Read(b,0, b.Length); foreach (KeyValuePair <Cursor, CursorType> kv in this._cursorTable) { if (kv.Value == ct) { c = kv.Key; break; } } } this.ReceivedCursor(owner, c, 0, 0);//xH, yH); } }
public ToolEllipse() { System.IO.MemoryStream ms = new System.IO.MemoryStream(Genetibase.NuGenAnnotation.Properties.Resources.Ellipse); Cursor = new Cursor(ms); ms.Close(); //Cursor = new Cursor(GetType(), "Ellipse.cur"); }
// Methods public MouseArea() { this.components = null; this.picturePanel = null; this.startPoint = PointF.Empty; this.defaultCursor = Cursors.Default; this.shiftDown = false; // this.filename = string.Empty; // this.selectPath = new GraphicsPath(); this.graphCenterPoint = PointF.Empty; this.currentOperation = ToolOperation.None; // this.undostack = new UndoStack(); this.oldPoint = Point.Empty; this.hori = false; this.oldindex = 0; this.mousedown = false; this.win32 = new Win32(); this.lineOperation = null; this.SelectOperation = null; this.DrawOperation = null; this.ViewOperation = null; this.ColorOperation = null; this.BezierOperation = null; this.IsDrawing = false; this.TextOperation = null; this.editingOperation = null; this.polyOperation = null; this.FlipOperation = null; this.SubOperation = null; this.InitializeComponent(); base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | (ControlStyles.Selectable | ControlStyles.UserPaint))), true); this.CreateMenus(); }
public Form1() { InitializeComponent(); _cursorDefault = Cursor.Current; _cursorFinder = EmbeddedResources.LoadCursor(EmbeddedResources.Finder); _finderHome = EmbeddedResources.LoadImage(EmbeddedResources.FinderHome); _finderGone = EmbeddedResources.LoadImage(EmbeddedResources.FinderGone); pictureBox1.Image = _finderHome; pictureBox1.MouseDown += new MouseEventHandler(OnFinderToolMouseDown); button_ok.Click += new EventHandler(OnButtonOKClicked); button_cancel.Click += new EventHandler(OnButtonCancelClicked); textBox_play.KeyDown += new KeyEventHandler(textBox_play_KeyDown); textBox_stop.KeyDown += new KeyEventHandler(textBox_stop_KeyDown); textBox_full.KeyDown += new KeyEventHandler(textBox_full_KeyDown); textBox_mute.KeyDown += new KeyEventHandler(textBox_mute_KeyDown); textBox_fwd.KeyDown += new KeyEventHandler(textBox_fwd_KeyDown); textBox_bwd.KeyDown += new KeyEventHandler(textBox_bwd_KeyDown); textBox_vup.KeyDown += new KeyEventHandler(textBox_vup_KeyDown); textBox_vdown.KeyDown += new KeyEventHandler(textBox_vdown_KeyDown); textBox_class_name.TextChanged += new EventHandler(OnTextBoxHandleTextChanged); this.AcceptButton = button_ok; this.CancelButton = button_cancel; }
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)); }
public void ChangeMouseCursor(Cursor cursor) { MouseCursor = cursor; if (OnMouseCursorChange != null) { WDAppLog.TryCatchLogged(delegate() { OnMouseCursorChange(this, null); }, ErrorLevel.Error); } }
public static MousePosition GetMousePosition() { var asdt = new System.Windows.Forms.Cursor(System.Windows.Forms.Cursor.Current.Handle); var t = System.Windows.Forms.Control.MousePosition; return(new MousePosition(t.X, t.Y)); }
public void Relealse() { m_HookHelper = null; m_Cursor = null; m_pNewPolygonFeedback = null; mGeomln = null; pFirstGeom = null; }
public void SetWinformsCursor(WinCursor cursor) { if (!mHasBeenSet) { mSetCursor = cursor; mHasBeenSet = true; } }
protected override bool OnDeactivate() { // Reset the Cursor and Counter numberOfClicks = 0; System.Windows.Forms.Cursor locCursor = new System.Windows.Forms.Cursor(GetType(), "Cursors.StationLocCursor.cur"); Cursor = locCursor; return(base.OnDeactivate()); }
//this method is called if the user clicks on the Save ARCH models button private void ARCHsavebt_Click(object sender, EventArgs e) { System.Windows.Forms.Cursor old = this.Cursor; this.Cursor = Cursors.AppStarting; int position = ARCHlb.SelectedIndex; string interim1 = Fnames[position].Replace(".xlsx", ""); string interim2 = Tab[position].Replace("$", ""); string interim3 = Flocations[position].Replace(fnames[position], interim1 + interim2 + "Models.csv"); if (modellist.Count() > 0) { StreamWriter sw = new StreamWriter(interim3, false); sw.WriteLine("Transform\tShape\tScale\tModel\tP\tQ\tD\tAIC\tSS\tVariance\tParameters\tarchQ\tarchP\tarchAIC\tarchParameters\tSubtractmean"); for (int i = 0; i < modellist.Count(); i++) { string temp = ""; int noparams = modellist[i].Parameters.Count(); for (int j = 0; j < noparams - 1; j++) { temp = temp + modellist[i].Parameters[j].ToString() + " "; } //don't need a whitespace for the last value temp = temp + modellist[i].Parameters[noparams - 1].ToString(); string archtemp = ""; int archnoparams = modellist[i].archParameters.Count(); for (int j = 0; j < archnoparams - 1; j++) { archtemp = archtemp + modellist[i].archParameters[j].ToString() + " "; } //no need for a white space for the last arch parameter archtemp = archtemp + modellist[i].archParameters[archnoparams - 1].ToString(); sw.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}", Modellist[i].Transformtype, Modellist[i].Transformshape, Modellist[i].Transformscale, Modellist[i].Type, Modellist[i].P, Modellist[i].Q, Modellist[i].D, Modellist[i].Aic, Modellist[i].Sumsquaredresiduals, Modellist[i].Variance, temp, Modellist[i].archQ, Modellist[i].archP, Modellist[i].archAic, archtemp, Modellist[i].Subtractmean); } for (int i = 0; i < archModellist.Count(); i++) { string temp = ""; int noparams = archmodellist[i].Parameters.Count(); for (int j = 0; j < noparams - 1; j++) { temp = temp + archmodellist[i].Parameters[j].ToString() + " "; } //don't need a whitespace for the last value temp = temp + archmodellist[i].Parameters[noparams - 1].ToString(); string archtemp = ""; int archnoparams = archmodellist[i].archParameters.Count(); for (int j = 0; j < archnoparams - 1; j++) { archtemp = archtemp + archmodellist[i].archParameters[j].ToString() + " "; } //no need for a white space for the last arch parameter archtemp = archtemp + archmodellist[i].archParameters[archnoparams - 1].ToString(); sw.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}", archModellist[i].Transformtype, archModellist[i].Transformshape, archModellist[i].Transformscale, archModellist[i].Type, archModellist[i].P, archModellist[i].Q, archModellist[i].D, archModellist[i].Aic, archModellist[i].Sumsquaredresiduals, archModellist[i].Variance, temp, archModellist[i].archQ, archModellist[i].archP, archModellist[i].archAic, archtemp, archModellist[i].Subtractmean); } sw.Close(); this.Cursor = old; } }
// Adds Barriers from Dataset private void OpenBarriers() { System.Windows.Forms.Cursor Cursor = this.Cursor; try { // Create Dialog on first call and init filter InitBarriersDlg(); // Get Barriers IGxObject gxObject = null; IEnumGxObject gxObjects = null; gxObjects = null; if (m_dlgBarriers.DoModalOpen(this.Handle.ToInt32(), out gxObjects) & (gxObjects != null)) { this.Cursor = Cursors.WaitCursor; // Init Barriers ClearBarriers(); // use first object gxObjects.Reset(); gxObject = gxObjects.Next(); // Use first object if (gxObject != null) { // Add Barriersfrom object dataset IGxDataset objGxDS = null; objGxDS = gxObject as IGxDataset; AddBarriersFromDataset(objGxDS.Dataset); } // Is Barriers added to Router if (m_nBarriersCount == 0) m_txtBarriers.Text = ""; else m_txtBarriers.Text = gxObject.Name; if (m_nBarriersIgnoredCount > 0) MessageBox.Show(this, m_nBarriersIgnoredCount.ToString() + " barriers cannot be added.", "Routing Sample", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { // Clear on Error ClearBarriers(); } finally { this.Cursor = Cursor; } }