Erase A Graphic That Was Created?
Jul 23, 2011i would like to be able to erase a graphic that was created.I would like to not have to redraw the graphics minus the graphic thats unwanted.Is there a way to delete a graphic?
View 1 Repliesi would like to be able to erase a graphic that was created.I would like to not have to redraw the graphics minus the graphic thats unwanted.Is there a way to delete a graphic?
View 1 RepliesI'm trying to make a mini map for a 2d space shooter of mine; I've for the math down (I think) for when an item should appear on the mini map, but the problem is the graphic. As it stands, the graphic spills over the edge of the mini map graphic and disappears only when it's fully outside. I need it to crop the image, or at least not show it off the mini map graphic.I thought of using the sourcerect rectangle of the spritebatch.draw, but it seems to me that would only work for the right and bottom section, as I can adjust the size of the rectangle. I haven't tried this yet, but I will soon. Can the location of the source rectangle be changed in relation to the graphic that it is a part of being drawn so that I can use that to crop the left and top sides?
View 5 RepliesI have some problems. I wantd to convert come vb codes into vb net.
1. I have this VB 6 code:
Public Type ddt
x As String
End Type
I have convertid it in this way:
Public Structure ddt
[Code]...
I have 100 textboxes with different numbers on them how can i erase theses numbers all together not like this textbox1.text = "" Erase numbers with one click?
View 39 RepliesMy program uses OCR dll to get text from other program. It copy and paste text to a text box. Can someone give me a code that will erase everything exept numbers or ".
View 2 RepliesI'm having some trouble getting my button to erase the text that is in the textboxes when I hit it. I thought it would be something like txtAnswerText.Text = "" in side of the Next1_Click sub but that didn't do anything at all.
View 1 RepliesHere' s my code to draw a single line on a windows form.
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawLine(myPen, 0, 0, 200, 200)
myPen.Dispose()
formGraphics.Dispose()
I would simply like to erase it now. I've read that the best way to do this is to re-draw the whole form, or to delete the line object..etc..
How do I erase the selected rectangle away?
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
m_drawing = True
[code].....
I have to automate a program that is outside of my control. The way I'm doing this is to use SendKeys.SendWait("keys") to the other program. The problem is, there are multiple fields that might be active and no way to select a single one with confidence. The fields are all different lengths, so my solution is to copy something really long, copy it to the clipboard, and look at the last character that made it though, so I know which field is selected in the other program. This overrides the clipboard, unfortunately.
[Code]...
I already have code to read ID3v1 and v2 tags. That's not the problem. I open an IOStream, locate the ID3v2 header and pull the bytes out. Handling unicode was a bit of a sod, but I got it working.
What I don't understand is how to remove an ID3v2 tag or write one out. ID3v1 is easy - just truncate the file, then append some bytes. Simple. But ID3v2 tags don't have to be at the start of the file, do they? It's conventional, but by no means mandatory. If I just crop the entire ID3 out of the file, and close the gap, will that work? And then, to write my own tags, should I just write the bytes to the front of the file? Or do I need to update other bits of the file so the player will know where the audio data has moved to?
Also, do I need to use unsynchronisation? How can I tell if I need to?
I've looked on CodeProject; I've googled; and I've read the specification on id3.org - which, by the way, is less than clear! For example, it says that the "Extended header size" can be 6 or 10 bytes in length. So um....how am I supposed to know which one? Is there some magic way of determining how many bytes this value is being stored as?
1) I still don't know how to link how to link form 1 and form 2...(can we link or NOT??)
2) How to create button erase the answer in form?
3) How to link micrososft access n vbnet?
4) How to create button next n go to the next form?(ex: from form 1 to form 2).
What I don't understand is how to remove an ID3v2 tag or write one out. ID3v1 is easy - just truncate the file, then append some bytes. Simple. But ID3v2 tags don't have to be at the start of the file, do they? It's conventional, but by no means mandatory. If I just crop the entire ID3 out of the file, and close the gap, will that work? And then, to write my own tags, should I just write the bytes to the front of the file? Or do I need to update other bits of the file so the player will know where the audio data has moved to?Also, do I need to use unsynchronisation? How can I tell if I need to?I've looked on CodeProject; I've googled; and I've read the specification on id3.org - which, by the way, is less than clear! For example, it says that the "Extended header size" can be 6 or 10 bytes in length. So um....how am I supposed to know which one? Is there some magic way of determining how many bytes this value is being stored as?
View 1 Repliessimple question. How do I erase all the rows in the DataGridView? This is the code I got:
[Code]...
It updates the values, but say a row was deleted from the database. It will get rid of all the values in the row, but it will keep a blank row. This results in it throwing this error: System.IndexOutOfRangeException: Index 1 does not have a value.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If System.IO.File.Exists(FILE_NAME) = True Then
Dim lines As New List(Of String)
Dim text As Array = File.ReadAllLines(FILE_NAME)
lines.AddRange(text)
[Code]...
i get this error Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
for the line lines.RemoveAt(lines.IndexOf(ListBox1.SelectedIndex))
i am writting a programm in vb net and i need to erase the detail of file each time when a button click
View 2 RepliesI have started to work some more on my 'shape editor'. If you're not familiar with it,ust imagine the Visual Studio form designer: a 'canvas' (the form) with a bunch of 'shapes' (the controls) that can be selected, moved, resized, etc. I have just finished implementing snapping between shapes and the canvas boundaries. But now I am having some slight issues with painting the snap lines.Just FYI: this is what I mean by snap lines:The blue lines that indicate that the 'buttons' are snapped to each other, and a purple line indicating that button1 is snapped to the boundary.
My shape editor is based loosely on jmcilhinney's 'manipulating GDI+ drawings' codebank entry, and a central idea in that post is to only draw what is necessary. In other words, when I move a shape I could re-draw the entire canvas, but it is much faster and smoother to only re-draw the old and the new location of the shape. Since nothing else has changed, I don't need to draw the rest. So, I simply invalidate the old bounds and the new bounds, and even with a lot of shapes all moving simultaneously it still feels very smooth.
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.
HOW TO update and query and erase in database on visual studio using officce access
View 3 RepliesI have an editor created invb.net that creates html files. And when i click the button run , the Internet Explorer opens my file that is inside the Richtextbox.
View 3 RepliesWe have a great book written for Visual Basic 2005 that we type code that is prepared in advance. We are using Visual Basic Express 2008 and normally this works really great; type the code run the program and it works, however I am running into a snag.
The textbook shows the following code: IN THE(General) (Declarations)AREA we are told to type the following:
' Create a Graphic object to use with the game's bitmap
Dim myGraphicObject As Graphics = Me.CreateGraphics
' Create an empty Bitmap Object
[Code].....
is there a difference between VB 2005 and VB 2008 that would be causing the errors? or am I missing something subtle maybe mistyped?
I would like to know how to use the graphic methods:
-DrawString
-DrawLine
-FillRectangle
I am meant to use these in a method called Drawgraph in order to draw a grid and bar chart. How can I go about this? What parameters do I need to send? What variables do I need to declare?
I have just started to try learning how to use Visual Basic (im running the 2008 express free version). The example im trying to get working right now looks like follows[code]...
View 2 RepliesI am programming a design surface where I add Image objects to the surface when an image is added it calls the draw objects command. It works fine I would like to figure out how to covert the object to an image to save it? Below is the draw sub used to draw objects onto the surface:
Public Sub DrawObjects(ByVal g As Graphics, ByVal Scale As Single)
Dim drawObj As GraphicObject
Dim i As Integer
[code]....
I am working with a graphics program in VB to move an image around the Form. I'm trying to create barriers that cannot be crossed. At first, I tried to represent this with a 2D array, but this proved too complicated. For now, I'm trying to create a series of rectangles. What I want to happen is when the point the image is anchored at intercepts one of these rectangles, it will either be prevented from moving or sent back to where it was directly before the image moved. I know there is an intercept command, but I've been unable to figure out how to use it in this content. The code I have is below.
Public Class Form1
Dim PlayerSprite As Image
Dim BGImage As Image
[code]....
As I said, this is to create a graphic barrier. However, I expect to make a number of these Rectangles?
anyone have experience doing this? when i say imaginary i mean the square root of negative one. how would i graph this?
View 2 RepliesI want to make a form to schedule the on and off time of equipment. & rows for seven days. 96 columns for 24 hours divided by 15 minutes. Each cell will be red for on and green for off. Click the cell to toggle the color. I know what I want it to look like. But I dont think using 500 buttons is a good idea. I am looking for better ideas on which direction to go. I am using visual studio express.
View 1 RepliesI'm developing a scanning application in VB.NET 2005 using TWAIN. The scanner returns to me a handle to a DIB. I need to save this to a file, but I've been searching everywhere and can't find any information.
View 3 Replieshow do I set up a timer to load a graphic from the web to a picturebox
heres a sample graphic
[URL]
its real small so it will load fast. the link will be different but this is good enough to test with
I need it to be on a timer event to load this graphic every .... seconds, that part of the code I can do, timer events are easy. getting this graphic into a picturebox is a pain though.
You Know Your Addicted To Computers When - Your main computer is a 7 terabyte, Core2Quad 3 Ghz +, with 4 or more gigs ram, over 200 programs installed, and you would rather sit with it programming than go to the movies!
I have a converted VB6 App that would draw irregular shapes on a PictureBox when I click on a button, and these irregular shapes would persist until I either close the App or erased the PictureBox to start the display anew.I converted my App to VB.Net to do the same, i.e. draw on a PictureBox again, but the drawn lines appear briefly and then, at the end of the drawing process, when my App returns control to the Operating System in wait for another event, the graphics disappear as if erased by the App (which I don't do of course).I have created a Graphics Object associated to my Picture Box as:
Dim CurrGraphics as System.Drawing.Graphics
CurrGraphics = PictureOut.CreateGraphics
I then use the DrawPolygon and DrawLine methods to add the irregular shapes I want:
CurrGraphics.DrawPolygon(CurrPen, Pts)
CurrGraphics.DrawLine(CurrPen, Pts(I).X, Pts(I).Y, Pts(I+1).X, Pts(I+1).Y)
where CurrPen is a defined Pen, and Pts is the Points() array with the coordinates of the displayed shape. Several dozens irregular shapes are drawn and then the subroutine stops, and returns to waiting for another request from the user.What could be the prime reason why graphics do not persist in a PictureBox, and are erased immediately after they are created ?
PS: I do not use the PainEvent of the PictureBox PictureOut, as in the example given in the VB documentation (below), as the display process is initiated by clicking on a button, and I cannot relate how to transfer control to the PaintEvent as below:
Private Sub Form1_Paint(sender As Object, pe As PaintEventArgs) Handles _
MyBase.Paint
' Declares the Graphics object and sets it to the Graphics object
[code]....
I have a module that generates fill out a System.Drawing.Graphics object. I then try to print it with a event on my main form but the print preview comes out blank. This is my print page
[Code]...