Visio activex shapes vertices - c#

i am using in my c# project visio activex to import visio floorplan drawings.
and i need to get the vertices of the shapes in that drawing, and i can't find any method or property for it.
if someone has any ideas please help.

You can use the BoundingBox method on the shape class to retrieve the dimensions of the box around a shape.
This MSDN page will give you more information about the method, it returns the top, bottom, left and right of the box, so it should be possible to work out the vertices from that.

Visio uses a PinX and a PinY to describe the location of a shape using the shapes Height and Width will allow you to calculate the vertices.

Related

Draw boxes on edges labels with Microsoft Automatic Graph Layout

Somebody knows how i can draw the edges labels in a box with this library?
I am using it in C#.
Thanks!
If someone have the same problem, i have found a solution. The solution is to modify the Draw class, concretelly the DrawStringInRectCenter method.
I have get as parameter a Graphics and a DObject objects, then i cast if the DOBject is a DNode or DEdge. In case of been DEdge i call DrawRectangle, FillRectangle and DrawString in such order, with the aim of make a box with white background, black border and black label.

Get X-Y coordinates for GridViewCell on GUI

I have an activity to provide Intellesence functionality to the user for RadRichTextBox placed inside RadGridView. I have implemented the functionality for intellesence by using RadListBox.
But i am facing problem while displying the RadListBox at certain location where user is typing.
To resolve the problem, a need to calculate the X-Y coordinates of GridViewCell in which my RadRichTextBox is placed.
Once i will get the coordinates for GridViewCell than that can be used to calculate the actual position where user is typing.
SO what i finally want the GridViewCell X-Y coordinates relative to my current view on GUI.
This functionality will be implemented in a Silverlight application using Telerik controls.
I got the solution:
GeneralTransform globalTransform = gridViewParent.CurrentCell.TransformToVisual(Application.Current.RootVisual);
Point transformedPoint = globalTransform.Transform(new Point(0, 0));

Cropping a Bitmap to an Area of Interest

Similar to my previous question which I as yet have not solved (Comparing Frames of a live Feed) I have another issue.
Scenario
I have an image taken by a camera that contains a rectangle in it. I need to crop the image to only show the rectangle plus a small margin.
My Efforts
I have accomplished this by iterating through the pixels using LockBits and attempting to find potential edges but these seems terribly slow and inefficient
My Thoughts
I was thinking I could take an empty image as a baseline and then remove the differences between the two, however I cannot be sure that the lighting will be exactly the same and that potential contaminants such as an accidental fly getting into the image will not be present which could muck up this process.
Is there any easier way? The rectangle should (usually) be in the bottom left corner, but not always (long story) but this cant be relied upon.
My Environment
Visual Studio 2012 (2010 if neccessary is available)
Ueye camera
C#
The images are of type System.Drawing.Bitmap
The rectangle will often be something like a credit card or an ID card or anything of a similar size and shape
The empty image (background) looks like this:
Using EmguCV you can detect shapes such as a rectangle. Click here for the emgu code. Once you have detected the rectangle it is fairly easy to crop it out using a new Bitmap with the size of the rectangle.
The sample demonstrates how to crop the image from specific Picturebox control into destination Picturebox control using mouse selection or specified coordinates.
1.How to use mouse to select an area (rectangle) in a Picturebox control.
2.How to crop the image by the rectangle.
http://code.msdn.microsoft.com/windowsdesktop/CSWinFormCropImage-d4beb1fa

Move System.Drawing.Rectangle to a different area on Screen

I am creating a screen capture & crop utility using answer posted here
The code draws a rectangle (System.Drawing.Rectangle) on the screen and saves a cropped image.
I need to make this rectangle movable to a different area on the screen without changing the size.
How can I achieve this?
What did not work for me?
I tried this codeproject article, works very good to move controls on the screen.
For this code to work correctly I would need to draw rectangle on a container control.
Which container can be used to wrapping?
Being a succesful web developer I used to think that I can write for WinForms also... I was wrong :-( Some help would be much appreciated!
In C# Windows Forms to change the location of a rectangle you do the following
rect.Location = new Location(x,y);
Where x and y are the coordinates (relative to the window's origin) that you want to move it to.
Here's a link to The MSDN Page on System.Drawing.Rectangle

c# - How to cut triangle from image?

I use C# in my work.
I want to render a border with different weigths on its sides.
Like this:
This pictures are from browser, I want to draw corners the same way.
May be the best and the simplest way to implement it is to cut corners from borders at specified angle, like this:
but I have no idea how to cut triangles from image using c# drawing API, and, unfortunately, google doesn't help with this task, there is information only about cropping rectangles.
Any help greatly appreciated.
You could use GraphicsPath for this. Define a path of a number of points (a shape) and perform garphics operations on it just like it was a rectanble.

Categories