(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
Go Back  Xtreme Visual Basic Talk > > > (6.0 to .Net) Porting Problems


Reply
 
Thread Tools Display Modes
  #1  
Old 10-21-2005, 07:47 PM
Ghost2's Avatar
Ghost2 Ghost2 is offline
Centurion
 
Join Date: Jan 2004
Posts: 187
Default (6.0 to .Net) Porting Problems


I have a program I wrote in VB6, and I'm trying to convert it to .Net. The convert tool did a fairly decent job, but there are a few holes I've yet to resolve. First of all, I need a way to clear the contents of a PictureBox control. Before, I just used the PictureBox.Cls() method, but apparently microsoft thought this was too easy. I tried finding an equivalent function on MSDN, but to no avail.

The next one is a biggie. I need to efficiently draw polygons and points onto the afformentioned PictureBox. Before, I used the SetPixelV and Polygon Api functions; unfortunately, they both require that the window handle (.hdc) be passed as a 32 bit integer (used to be Long). Now, window handles use an incompatible type/structure (IntPtr). Is there a way to trick it into working, a .net equivalent function, or is this another one of those things that just can't be done anymore? Pictureboxes also had FillColor properties that were integral in the proper functioning of the Polygon function. Now, it is nowhere to be seen.

The final problem (for now) is that of importing ActiveX controls (now called COM objects). I can get it to load them (Project > Add Reference... > Com), but I see no way of adding them to the form (in the old days it would appear in the toolbox). Thanks.
__________________
Play Asteroids- With a Physics System! PhysAsteroids is an opensource project at URL=http://www.ghost2.cafe150.com][/URL]
Reply With Quote
  #2  
Old 10-21-2005, 08:44 PM
Max-Eclipse Max-Eclipse is offline
Newcomer
 
Join Date: Oct 2005
Location: Afton, OK, USA
Posts: 8
Default

Quote:
Originally Posted by Ghost2
I have a program I wrote in VB6, and I'm trying to convert it to .Net. The convert tool did a fairly decent job, but there are a few holes I've yet to resolve. First of all, I need a way to clear the contents of a PictureBox control. Before, I just used the PictureBox.Cls() method, but apparently microsoft thought this was too easy. I tried finding an equivalent function on MSDN, but to no avail.
It depends on how you are drawing. If you are drawing to an image/bitmap object, and setting PicBox.Image = MyImage, then all you have to do is PicBox.Image = Nothing. I doubt you are doing that though. I assume from what you have said, that you are drawing directly to the picturebox with a graphics object. If so, there is a G.Clear or something along those lines you can use.

EDIT: I opened VS and tried it. Graphics.Clear(Color) will clear the drawing surface, and fill it with the color of your choice. It is optional to pass in a color.


Quote:
Originally Posted by Ghost2
The next one is a biggie. I need to efficiently draw polygons and points onto the afformentioned PictureBox. Before, I used the SetPixelV and Polygon Api functions; unfortunately, they both require that the window handle (.hdc) be passed as a 32 bit integer (used to be Long). Now, window handles use an incompatible type/structure (IntPtr). Is there a way to trick it into working, a .net equivalent function, or is this another one of those things that just can't be done anymore? Pictureboxes also had FillColor properties that were integral in the proper functioning of the Polygon function. Now, it is nowhere to be seen.
You can use a region and an array of points to specify the region for the polygon, then fill that region using your graphics object.

EDIT: What do you mean by FillColor property? What did it do? I am one of the lucky young ones that never had to use legacy vb.

EDIT: I just realized that there is a FillPolygon(Brush, Points()) method you can use in the graphics object. This will make it a little easier.


Quote:
Originally Posted by Ghost2
The final problem (for now) is that of importing ActiveX controls (now called COM objects). I can get it to load them (Project > Add Reference... > Com), but I see no way of adding them to the form (in the old days it would appear in the toolbox).
I wouldn't use COM objects unless you absolutely HAVE to. If you do have to, add them to your toolbox. Right click in the group in the toolbox that you want them to be added to, and click on 'Add/Remove Items' or 'Choose Items' or something along those lines, then select COM tab, and select out of the list (or browse to the file) and then click ok, and they will be added to the toolbox.


Quote:
Originally Posted by Ghost2
Thanks.
You're welcome.

Last edited by Max-Eclipse; 10-21-2005 at 08:51 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems (6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
 
(6.0 to .Net) Porting Problems
(6.0 to .Net) Porting Problems
 
-->