Correct Way To Pass The Graphics Object?
Oct 2, 2009
When I do my form_paint event, I have quite a lot to redraw, so I'm breaking into into severals subs to make it easier to read. I'm passing the 'e' variable into my subs as shown below, is this correct?
Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
DrawMap(e)
End Sub
Private Sub DrawMap(ByVal e As System.Windows.Forms.PaintEventArgs)
End Sub
Am I right in copying that whole 'e as system.windows....' etc line from the form_paint details into my subs details?Just to clarify, the sub will draw directly onto the form.
View 3 Replies
ADVERTISEMENT
Apr 25, 2009
I have declared this function and trying to get the correct coding to call this function correctly.Public Declare Function ColorRGBToHLS Lib"shlwapi. dll" (ByVal clrRGB As Long, pwHue As Long, pwLuminance As Long, pwSaturation As Long) As Long
View 4 Replies
Aug 30, 2011
An exert from my config file looks liek this.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
[Code].....
EDIT: I am able to pass in the string perfectly when using Visual Studio 2005. But when using VS 2003 and a loiwer .net framework it will not let me, unless I hard code it in.
Could something be enabled/disabled on one of these instances of VS? Or could this just be an error with the older versions of .net? I think I am using 1.1??(will have to check) in 2003.
View 2 Replies
Oct 20, 2011
I am making a lunar lander game that randomizes the terrain for each new game, so each game is different. For my game, I am creating a graphics object that draws a closed curve for the terrain of the game. I am trying to then detect if a picture object collides with the graphics object.[code]...
View 1 Replies
Jun 3, 2009
i have drawn on a e.graphics object and now want to transfer the drawn stuff onto a bitmap object how can i do this?
View 2 Replies
Dec 1, 2011
I am working on a application that has quite a few functions involved and have been thinking of the following: If I have a function that has a few paramaters, is it more efficient to pass the objects to the function(Example 1) or reference the objects in the parent(Example 2)? Does it matter if the objects are large or not?
Example:
Class mainform
Public myGenericList As New List(Of String)
Public myDatarowArray() As DataRow
[Code].....
View 6 Replies
Feb 27, 2009
I am trying to copy the contents of one graphics object to another, but the only was I have been able to find is based on using GDI32.DLL, which i would rather avoid using if possible.Does anyone know how/if this is possible using managed code? I don't mind if answers are in C# or VB.Net.
[Code]...
View 1 Replies
Jan 20, 2012
This code copose from Class including tow sub first sub to insert data in DB Ms access- second code: to check if there is same number of Tel if there is not same number will excute the first code insert, if there is same number of Tel it will show messagebox the problem that I faced is by how to pass object(InsertData) from CheckN sub. It showed me error : Expression is not a method
[Code3]...
View 1 Replies
Sep 30, 2009
Is there a way to create an image from a graphics object?
View 3 Replies
May 11, 2009
We would like to know whether there is any way to interrogate a Graphics object and determine whether it is to be used to print or to render to some other canvas. We're aware of an API call that can be used but would prefer to avoid that route if possible. There's also the possibility of simply passing a flag in with the Graphics object that is True from a PrintPage event handler and False from elsewhere, but that's not ideal either. We're looking for a managed property or method accessible via the Graphics class itself, but nothing's jumping out.
View 20 Replies
Feb 20, 2009
I have been trying to draw spirals in vb.net. Here's a link to the formula [URL]. here's what I was trying to do. The code below is just drawing points which I was later going to edit to connect from point to point as soon as i got the spiral function working.
Function Draw()
Dim iImageCenterPointH As Integer = pbOut.Height / 2
Dim iImageCenterPointW As Integer = pbOut.Width / 2
Dim iCircleSpace As Integer = 10
[Code] .....
I am not 100% the output is matching the formula here's what I am getting atm ...
View 7 Replies
Aug 31, 2011
I need serious advice here please. I use Visual Basic Graphics Programming by Rod Stephens as a reference, and I have visited his site vb-helper.com to try some of his tutorials. I tried the scribble application and it's working out fine (you can download the snippet from his site).
What I have trouble with is zooming in. I am not sure where to start. I would like to zoom in to x2, x3 and etc. of the bitmap I am working on and I would like to be able to continue to edit the bitmap. This would mean that I have a larger pixel brush under the mouse cursor, to lay down pixels. So a x2 zoom would mean a 2 x 2 pixel.
Has someone done this. Do you have a reference I can use for this. This kind of editing is standard in almost every paint package. Even Microsoft Paint, but there is not too much basic information on how it fits together in code for vb .net. So I am looking for someone to point me in the right direction. As I said, I am using the scribble application as a base, so here is the link. [URL]..
View 4 Replies
Jan 31, 2012
For example if I have a function call like below
Function callingMe()
Exit Function
And my Function call is like below
SomeObj.callingMe('1','2','3','4','5') // Variable number of arguments
Inside callingMe() function, I want to know arguments passed i.e 1,2,3,4,5 and the Object i.e SomeObj in above case.
View 2 Replies
Apr 5, 2012
I am making a simple maze game that you use the arrows keys to navigate. I completed the movement part of it, but now i'm having trouble with the walls. How can you make an object not pass through another and how to tell the program what to do when a object gets to a defined place(the finish)
View 4 Replies
Sep 10, 2011
I have various shape objects, and I want each unique shape to implement a saveToDB method that simply calls a DB object that implements a Save method with an object as its input paramter. This DB.Save method will be a long case function that implements the proper SQL commands based on the type of attributes possessed by the input parameter object.how do I implement the SaveToDB method in my Shape class? Is it something like this:
Function Shape.SaveToDB
DB.Save(Me)
End Function
The goal here is to let each shape save itself without it knowing anything about database operations; I want to isolate db-specific information in my intermediary DB object, so the DB object will have to figure out what type of object wants to be saved into the SQL database and then execute whatever SQL instructions are needed. And then if I override the SaveToDB method in each shape subclass, I can avoid the case statement entirely, replacing it with a series of unique methods such as db.SaveCircle (ob), db.SaveSquare (ob), etc., sincle the caller already knows what it is.
View 4 Replies
Dec 20, 2011
I'm trying to give a default value to the register property method. This required a function, but passed as an object(delegate?).[code]....
I want to call that registerproperty method, but I don't know how I can do that in VB.net. I just need to pass along a new Person object and I thought this was the way to go[code]....
View 3 Replies
Dec 17, 2010
I have this [code]...
1. Create a global SQL instance and call .Write from within .ReadData
2. Create a new SQL instance within .ReadData and call .Write
3. Pass the data back to the code above and call .Write from the main code i.e. [code]...
View 1 Replies
Jan 6, 2012
We have a few applications that will be passing a token object around and I wanted to get an idea about the best approach at doing this.
For starters, this token object is somewhat simple. It would have about 5 properties or so.
Would we create a WCF app and reference it through a datacontract?What about serializing it and sending it through an http post? (each app have a referenced dll of the object)Querystring? (I truly don't think this would be good, but put it up nonetheless)?
View 2 Replies
Mar 25, 2011
I'm writing a wrapper class to expose a subset of the functionality of a .NET FTP library edtftpne from Enterprise Distributed Technologies.
When you call the edtftp's GetFileInfos method you get an array of FTPFile objects returned. I'm able to iterate through these but I don't know how to pass them on as a new and different object array containing only Name and Size for each file. Here's the code I have. Sorry it's a little confusing because I have my own class named FTPFile and the .NET library I'm using also has a class named FTPFile. I'm using both of them here. I should probably change the name of my class just to avoid confusion:
Public Function GetFileList() As FTPFile() Implements IFTP.GetFileList
Dim ftpfiles() As EnterpriseDT.Net.Ftp.FTPFile
ftpfiles = fCon.GetFileInfos 'Fill object array
[Code]....
I'd just pass on the object array that I'm getting from the GetFileInfos method but COM clients won't have access to the class/object EnterpriseDT.Net.Ftp.FTPFile without me rewriting it, I'm assuming.
View 1 Replies
Jun 6, 2011
I have a scanned document in my system. It's a tiff file. You will see below the code i have written. The problem is that i get an error message. The message is like this "A Graphics object cannot be created from an image that has an indexed pixel format." [Code]
View 3 Replies
Jun 7, 2011
I need to make a basic drawing program in VB that can do three things:
"Draw" with a brush of some sort
Clear the screen
Perform a flood-fill (paintbucket action)
I decided to do the first two tasks first, and got them to work, but the third task completely eludes me. Every way I try seems to pile on exceptions, and every flood-fill algorithm I find seems to require a bitmap, rather than a Graphics() object. Is there any way to accomplish a flood-fill using a Graphics object, or must I restart the project using a bitmap?
Source code for reference:
CODE:
View 2 Replies
Feb 26, 2012
In VB.NET, I need to create an Image based on a Graphics object I have. However, there is no method such as Image.fromGraphics() etc. What should I do then?
View 2 Replies
Sep 27, 2010
This is another question about my galaga like game. I want the enemies to move to a random spot one pixel away at each tick of a timer. How would I go about doing this?
View 6 Replies
May 7, 2012
I currently have a graphics object g where I am drawing lines and ellipses on with the command
g.DrawEllipse(definedPen, Fc, Fr, Tc, Tr)
g.DrawLine(definedPen, Fc, Fr, Tc, Tr)
This works fine. However what I can�t find out how to do is place text onto the graphics object at a specified row & column.
View 5 Replies
Feb 14, 2012
Pretty self-explanatory question. I'm trying to see if I can do sprite animation in Visual Basic and, while I can use a Graphics object to translate a bitmap down a few pixels, I have absolutely no idea how to erase the bitmap drawn in its former position. Is there any way to erase the old image before the new image is drawn onto the form?
View 14 Replies
Jul 24, 2009
I want to wrap up a chunk of HTML render logic in a User Control. Then I want to pass a custom product object (title, thumbnail, id, etc.) to the UserControl that it can use when it renders. Ideally I want to use this in a repeater (or for loop) and pass the current custom product object into the UC.Every example I've seen has been passing through strings on the UC tag but thats not really want I want to do as it means I'll have references everywhere that need updating should we add a new field that needs rendering.
.Net 1 using VB.net (not my first choice for .net so go easy)HTML example to get us going, this would be in the .ascx page:
<div>
<h3><%= myProd.title %></h3>
<img src="<%= myProd.thumbnail %>" />
<p>
[code]....
Yet in my ascs page I get:"Object reference not set to an instance of an object"
Line 1: <%@ Control Language="vb" AutoEventWireup="false" Codebehind="ProductRender.ascx.vb" Inherits="MyApp.ProductRender" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Line 2: <h3>
Line 3: <%= myProd.title %>
Line 4: </h3>
View 2 Replies
Apr 21, 2012
I have a method called ADD in a class that connects to a database. The database class name is XDB. I also have an object named XXX in it's own separate class with properties.One of the instructions for the Button named ADD click event is:
'Call Add method passing in the XXX object
So this is how I coded:
'declare a variable X as an object instance of XXX
Dim X As New XXX[code].....
I know it's wrong since it doesn't add the XXX and the form doesn't close but I don't know what I'm doing wrong.
View 6 Replies
Jul 6, 2009
I have a statement that will call a Sub.
Charts(CurChartNo) = Server.CreateObject("ChartFX.WebServer")
Call InitChart()
Inside this sub, I will assign values to the properties of the Charts object that is
Public Sub InitChart()
Charts(CurChartNo).RGB2Dbk = &HC0FFFF&
Charts(CurChartNo).Chart3D = False
[code]....
But the Charts is not recognized in the Sub. This is current program under ASP, I am converting to ASP.Net.
View 3 Replies
Mar 28, 2011
How can I do this:
Dim oMyObject As New MyObject
oMyObject.DoSomething("Parameter1","Parameter2")
The "DoSomething" and the two parameters are dynamically provided from another script. They are stored in a string object in this script: sAction & sParameters. My question is how can I dynamically pass the "sAction" to the object oMyObject.For example oMyObject.sAction (where sAction should be the value stored in the sAction string). The example will probably not work. Is there a way to do this? The idea behind is to avoid having to write each function hardcoded, like:
If sAction = "DoSomething" then
oMyObject.DoSomething(sParameters)
ElseIf sAction = "AnotherThing" then
[code]....
View 5 Replies
Feb 12, 2011
I 'm new to programming and to vb. So my question could be from misconception about what can i do. How can i pass a string to a "procedure" and get in return a object whith the same name as the string?
View 8 Replies