Drawing Polygon Within A Polygon At Runtime?
Jun 7, 2011how do you draw or place a polygon/line within another polygon e.g. a circle within a triangle.
View 5 Replieshow do you draw or place a polygon/line within another polygon e.g. a circle within a triangle.
View 5 Replieshow can i get the points which make a polygon from a region which was derived from the polygon's points?
View 1 RepliesI am developing the map tool application in vb.net where user can create maps. I gave the check boxes for show/hide the layers of map like village boundary(polygon), plot boundary(Polygon), roads(Lines), bore wells(points), dug wells(points), schools(points).
I am using the function RedrawMap for displaying various layers of maps as user checked the check boxes. If user click village boundary map shows the village boundary etc on panel control named "picMap".
The problem i am facing is when user check the village boundary layer map shows the boundary but when user check the next polygon layer i.e. plot boundary layer it gives the error message "5:Object is currently in use elsewhere.".
My code is as follows:
Public Sub RedrawMap(ByVal index As Integer)
Dim f As Font
'Object Style
Dim Size1 As Short
[code]....
I'm having an issue when passing an object of type Dictionary(Of Int16, Polygon) as an argument to a backgroundworker so the background worker is able to access the Polygons in the Dictionary. I'm getting the typical "The calling thread cannot access this object because a different thread owns it" message.[code]...
View 2 Replieshow can i calculate the 13 points on the polygon (see image)?
the 2 points either side of the centre points
are +/- width or height * 0.2761423749154
i have 4 known points, topLeft, topRight, bottomRight, + bottomLeft.
the polygon won't always be a regular rectangle as it is in the image
If I have some polygon lat lon coordinates stored in sqlserver db. how would I query it to see if a point was in contained within a polygon?
View 2 RepliesI just finished creating a program where you find the area of a 5 sided polygon. But not I want to actually draw the polygon given the coordinates
Private Sub PI_Estimation_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim myGraphics As Graphics
[code].....
I have a collection of latitudes and longitudes and I'll be grabbing sets of these and want to draw a polygon based on them.The datasets won't be the outline so will need an algorithm to establish which ones make up the outline of a polygon containing all the latitudes and longitudes supplied. This polygon needs to be flexible so the polygon can be concave if the points dictate that.
My code below produces a horrible looking polygon. As explain in my first post I want to create a nice concave or convex polygon based on the latlng's provided.Just need a way of plotting the outer latlngs.
function initialize() {
var myLatLng = new google.maps.LatLng(51.407431, -0.727142);
var myOptions = {
[code]....
I'm making a game for a school project We've created a character that moves around the screen and creates blocks behind him as he moves around.We want to make it so that when the character moves from one edge of the screen to another, it fills the screen. So in order to do this we have a Points array that stores every point the character touches on his way to a wall.We then fill the Points array with "formsurface.fillPolygon(Points)"Now I'm wondering is there anyway we can retrieve all the points that are WITHIN or INSIDE the Points array we made? ( remember the points array simply contains the outline or the path the character created, we're filling inside that outline)
View 1 Repliesi dont know how to do this.i need to create a macro to use on microsoft excel to calculate the area of any polygon. my problem is similar to this one: [URL]..but de vb code is not working for me.in attach i send the excel page.i also have to calculate the coordenates of the "center of mass", Cx and Cy using diferents functions.
View 1 Replieshow can i inflate an array of points which describe a polygon?
View 1 RepliesOn click, I'd like this piece of code to create new polygon, shown in multiples with different coordinates and colors, sizes and orientation. Color and polygon in multiples works. My issue is I'd like to add more code that will allow each of the multiple polygon created scaled randomly and rotated. How to keep the polygons inside the canvas?
So far looks like this when user clicks start: [URL]
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles startButton.Click
Dim endCount As Integer = random.Next(1, 10)
Dim plotPoint As New Point
For count = 1 To endCount
[Code] .....
I'm working on a small freeware application in Visual Studio 2008 Standard that will match geographic data to a geographic position. For this I need some mathemathical functions and one of them is how to detect if a point is inside a polygon. There's a great solution for this from the Microsoft team at: [URL]
but it is in a different programming language that I do not know anything about. How can I use these functions in my program? I'm afraid that if I try to rewrite them in Visual Basic I'll make mistakes that I can't detect. To be complete, I'm not using screen graphics so I really need a mathemathical solution.
I'm trying to write a simple game ui, it is grid/tile based, and i have the grid built using grid column and row definitions and I'm successfully placing objects in various grid locations. I am currently stuck as trying to build the player object. I want a single object reference to represent the various components of the players piece.
Currently I am using a polygon to represent the piece on the grid. Eventually I want to replace this with images or something. I want to add in properties for what weapon and armor it has equipped I want properties for health
Essentially in code i want something like this
dim player1 as new playerobject
player1.polygon.points = 0,0 60,30 0,60
player1.health = 100
[Code]....
I can instantiate all this as separate variables etc, but I'd like to have a singular reference that contains all the variables, properties, objects, controls etc.
I'm using vb .net in vs 2010 (and no, I'm not looking to write in something else)
I'm trying to write a simple game ui, it is grid/tile based, and i have the grid built using grid column and row definitions and I'm successfully placing objects in various grid locations.I am currently stuck as trying to build the player object. I want a single object reference to represent the various components of the players piece.
Currently I am using a polygon to represent the piece on the grid. Eventually I want to replace this with images or something.I want to add in properties for what weapon and armor it has equipped I want properties for health Essentially in code i want something like this
dim player1 as new playerobject
player1.polygon.points = 0,0 60,30 0,60
player1.health = 100
player1.weapon = "axe"
etc
I can instantiate all this as separate variables etc, but I'd like to have a singular reference that contains all the variables, properties, objects, controls etc.I'm using vb .net in vs 2010.
I've created a polygon shape and filled which fills blue on startup.Upon toggling a check box it should be filled yellow.It doesn't go yellow (unless i step through in debugging).
[Code]...
I am writing a program wherein the user draws shapes by clicking a button for the desired shape and then clicking on points on the drawing area. I cannot figure out how to store four clicked points to create a foursided polygon. I read many articles that say use the "mousedown" command and store points in a list, I have tried but it's not working for me. To summarize, I need the user to click the polygon button, go to the drawing area, click four points and have a foursided polygon created.
View 6 Repliesis there a way to offset the points in a polygon without having to change each one individually the points are in an array
View 2 RepliesHow to draw a rectangle inside an ellipse at runtime?
View 8 RepliesI have a Form1 where i can add usercontrols during runtime. I draw their appereance in the OnPaint event using the GDI+ engine. The greate part is that i want to be able to resize these images during runtime wich goes pretty well now cause i draw points in percentage of the control. Unfortunetly it is very difficult to draw nice images/drawings ect with the GDI+ engine. Is there any other way in doing this?
[Code]....
draw individual pixels, without resorting to drawing a line and setting it's length to 1. Is there an actual ability to draw a pixel that is just 1 pixel big?
View 2 RepliesI need some code to draw a resizable, draggable rectangular cursor (or selection box) on a picturebox. I found some excellent code (albeit rather old) that does just that, but on a form rather than a picturebox. I have tried converting the code - basically moving things to the picturebox events (Paint, MouseDown, MouseMove etc). It nearly works but leaves a trail behind it when you move or resize the cursor. In other words, the selection rectangle is not being erased before being drawn in the new position.
Is there some fundamental difference between drawing graphics on a form and drawing on a picturebox that would cause this behaviour? Something like, when you invalidate a form and cause a redraw it erases what you did last? If not, then I just need to dig a bit further and work out how the cursor is being erased from the previous position.
Here's the original code that works fine on a form:
Private DragRect As New RectangleF(20, 20, 100, 80)
Private Adornments(7) As RectangleF
Private MouseInRect As Boolean = False
[Code]....
Say I have 3 Buttons, labelled: Unit 1, Unit 2 and Unit 3. When I click on any button I want a drawing of that unit to appear on screen at a pre-specified starting point. Thereafter when I press any other one of the buttons the unit drawings appear alongside each other in a line. So I could end up with:
[Code]...
With this line...
If PictureBox1.Image = My.Resources._2star Then
I get this error: Operator '=' is not defined for types 'System.Drawing.Image' and 'System.Drawing.Bitmap'.Is there another way to say = with images?
Is it possible to convert an object form System.Drawing.Graphics to System.Drawing.Image?
View 4 RepliesHere is my favicon code
Dim oURL As Uri = New Uri(e.Uri.AbsoluteUri)
Dim favicon As Image
If oURL.HostNameType = UriHostNameType.Dns Then
[code]....
The error is Value of type System.Drawing.Image cannot be converted to System.Drawing.Icon Is it even possible to make the favicon be the icon of the form?
im using an MDI parent form and MDI Child. how can i print the image that's inside a picture box that's inside the Child from a button that's on the Parent?when i try to use print preview or print dialog, i can't get it to recognize that the document is the picure inside the picture box. i've looked up this error message:Value of type 'System.Drawing.Image' cannot be converted to 'System.Drawing.Printing.PrintDocument'.[code]
View 6 RepliesI am making a web browser using geckofx. I have put the favicon in a picture box but I have changed my mind and now I want it as the form's icon. The code for the favicon is:[code...]
The favicon works fine in the picture box but i think it will look better as an icon. If i change the line Me.PictureBox1.Image = favicon to Form1.icon = favicon I get the error Value of type 'System.Drawing.Image' cannot be converted to 'System.Drawing.Icon'. How can I get this to work?
I have a System.Drawing.Graphics g, which draw something in a PictureBox. Now I want to export this pGraphics to a new System.DrawingImage pImage (or Bitmap). But how?
Dim pImage As Bitmap
Dim g As Graphics
g = Graphics.FromImage(b)
[Code].....
I have two graphics I'm trying to superimpose into one, then display in a DataGridViewImage cell...The Value property of a DataGridViewImage is an Image type.
Dim Image1 As System.Drawing.Image = imgl_Imagelist1.Images(0)
Dim Image2 As New Bitmap(imgl_ImageList2.Images(0))
Dim DualGraphic As Graphics = Graphics.FromImage(Image1)
[code].....