473,378 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

convert the vb6 code below into vb.net code

5
Hi I am trying to convert the vb6 code below into vb.net code can anyboddy help
The vb6 code is from a chip8 Emulator that somboddy wrote.

vb6 code
this function keeps getting called until the image is drawn.
Sub drawscreen()
If Picture1.Point(1 + x + (i * 4), y + (j * 4)) = RGB(0, 255, 0) Then
v(&HF) = 1
Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(0, 0, 0), BF
Else

Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(0, 255, 0), BF
End If
End Sub

many thanks Karl
Apr 24 '07 #1
6 1946
RedSon
5,000 Expert 4TB
Use a Good Thread Title
Using a good, clear thread title is important. The reasons for this are:

* We want this site to grow, many of our new members find the site using a search engine, by using a good thread title you will help us grow the site by helping us get better search engine rankings.
* Using a good title will benefit you too because other members of the forum will be less likely to skip over your thread and it allows the experts to quickly scan through the forum for questions they know the answer to.
* If the threads are well titled it allows other users to easily see if there have been any threads that could be relevant to their own current problem.
* It is in everybody's best interests to post properly titled threads as the more time the moderators have to spend on managing titles the less time they have available to give answers to the questions posed.

Thanks
Apr 24 '07 #2
RedSon
5,000 Expert 4TB
Does Microsoft not provide any filters to go from VB6 to VB.NET?
Apr 24 '07 #3
TRScheel
638 Expert 512MB
Does Microsoft not provide any filters to go from VB6 to VB.NET?
Some code can be changed from VB6 to VB.Net through their converters, this looks like a piece of code that would not be able to
Apr 24 '07 #4
TRScheel
638 Expert 512MB
Hi I am trying to convert the vb6 code below into vb.net code can anyboddy help
The vb6 code is from a chip8 Emulator that somboddy wrote.

vb6 code
this function keeps getting called until the image is drawn.
Sub drawscreen()
If Picture1.Point(1 + x + (i * 4), y + (j * 4)) = RGB(0, 255, 0) Then
v(&HF) = 1
Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(0, 0, 0), BF
Else

Picture1.Line (1 + x + (i * 4), y + (j * 4))-(1 + x + (i * 4) + 3, y + (j * 4) + 3), RGB(0, 255, 0), BF
End If
End Sub

many thanks Karl
PictureBox's in .NET now do not have the capability to draw. What you are looking for is System.Drawing.Pen. As far as finding the pictures color at that pixel, I believe you would have to use the System.IO and probably load the picture into memory.

Or... use the bitmap object and load it into that (if thats an option). Then you could use Bitmap.GetPixel(x, y) and it returns its color.
Apr 24 '07 #5
vbdog
5
PictureBox's in .NET now do not have the capability to draw. What you are looking for is System.Drawing.Pen. As far as finding the pictures color at that pixel, I believe you would have to use the System.IO and probably load the picture into memory.

Or... use the bitmap object and load it into that (if thats an option). Then you could use Bitmap.GetPixel(x, y) and it returns its color.
Thanks I will have a go at that
Apr 26 '07 #6
TRScheel
638 Expert 512MB
Thanks I will have a go at that

You asked me over PM to provide code about how to get the pixel color of the bitmap, here is an example (and sorry it took so long).

replace bmp.bmp with the string of the location where your bitmap is, and please note that this is a console app and pay attention to how it presents the data. Bitmap.GetPixel returns a color object, so you can get the A R G or B value of the image, or get it in another form.

Expand|Select|Wrap|Line Numbers
  1.             System.Drawing.Bitmap myBitmap = new System.Drawing.Bitmap("bmp.bmp");
  2.  
  3.             for (int i = 0; i < myBitmap.Height; i++)
  4.             {
  5.                 for (int j = 0; j < myBitmap.Width; j++)
  6.                 {
  7.                     Console.WriteLine(myBitmap.GetPixel(i, j).ToString());
  8.                 }
  9.             }
  10.  
  11.             Console.ReadKey(true);
May 10 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Rodusa | last post by:
I am having problem to apply updates into this function below. I tried using cursor for updates, etc. but no success. Sql server keeps telling me that I cannot execute insert or update from inside...
2
by: Brian Basquille | last post by:
Hello all, Is there any way to convert, what i think is, source code in C into C#? Can't find any resources online for doing it anyways.. just C# to VB.net and vice-versa. The problem with...
0
by: NoSpamForMe | last post by:
I am currently a java programmer, with some knowledge of the C# language but very little knowledge about ASP.NET, and I am know wondering if someone can *translate* the java servlet code below to...
7
by: Alan Silver | last post by:
Hello, I have installed the 2.0 framework, and am looking at converting some of my 1.1 pages to use partial classes. I don't (yet) have VS2005, so I'm doing this by hand, but am having problems....
6
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
20
by: Niyazi | last post by:
Hi all, I have a integer number from 1 to 37000. And I want to create a report in excel that shows in 4 alphanumeric length. Example: I can write the cutomerID from 1 to 9999 as: 1 ---->...
5
by: sjsn | last post by:
Basic C++, just started this course in school... So I'm very limited. What I'm at doing is, below I have a variable named inputTemp, which is the product of a char, F = Fahrenheit, C = Celsius...
2
by: slizorn | last post by:
error is as stated in the topic above: error C2440: '=' : cannot convert from 'char *' to 'char' code is below void handleOneLine(string string1) { char * cstr, *p; int counter; string...
9
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.