VB 2008 Move A Drawing?
Apr 24, 2012I 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 RepliesI 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 RepliesI have drawn a rectangle using GDI+ but I need to move the rectangle with the arrow keys. I have the code to do it, but there is something wrong with the code: the rectangle won't move.
[code]...
I used a picturebox to allow user draw lines by mouse. I used this code in mouse down:
Dim D As New System.Drawing.Pen(DrawingColor, 2)
Dim g As Graphics = PB.CreateGraphics()
g.DrawLine(D, X1, Y1, X2, Y2)
but when a window appear on front of picturebox... its seams that picturebox redraw itself, so drawn lines erased.
What does this error mean? I havent modified anything in the designer code, but its giving me an error? WithEvents variable 'Move' conflicts with event 'Move' in the base class 'Control' and should be declared 'Shadows'. The error relates to Friend WithEvents Move As System.Windows.Forms.DataGridViewCheckBoxColumn
View 1 Repliesdraw 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 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 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]....
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 RepliesDim fnt As New Font("Verdana", 16)
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
[code].....
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]...
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 RepliesI 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 RepliesI'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]....
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 RepliesI 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 RepliesSay 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?
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);
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.
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 RepliesThis 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 RepliesI'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 Replieshow to draw an unknown amount of images to a form
the amount of images should be determined during runtime.
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 RepliesIs 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?
VB 6 has a ScaleHeight and ScaleWidth property which VB 2008 does not support and this is causing me fits to work around. I'm trying to draw some lines (a graph) on a Picture Box (or a Panel) using my own coordinates (not pixels). This can't be all that hard can it?
View 3 RepliesI am trying to draw arrows between the cells on datagridview. The problem is, if I make graphics with:
VB.Net
Dim g As Graphics = dgwTable.CreateGraphics
Then draw something with this graphics, my lines stay behind the cells. Is there any way to draw onto the cells?Is there any way to draw arrows?
I'm basically trying to make a simple, easy-to-use, paint program. I seem to be having problems with using multiple colors in the PictureBox1_Paint option. It draws the graphics but when you change the brush color and click in the picturebox it changes the colors of the previous graphics to the color you are currently trying to use. I need it to allow multiple colors.
Here's the code that I'm currently using..
Imports System.Drawing.Drawing2D
Public Class DynosPaint
Inherits System.Windows.Forms.Form
Private IsFormBeingDragged As Boolean = False
[code]....
How should i clean up after drawing to an image on a timer? I am getting a memory leak BTW I don't really understand why this is necessary; i mean shouldn't .net automatically clean up when an object has no longer any references to it?anyway here is basically the outline my
vb
Private Sub MainTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainTimer.Tick
...
Dim FaceBit As Bitmap
[code]....