protected override void OnDragMove(System.Drawing.Point cursorPos, Line cursorRay) { //if (profile == null) // return; //Point point; //if (!profilePlane.TryIntersectLine(cursorRay, out point)) // return; // plane is side-on p += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; q += ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale; ////circleAngle += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; //inverseOffset = Vector.Create( // ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale, // ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale, // inverseOffset.Z //); lastCursorPos = cursorPos; circleAngle = Math.PI / 4; Rendering = Graphic.Create(null, null, LawsonToolGraphics.GetGraphic(p, q, circleAngle, inverseOffset)); // Rendering = Graphic.Create(null, null, Profile.GetGraphic(p, q, circleAngle, true, inverseOffset)); //Apply(String.Format("p:{0} q:{1} circleAngle:{2} inverseOffset:{3}", p, q, circleAngle, inverseOffset.ToString())); }
// get hand cyrcle private BitmapSource DrawEllipses(ColorImageFrame CFrame) { Bitmap bmap = ImageToBitmap(CFrame); try { foreach (Skeleton s in skeletons) { if (s.TrackingState == SkeletonTrackingState.Tracked) { Graphics g = Graphics.FromImage(bmap); System.Drawing.Point?p3 = GetJoint2DPoint(JointType.HandRight, s); System.Drawing.Pen pen3 = new System.Drawing.Pen(System.Drawing.Color.Purple); pen3.Width = 10; if (p3 != null) { g.DrawEllipse(pen3, p3.Value.X - 25, p3.Value.Y - 25, 50, 50); } } } } catch (Exception) { Console.WriteLine("Error H3"); throw; } return(BitmapToBitmapSource(bmap)); }
private void graficoVoosPorAeroporto_MouseMove(object sender, MouseEventArgs e) { var pos = e.Location; if (prevPosition.HasValue && pos == prevPosition.Value) { return; } tooltip.RemoveAll(); prevPosition = pos; var results = graficoVoosPorAeroporto.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint); foreach (var result in results) { if (result.ChartElementType == ChartElementType.DataPoint) { var prop = result.Object as DataPoint; if (prop != null) { var pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue); var pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]); tooltip.Show(prop.AxisLabel + ": " + prop.YValues[0], this.graficoVoosPorAeroporto, pos.X, pos.Y - 15); } } } }
private void RefreshCirclesImage(ColorImageFrame CFrame, SkeletonPoint?highest, SkeletonPoint?lowest) { if (CFrame != null) { Bitmap circlesBitmap = new Bitmap(CFrame.Width, CFrame.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Skeleton skeleton = getCurrentSkeleton(); Graphics g = Graphics.FromImage(circlesBitmap); if (skeleton != null) { System.Drawing.Point?p1 = GetJoint2DPoint(JointType.HandLeft, skeleton); System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Red); pen.Width = 10; if (p1 != null) { g.DrawEllipse(pen, p1.Value.X - 25, p1.Value.Y - 25, 50, 50); } } if (highest.HasValue) { ColorImagePoint Cloc = _kinectSensor.CoordinateMapper.MapSkeletonPointToColorPoint(highest.Value, ColorImageFormat.RgbResolution640x480Fps30); System.Drawing.Point p = new System.Drawing.Point(Cloc.X, Cloc.Y); System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.White); pen.Width = 10; if (p != null) { try { g.DrawEllipse(pen, p.X - 5, p.Y - 5, 10, 10); } catch { }; } } if (lowest.HasValue) { ColorImagePoint Cloc = _kinectSensor.CoordinateMapper.MapSkeletonPointToColorPoint(lowest.Value, ColorImageFormat.RgbResolution640x480Fps30); System.Drawing.Point p = new System.Drawing.Point(Cloc.X, Cloc.Y); System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.White); pen.Width = 10; if (p != null) { try { g.DrawEllipse(pen, p.X - 5, p.Y - 5, 10, 10); } catch { }; } } IntPtr hBmp = circlesBitmap.GetHbitmap(); System.Windows.Media.Imaging.BitmapSource source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBmp, IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromWidthAndHeight(circlesBitmap.Width, circlesBitmap.Height)); circlesBitmap.Dispose(); CircleImage.Source = source; DeleteObject(hBmp); } }
private void ClockLabel_MouseMove(object sender, MouseEventArgs e) { if (_mousepos == null) { _mousepos = e.Location; } if (e.X > _mousepos.Value.X + 5 || e.X < _mousepos.Value.X - 5 || e.Y > _mousepos.Value.Y + 5 || e.Y < _mousepos.Value.Y - 5) { _mousepos = e.Location; MouseMoveTime = DateTime.Now; } }
protected override void OnDragMove(System.Drawing.Point cursorPos, Line cursorRay) { //if (profile == null) // return; //Point point; //if (!profilePlane.TryIntersectLine(cursorRay, out point)) // return; // plane is side-on lastCursorPos = cursorPos; //for (int i = 0; i < 20; i++) // lawson.Iterate(); //Rendering = Graphic.Create(null, null, LawsonRelaxGraphics.GetGraphic(lawson)); //Apply(String.Format("Iteration {0}", lawson.Iteration)); }
// Line lastCursorRay; protected override bool OnDragStart(System.Drawing.Point cursorPos, Line cursorRay) { // profile = Profile.GetWrapper(InteractionContext.Preselection as CustomObject); //if (profile == null) // return; //Point? pointOnCustom = InteractionContext.PreselectionPoint; //if (pointOnCustom == null) { // profile = null; // return; //} lastCursorPos = cursorPos; StatusText = "Adjust."; return(false); }
public AutomateForm(Document _doc, UIDocument _uiDoc) { InitializeComponent(); doc = _doc; uiDoc = _uiDoc; famName = new List <string>(); famCat = new List <string>(); famNameSys = new List <string>(); famCatSys = new List <string>(); prevPosition = null; tooltip = new ToolTip(); families = new FilteredElementCollector(doc).OfClass(typeof(Family)); familiesSystem = new FilteredElementCollector(doc).OfClass(typeof(ElementType)); family = false; familiesOrder = from Family fam in families orderby fam.FamilyCategory.Name ascending select fam; // familiesSysOrder = from Family fam in familiesSystem orderby fam.FamilyCategory.Name ascending select fam; Debug.WriteLine("++AutomateForm constructor passed!"); }
private DisplaySettings( WindowsApi.DEVMODEW devmode, UInt32 widthInPixels, UInt32 heightInPixels, UInt32 refreshRateInHertz, UInt32 bitsPerPixel, DisplayOrientation?orientation, FixedResolutionOutputOption?fixedOutputOption, DisplayFlags?flags, System.Drawing.Point?position ) { this.devmode = devmode; this.widthInPixels = widthInPixels; this.heightInPixels = heightInPixels; this.refreshRateInHertz = refreshRateInHertz; this.bitsPerPixel = bitsPerPixel; this.orientation = orientation; this.fixedOutputOption = fixedOutputOption; this.flags = flags; this.position = position; }
private void Button_Item_Use(object sender, RoutedEventArgs e) { Task t = new Task(() => { isStop = false; // lấy ra danh sách devices id để dùng List <string> devices = new List <string>(); devices = KAutoHelper.ADBHelper.GetDevices(); System.Drawing.Point?cheTaoPoint = new System.Drawing.Point?(); // chạy từng device để điều khiển theo kịch bản bên trong foreach (var deviceID in devices) { if (deviceID != "") { // tạo ra một luồng xử lý riêng biệt để xử lý cho device này Task t1 = new Task(() => { while (true) { if (isStop) { return; } if (cheTaoPoint == null) { var screen = KAutoHelper.ADBHelper.ScreenShoot(deviceID); cheTaoPoint = KAutoHelper.ImageScanOpenCV.FindOutPoint(screen, BUTTON_USE); } KAutoHelper.ADBHelper.Tap(deviceID, cheTaoPoint.Value.X, cheTaoPoint.Value.Y); } }); t1.Start(); } } }); t.Start(); }
private void panelMain_MouseLeave(object sender, EventArgs e) { if (this.Cursor == Cursors.SizeAll) { this.Cursor = Cursors.Default; this._lastMP = null; } }
private void panelMain_MouseHover(object sender, EventArgs e) { var mp = new EvolutionTools.Point(MousePosition.X, MousePosition.Y); if (this.Cursor == Cursors.Default) { if (this.modernToolStripMenuItem.Checked) { var formCenter = new EvolutionTools.Point(this.Location).Add(new EvolutionTools.Point(this.Size).Divide(2)); var corner = new EvolutionTools.Point(this.Location.X + this.Size.Width, this.Location.Y); var mpvect = mp.Subtract(formCenter); var cnvect = mp.Subtract(formCenter); //Angle mpa = if (mpvect.X >= formCenter.X) { //if (mpvect.Y >= formCenter.Y) //this.Cursor = Cursors. } else { } //if (cos >) this.Cursor = Cursors.SizeAll; } } var nl = new System.Drawing.Point((int)mp.X, (int)mp.Y); if (this.Cursor != Cursors.Default && _lastMP != null) { this.Width += (nl.X - _lastMP.Value.X); } this._lastMP = nl; return; }
// Line lastCursorRay; protected override bool OnDragStart(System.Drawing.Point cursorPos, Line cursorRay) { // profile = Profile.GetWrapper(InteractionContext.Preselection as CustomObject); //if (profile == null) // return; //Point? pointOnCustom = InteractionContext.PreselectionPoint; //if (pointOnCustom == null) { // profile = null; // return; //} lastCursorPos = cursorPos; StatusText = "Adjust."; return false; }
protected override void OnDragMove(System.Drawing.Point cursorPos, Line cursorRay) { //if (profile == null) // return; //Point point; //if (!profilePlane.TryIntersectLine(cursorRay, out point)) // return; // plane is side-on //p += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; //q += ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale; ////circleAngle += ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale; //inverseOffset = Vector.Create( // ((double)lastCursorPos.Value.X - cursorPos.X) * cursorScale, // ((double)lastCursorPos.Value.Y - cursorPos.Y) * cursorScale, // inverseOffset.Z //); lastCursorPos = cursorPos; //circleAngle = Math.PI / 4; //Rendering = Graphic.Create(null, null, BrowseToolGraphics.GetGraphic()); // Rendering = Graphic.Create(null, null, Profile.GetGraphic(p, q, circleAngle, true, inverseOffset)); //Apply(String.Format("BrowseTool")); }
public override void SendMouseEvent(WindowsAPI.MOUSEEVENTF mouseevent, System.Drawing.Point? location = null) { throw new NotImplementedException(); }
private void test_MouseUp(object sender, MouseEventArgs e) { start = null; }
private void test_MouseDown(object sender, MouseEventArgs e) { start = new System.Drawing.Point(e.X, e.Y); }
private void activateUI() { this.Activate(); start = Cursor.Position; SetForegroundWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle); }
public static void tooltip_graph_display(System.Windows.Forms.ToolTip t, System.Windows.Forms.MouseEventArgs e, Chart c, System.Drawing.Point?p) { t.RemoveAll(); System.Drawing.Point pos = e.Location; if (p.HasValue && pos == p.Value) { return; } System.Windows.Forms.DataVisualization.Charting.HitTestResult[] results = new System.Windows.Forms.DataVisualization.Charting.HitTestResult[4]; try { results = c.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint); foreach (System.Windows.Forms.DataVisualization.Charting.HitTestResult result in results) { if (result.ChartElementType == ChartElementType.DataPoint) { DataPoint prop = result.Object as DataPoint; if (prop != null) { double pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue); double pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]); // check if the cursor is really close to the point (2 pixels around the point) if (Math.Abs(pos.X - pointXPixel) < 2) //&& Math.Abs(pos.Y - pointYPixel) < 2) { t.Show("X=" + prop.XValue + ", Y=" + prop.YValues[0], c, pos.X, pos.Y - 15); } } } } } catch { } }
internal static DisplaySettings?CreateNew(WindowsApi.DEVMODEW devmode) { if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_PELSWIDTH) == 0) { return(null); } var widthInPixels = devmode.dmPelsWidth; // if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_PELSHEIGHT) == 0) { return(null); } var heightInPixels = devmode.dmPelsHeight; // if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_DISPLAYFREQUENCY) == 0) { return(null); } var refreshRateInHertz = devmode.dmDisplayFrequency; // if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_BITSPERPEL) == 0) { return(null); } var bitsPerPixel = devmode.dmBitsPerPel; // DisplayOrientation?orientation = null; if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_DISPLAYORIENTATION) != 0) { orientation = (DisplayOrientation)devmode.DUMMYUNIONNAME.DUMMYSTRUCTNAME2.dmDisplayOrientation; } // FixedResolutionOutputOption?fixedOutputOption = null; if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_DISPLAYFIXEDOUTPUT) != 0) { fixedOutputOption = (FixedResolutionOutputOption)devmode.DUMMYUNIONNAME.DUMMYSTRUCTNAME2.dmDisplayFixedOutput; } // DisplayFlags?flags = null; if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_DISPLAYFLAGS) != 0) { flags = (DisplayFlags)devmode.DUMMYUNIONNAME2.dmDisplayFlags; } // System.Drawing.Point?position = null; if ((UInt32)(devmode.dmFields & WindowsApi.DM_FieldSelectionBit.DM_POSITION) != 0) { position = new System.Drawing.Point(devmode.DUMMYUNIONNAME.DUMMYSTRUCTNAME2.dmPosition.x, devmode.DUMMYUNIONNAME.DUMMYSTRUCTNAME2.dmPosition.y); } var result = new DisplaySettings( devmode, widthInPixels, heightInPixels, refreshRateInHertz, bitsPerPixel, orientation, fixedOutputOption, flags, position ); return(result); }
private void button3_Click(object sender, EventArgs e) { if (Selected1stPoint.HasValue && Selected2ndPoint.HasValue) { AddLink(); Selected1stPoint = null; Selected2ndPoint = null; button3.Enabled = false; button5.Enabled = false; } }
private void button5_Click(object sender, EventArgs e) { if (txtDrawingBoard.SelectedText == pointsymblol.ToString()) { Selected2ndPoint = GetLineAndPos(); button3.Enabled = true; } }