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
Position!
Solved! Go to Solution.
Solved by Alexander.Rivilis. Go to Solution.
Hi,
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!
Hi,
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:
[DllImport("acad.exe", EntryPoint="?acedCoordFromWorldToPixel@@YAHHQBNAAVCPoint@@@Z")]
Be careful, 32bit and 64bit are different for that declaration:
32bit: EntryPoint:="?acedCoordFromWorldToPixel@@YAHHQBNAAVCPoint@@@Z"
64bit: EntryPoint:="?acedCoordFromWorldToPixel@@YAHHQEBNAEAVCPoint@@@Z"
HTH, - alfred -
Without P/Invoke it will be possible also with Editor.PointToScreen and Editor.PointToWorld
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
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!
Can't find what you're looking for? Ask the community or share your knowledge.