-------------------------------------------------------------------------------
Sample Name: ID Card Maker

Description: This application allows you to create, save, and print ID cards. 
             You can select fonts, background, shadow color and width, and so 
             forth. A good demo for VB Migration Partner’s graphic capabilities. 

Download URL: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=68721&lngWId=1

-------------------------------------------------------------------------------

IMPORTANT NOTE
The first step to ensure that you can migrate the VB6 project to VB.NET is 
loading the original project in the Visual Basic 6 IDE, run it to ensure that 
it works fine, that all the required type libraries are installed, and that all 
file paths are correct. 
Regardless of whether you edited the source code in any way, you should save 
the VB6 project: this save operation ensures that the .vbp file includes  
the correct path and version of referenced type libraries. 
After saving the project, it's usually a good idea to compile the VB6 project
to an executable, to detect any VB6 compilation errors that would appear under 
VB.NET as well. 
(If you don't recompile the project VB Migration Partner will display a warning 
when you later load the project.)


This sample uses a splash screen. The cleanest way to implement it in VB2005 is 
by adding the following project-level pragma at the top of any source file, 
for example Form1.frm

	'## EnableAppFramework frmshowfnt, Splash, true

At the top of the Form1.frm file you can find the LOGFONT structure, which is 
used to create a Windows font. You need a UseSystemString pragma to ensure that 
its members are marshaled correctly when calling Windows API methods:

	Private Type LOGFONT
	    '## UseSystemString
	    '...
	End Type


A couple of event handles in Form1 appear to be useless, because they are 
related to controls that don't exist on the form. Worse, these methods 
reference a few controls that don't exist and therefore would cause several 
compilation errors in VB.NET (and in VB6 as well, if you attempt to compile 
with the File-Make EXE command). You can get rid of these methods by deleting 
them in the original code or, better, by bracketing them between two 
ParseMode pragmas:

	'## ParseMode Off
	Private Sub Combo1_Click()
	   ...
	End Sub
	'## ParseMode On

	'## ParseMode Off
	Private Sub Text5_Change()
	   ...
	End Sub
	'## ParseMode On

The original VB6 code uses the Form_Initialize event to initialize controls, 
which is a bad programming practice and causes a NullReference exception in 
VB.NET (because these controls haven't been created yet when the VB.NET event 
fires). The code in this event handler should be moved to the Form_Load event 
handler instead. The simpler way to do it is by means of a ParseReplace pragma:

	'## ParseReplace Private Sub Form_Load()
	Private Sub Form_Initialize()

The mnunieww_Click method invokes the Form_Initalize method, which doesn't 
exist any longer, thus you need another ParseReplace pragma

	Private Sub mnunieuw_Click()
	    '## ParseReplace Form_Load
	    Form_Initialize

The Command3_Click event incorrectly assigns two numbers to the Image1 control, 
whereas it is clear that the intention is to change the Image1's size. You can 
fix this problem with two ParseReplace pragmas:

    '## ParseReplace If Image1.Width > 1022 * 15 Then Image1.Width = 1022 * 15
    If Image1.Width > 1022 * 15 Then Image1 = 1022 * 15
    '## ParseReplace If Image1.Height > 639 * 15 Then Image1.height = 639 * 15
    If Image1.Height > 639 * 15 Then Image1 = 639 * 15

The first argument of the RotateText method is defined as an object. This late-bound 
parameter prevents VB Migration Partner from correctly resolve color assignments, thus 
we need an AssumeType pragma to let it know that the parameter is actually a control:

	Function RotateText(inObj As Object, inText As String, inFontName As String, _
	        inBold As Boolean, inItalic As Boolean, inFontSize As Integer, _
	        inAngle As Long, inStyle As Integer, _
	        firstClr As Long, secondClr As Long, mainClr As Long, _
	        X As Single, Y As Single, _
	        Optional inDepth As Integer = 1) As Boolean
	    '## inObj.AssumeType TextBox

Additionally, the RotateText method uses the hDC property of the control passed in the 
first parameter, therefore it is necessary to add a statement that releases the device 
context. You can do it by means of two InsertStatement pragmas, near the end of the method:

	    RotateText = True
	    '## InsertStatement inObj.ReleaseHdc()
	    Exit Function
	errHandler:
	    '## InsertStatement inObj.ReleaseHdc()
	    inObj.ScaleMode = origMode

Besides, if you want you can use a pragma for changing the passing mode for some method's 
parameters. In VB6 parameters are implicit passed by reference to a method if neither ByVal
nor ByRef keyword is specified. 
It is unuseful passing parameters ByRef if the code in the method doesn't modify them and 
this affects performance too.

'## project:UseByVal