473,670 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert the vb6 code below into vb.net code

5 New Member
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 1955
RedSon
5,000 Recognized Expert Expert
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 Recognized Expert Expert
Does Microsoft not provide any filters to go from VB6 to VB.NET?
Apr 24 '07 #3
TRScheel
638 Recognized Expert Contributor
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 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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
9260
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 a function and it gives me an option that I could write an extended stored procedure, but I don't have a clue of how to do it. To quickly fix the problem the only solution left in my case is to convert this recursive function into one recursive...
2
2129
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 the source code i have is it's quite difficult to understand as they use some built in functions, such as DotProd and Normal, which i reckon are in C# but not with the same parameter supplies as below.
0
2405
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 ASP.NET/C# ? Please note that I am not asking about the best possible way of doing the same thing with ASP.NET architecture with those "code behind" things I have heard a little about... but what I am asking for is a *translation* (other...
7
1745
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. I have a simple page that I made in the beta2 version of VWD. The code behind looks like... using System;
6
1407
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 declaration statments (first lines) e.g. Public Function ConvertCurrencyToEnglish(ByVal MyNumber As Double) As String Private Function ConvertHundreds(ByVal MyNumber As String) As String etc.
20
3431
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 ----> 0001 2 ----> 0002
5
6023
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 and K = Kelvin... I want to be specific when asking the user for more information, such as degrees. So when I ask for degrees in F... it wont sound so kinda funny. I know I can write "Enter unit of temp that you want converted using (F)ahrenheit,...
2
20444
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 str (string1);
9
35808
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 listbox. Right now it is done like this:
0
10753
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 inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8384
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8810
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8590
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6211
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4387
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2798
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2035
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.