VS 2008 Drawing A Grid?
Apr 23, 2009
I am having a bit of trouble drawing a grid with GDI+ and VB.net 2008. The grid is designed as one point perspective. The horizontal lines are not correctly positioned, and the form is taking a long time to draw. Could anyone suggest a faster, and mainly more accurite method?
Here is my code currently:
Public Class Form1
Const VanishPoint = -200
Dim g As Graphics = Graphics.FromImage(New Bitmap(Me.Width, Me.Height))
[Code]...
View 2 Replies
ADVERTISEMENT
Dec 27, 2009
I'm drawing a rectangle snapped to a grid by getting the start point(Mouse down e.location) and the end point(mouseup(e.location). The coding I'm having trouble with is having the program determine which way to draw the rectangle(where the location should be, and the height and width.) Now, this would be extremely simple if the user started their rectangle from the top left corner and ended it in the bottom right every time. But you need to be able to drag from all angles. So does anyone have some code lying around that I could look at so I could actually get my rectangles drawn right?
View 5 Replies
Apr 7, 2009
I am setting up a snake game, I just like to know a few things. Do I require a GRID? and the grid needs to be the same size as the square obviously but how do you go about moving the snake to the square. I mean why do I even require a grid? Why cant I move the snake by its own size. Just need some clarification of the steps I should take to make my snake game. I would like to do this from scratch.
View 2 Replies
Jun 3, 2012
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 Replies
Jun 2, 2010
winforms .net 3.5 Ultrawingrid 9.2 In my subclass of Ultrawingrid.Ultragrid :
[Code]...
This works fine. But when the grid is dropped on a TabControl tabpage, the ctrl-tab looks very different to the sub above. e.keycode is seen as controlkey {17} I realize that by default cntrl-Tab moves between tabpages. I need to override this behavior. My thought is I probably need a subclass of the tabControl which will pass the keycombo through just as the form does but I confess to being clueless as to how to accomplish that. I tried to override the onkeydown of a tabcontrol subclass and just issuing a return and not and base call to onkeydown if the ctrl-tab combo was pressed but it seemed to see the e.keycode as controlkey as well.
[Code]...
View 1 Replies
Aug 19, 2009
I have a little experience with drawing using GDI+ in VB.NET, but not so much with more complex shapes. All I ever used were lines and rectangles, and the occasional ellipse.I need to draw an 'arc' like this:I can specify the starting angle (0 in the picture), ending angle (angle from the horizontal (left side)), and the starting and ending radius, and I'm sure any other things I need can be calculated from that.The problem is that I have no clue which drawing function to use. Can I do it using FillPath, or FillClosedCurve, or? Of course, I could create a pie shape and then draw a second pie shape (slightly less radius) on top of that to make it appear like it's a single shape, but what if it needs to be 'transparent'? I don't want it to draw a solid shape on top.
View 17 Replies
Feb 18, 2012
I 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]....
View 1 Replies
Apr 24, 2012
I have made a program in which a small space ship rotates, with some tutorials I found, then when i tried to move it I realized that .location does not work for bitmaps..
View 1 Replies
Sep 2, 2010
I have a Custom Groupbox that overrides the OnPaint event to do some custom drawingbackgrounds, etc. The problem I have is that when I use it in an application and want to draw text on the control, it gets drawn first, then immediately afterwards the OnPaint from the control gets called and draws on top of the text. Is there any way to get the text drawn after the control's OnPaint?
View 1 Replies
Sep 12, 2009
Dim fnt As New Font("Verdana", 16)
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
[code].....
View 17 Replies
Oct 16, 2009
I want to draw a line on a image, easy enough in principal the image is a map and the lines is between city pairs?
View 12 Replies
Feb 2, 2011
I have my application to where you can load up an image and draw on it with the mouse left down and drag.Only problem is, if the form becomes the inactive one or is minimized/maximized the drawings go away until I scroll the image in the form (I put the redraw functionality in the picturebox.Paint event).How can I make the lines I draw stay permanently? I've put picturebox1.refresh in the minimizedchanged/maximizechanged and form.activated events and still nothing..Even tried the picturebox's resize event and nothing?
View 18 Replies
Dec 21, 2010
I'm trying to draw text on the progressbar. This code below works, but when the progress bar re-paints itself the text disappears.
ProgressBar1.CreateGraphics().DrawString(Vaule & "%", New Font("Arial", CSng(8.25), FontStyle.Regular), Brushes.Black, New PointF(ProgressBar1.Width / 2 - 10, ProgressBar1.Height / 2 - 7))
jmcilhinney suggested i look into the PaintEventHandler.
I read the MSDN documents, but they used PictureBox(). I made this code below, but no luck.
[code]....
View 4 Replies
Sep 30, 2009
my assignment is to draw a graph within my VB form with a some variables I have. I was told by my boss that I should use Microsoft Chart Control 6.0, but I don't think it matters if it is in another software.I currently have a few variables, each with a lot of values, "Frequency", which is user entered from maximum to minimum, CH (channel) 1-4 which are given by a machine output I use at my company. My graph, is supposed to have the Frequency values in the X-Axis (horizontal) and the CH 1-4 values within a range of each other in the Y-Axis. Can anybody help? My code for extracting the data and getting the frequency is below. How I got most of it is thanks to Stanav, the thread is over here: url...It comes with 3 buttons (I have not put in the code for button 3), the 3rd button will be used for plotting the graph when clicked.
View 3 Replies
Sep 2, 2010
I have a Custom Groupbox that overrides the OnPaint event to do some custom drawing,backgrounds, etc. The problem I have is that when I use it in an application and want to draw text on the control, it gets drawn first, then immediately afterwards the OnPaint from the control gets called and draws on top of the text. Is there any way to get the text drawn after the control's OnPaint?
View 3 Replies
Jun 21, 2010
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]...
View 4 Replies
Aug 17, 2009
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?
View 8 Replies
Feb 9, 2010
I'm trying to draw a simple rectangular gradient but I keep getting this one error. Here is the code below: Drawing::Rectangle^ myRectangle =
gcnew Drawing::Rectangle(10, 10, 100, 100);
Drawing2D::LinearGradientBrush^ myGradient =
gcnew Drawing2D::LinearGradientBrush(myRectangle ,Color::Red, Color::Blue, 50);
e->Graphics->FillRectangle(myGradient, 20, 30, 100, 100);
View 7 Replies
Sep 13, 2009
I have been looking through the code bank and i cant find anything that is helping me with my problem what i have is a print button that when clicked it goes to my print preview page, then i can print the file. i have got all the other controls on my page to display correctly using this example
e.Graphics.DrawString(sType, New Font("Arial", 10, FontStyle.Underline), Brushes.Black, 110, 650)
but how can i get my ListView header and content to preview on the page as well. my listView has 5 columns and i am using the PrintDocument control.
View 10 Replies
Jul 5, 2010
I've got a fun little question for you all. I am designing a program that allows you to click on a picture to input data in certain areas. What I want to do it pretty allow someone to take a look at a picture. Click the add point tool, then select an area on the picture where it places a circle. I then want them to be able to go back to the circle and modify data if necessary
View 8 Replies
Jun 29, 2009
This may be a stupid question, but is it possible to add things like lines to a form easily? Without creating the line manually using System.Drawing?
View 5 Replies
May 15, 2009
I'm trying to draw on screen using the mousepath, as I understand I should use the GetDC function and ReleaseDC function, what I want to do is when the mouse left button is down I want to draw anywhere on the screen the path the mouse did (like painter but on the screen), The main problem is that when I draw I have to clean it up later (After the left mouse is up). How can I use the Mousepath to draw on screen?
View 2 Replies
Jan 13, 2010
how to draw an unknown amount of images to a form
the amount of images should be determined during runtime.
View 1 Replies
Jul 23, 2009
I have been struggling with this issue for like 3 days now. What I need is ONLY a printcopy of a receipt. To do this, I made a template with labels to display respective values(pulled out by SQL statements).
View 1 Replies
May 23, 2009
Is it possible to convert an object form System.Drawing.Graphics to System.Drawing.Image?
View 4 Replies
Jan 21, 2010
Here 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?
View 4 Replies
Mar 10, 2010
I have a problem with importing an excel into a data grid.
Here is my code:
Try
Dim _Obj As New ExcelConnection.ExcelConnection
_Obj.ImportAttendence("c:Info_pc.xls", DataGrid1)
Catch ex As Exception
End Try
In the excel i have numers and text and "Service Pack", "Processor Speed" and "Numar procesoare(Number of processors)" and the values for these are numers. in the data grid when i import the excel those values doesn't appear, i receive the value "null".
View 7 Replies
Jan 26, 2011
i'm using the MVCContrib grid trying to override the start of a row and the end of a row. It's not working as advertised. This is an extract from my MVC2.0 view.
<div id="chargestable">
<br />
<% With Html.Grid(Model.InvoiceListingInformation)
.Columns(Function(column)
[code]....
The stuff i put in the begin row and end row functions is being rendered above the grid entirely.(PS i can't just use the attributes as i need to wrap the row in another html element)
View 1 Replies
Mar 11, 2010
i have a prob that i have a gridview on the parent window. when i open a child window using showmodaldialog, i enter some data in the textboxes. now when i close my child window i want to display the text entered by me in the grid. i want to know how can i access the grid in child window
View 1 Replies
Jun 9, 2012
Trying to understand the basics of grid design so how would I make a over sized grid or a grid larger then whats viewable on my screen resolution? Below is a simple chart describeing what i want to make roughly. I would like to build the grid in "blocks".[URL]..
View 16 Replies