Make Graphic Persistent In VB And GDI+?
Sep 24, 2010
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]....
View 10 Replies
ADVERTISEMENT
Dec 7, 2009
I have an application that has two states based on the value of a Boolean variable: a read_only=true state and read_only=false state. The value of this state is stored in an external settings file. My application has a feature called deploy that generates a copy of itself in the same folder with the read_only=true state. But, the read_only variable value is stored in an external file so now both files will be in the read_only=true state. What I want to do is make one of them(the original one) always be read_only = false and the other read_only=true
View 3 Replies
Feb 23, 2010
here is what i want to do have a ToolStripMenuItem in a ToolStripDropDownButton menu what i want to do is have an option to not hide the menu when the ToolStripMenuItem is clicked so i wrote the following:
[Code]...
View 3 Replies
Jun 22, 2010
I want to make a graphic of certain data in my program. The problem is that the zedgraph doesn't zoom out to see the dots or lines in the graphic. This is my code:
[Code].....
I've tested the codes that Zedgraph provides in his homepage, but that code only work if you call this subroutine in the form load. Instead of that, I want to make the graphic when I clic a button.
View 1 Replies
Jun 28, 2012
I have made a music player, using the windows media player dll but now I want to make a graphic frequency equaliser
View 6 Replies
Dec 14, 2011
I am working with a very simple (so far..) little program where i use som trig to create a circle using pixels created vith the Ellipse-comand "(x, x, 1, 1)" etc.
But I want to se when the graphics is drawn, just not the finished circle, how do I do that?
I use the "Paint" version of the form. I am a beginner so excuse my poor skills. Shouldn´t this be a very simple little problem?
I work with Visual Basic 2008 Express
View 9 Replies
Jan 14, 2010
I'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 Replies
Sep 19, 2011
how to make the settings in my app persistent When i save in the previous run using this
my.Settings.setting_name= some_value
my.Settings.save()
when getting the values using this
some_value=my.Settings.setting_name
i still see the old values in the IDE settings options.How can i make the changes reflect even in the vs ide
View 1 Replies
Jan 31, 2011
i've created a usercontrol in a win forms project + the properties work as expected, but when i recreated my usercontrol as a win forms usercontrol class library, the properties changed at runtime aren't persistent.i tried adding a DesignerSerializationVisibility attribute to the property but that didn't work.
View 2 Replies
Mar 1, 2011
I am building a program which offers solutions to the travelling salesman problem (finding shortest tour between a set of cities while visiting each only once).
My program loads a bitmap image of a map into a picture box. From there, graphics which point out the cities as well as tour paths are drawn onto the map. My problem is that when the option to plot ALL cities is enacted, the user may choose to pinpoint a specific city with a separate control. When the user erases that pinpoint via an invalidation routine, though, it erases all graphics beneath it, which is undesirable. How can I make my tour graphics and city plots semi-permanent by drawing them directly on the image? I tried drawing them on a separate bitmap, but it 'covered up' the map image.
View 1 Replies
Jan 25, 2011
I was wondering if it is possible to have persistent changes to resources in an executable. I am using VB 2010. I don't know how to be much clearer than that but I will try.
> User opens program and picks 'File A'
> 'File A' is now copied into the executable, thus storing it forever (or until deletion of .exe
> .exe is now slightly larger because 'File A' is inside the program
> User can extract or delete 'File A'
View 2 Replies
Aug 31, 2011
point me to the best way to store persistant objects ( of my own class) in a vb application? I am putting together a simple family recipe application and have created a food item class. I would like to store the instances ( food items) indefinately so that they are there each time I start the program complete with all properties and meethods
View 14 Replies
Dec 27, 2011
You know how using My.Settings.something to store persistent data is done only for user settings and not application settings. This information is stored in the registry on the local user section.My problem here is that even if it is in the same machine, when a user changes some setting it is not reflected on other users. This is desirable for some of them but there are a few I would like to keep for all users.Is there a way to do it with the settings? Do I need to write to the registry in the machine section? or do you just recomend I create a configuration file?
View 5 Replies
Apr 19, 2012
I am very New to Vb.net. We are using fortify software for projects when it is going to LIVE. In that process I got some cross-Site Scripting : persistent Data flow issues.
[Code]...
View 1 Replies
Dec 13, 2010
I'm trying to create a version of the game Spill and Spell. I'm having problems with a click event for Labels that is supposed to exchange the .Text value stored from the previous mouse click with the current .Text value on the new Label clicked. The labels are initialized and stored in an array on the form load.
What's happening is that the values are remaining persistent to the label being clicked.
Desired Results (example):
User clicks on lblDice1 (sender), tempLetter is set to mouseLetter.CurrentLetter, mouseLetter.CurrentLetter is set to lblDice1.Text (sender.text), lblDice1.Text is set to tempLetter. (this part works)
User clicks on lblDice2 (sender), tempLetter is set to mouseLetter.CurrentLetter (s/b initial .Text value from lblDice1 above), mouseLetter.CurrentLetter is set to lblDice2.Text (sender.text), lblDice2.Text is set to tempLetter.
What's Happening:
The tempLetter and CurrentLetter values are remaining persistent to the Label being clicked on. Ie: lblDice1 click will only display the original text associated. If I click Dice1 then Dice2 and then Dice1 again, the original Dice1 text is displayed (same for Dice2).
This is a lot easier to see. All of the controls with the exception of a button ("btnStart") are defined in the code below. Click the Start button to show values in the DiceLabels grid.
The area that's the problem is Public Sub DiceLabel_Click
(this is a work in progress...)
[Code].....
View 8 Replies
Jan 9, 2011
I have an error in the beginning of a program I have converted from VB2002 to 2008, and I can't seem to find a way out of it. The error message is:Error2'Protected Overrides Sub Dispose(disposing As Boolean)' has multiple definitions with identical signatures.C:Documents and SettingsAdministratorDesktopBack UpExpendable VS8 copiesClick Counter VS8Click Counter VS8frmSecond.Designer.vb729Click Counter VS8
The offending code seems to be the word "Dispose" after the words "Overrides Sub".
[Code]...
View 3 Replies
Apr 13, 2010
We 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?
View 3 Replies
Jan 28, 2010
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?
View 1 Replies
Sep 23, 2009
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 Replies
Feb 18, 2010
I 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]....
View 3 Replies
Feb 17, 2011
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?
View 5 Replies
Jul 23, 2011
i 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 Replies
Apr 1, 2010
anyone have experience doing this? when i say imaginary i mean the square root of negative one. how would i graph this?
View 2 Replies
Feb 24, 2009
I 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 Replies
Mar 2, 2010
I'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 Replies
Jun 1, 2011
how 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!
View 6 Replies
Mar 12, 2012
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]...
View 1 Replies
Mar 2, 2010
I'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 1 Replies
Jun 2, 2011
i have this code which draws a continuous circle using a timer. Now I have to display it in the form which has a group box with loads of other fields and information. Now can anyone please tell me how can i add the circle into the group box as it can be displayed.Currently the circle is being displayed behind the group box which is not visible.
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
Me.sweepAngle += 1
If Me.sweepAngle = 360 Then
[code]....
View 2 Replies
Oct 28, 2011
Ok. So I have a program I have made to calculate angles. i have a line for true vertical and I need the program to draw the line at a given angle. Basically, if I put 82 in textbox1, I want the program to calculate the cordinates where that line sits on the X axis, The y axis is always picturebox1.height, So the y axis isn't important here, just the x axis.
What would I do to calculate this angle into a visual graphic?
View 6 Replies