Hi,everyone. I want to do something like that.
I draw something one the drawing fisrt,
then open one windows form。
The problem is the form location。I do not want the form cover the graphic what i was drawing before.
Is there anyone could give me some mind about that? Maybe, there is a way to Caculate the Point of the screen by Entity
Solved! Go to Solution.
Solved! by Alexander.Rivilis. See the answer in context.
Without P/Invoke it will be possible also with Editor.PointToScreen and Editor.PointToWorld
you can get your current mouse-coords (Windows) with that option:
Dim tScreenCoords As System.Drawing.Point = System.Windows.Forms.Control.MousePosition
And if you load your form you can define it's postion by:
Me.Location = tScreenCoords
or if you need any offset
Me.Location = New System.Drawing.Point(tScreenCoords.X + Offset.X, tScreenCoords.Y + Offset.Y)
(where "Me" stands for the form-object-instance)
Make sure to set the property .StartPosition of the form-object like that
Me.StartPosition = Windows.Forms.FormStartPosition.Manual
HTH, - alfred -
Thanks for your reply! However, set the mouse position as the form location,maybe can solve it when the drawing is from left to right, but drawing from right to left will be not right!
then you might calculate the position of your text in modelspace (WCS) and use then >>>acedCoordFromWorldToPixel<<< to calculate the position for your form.
At >>>this blog<<< from Kean Walmsley you find a method for how to invoke the function from a dotNET application.
Scroll down or use search to find this statement:
Be careful, 32bit and 64bit are different for that declaration:
HTH, - alfred -
Yeah,It is the answer! However, it is not the point to the Screen, It is the point to the mdi window of the Document, I use some transformations, then solve it. Thanks!
Access a broad range of knowledge to help get the most out of your products and services.