Using markup with the CJ label control is a great way to get rich presentation for your apps, but the XAML strings can get a bit unwieldy (due to their length and internal quotation marks in particular). Here's my solution:
- Create the markup in the MarkupPad and then save the file to <something>.xaml
- Start VB6, and make sure the VB6 Resource Editor add-in is loaded in the Add-ins menu > Add-in Manager
- If your project doesn't already have a resource file associated with it, click the Project menu, and then click Add New Resource File.
- Save the new resource file (for example, xaml.res).
- In the Project Explorer window, under "Related Documents", double-click your resource file to open the Resource Editor.
- In the resource editor toolbar, click the "Add Custom Resource" icon.
- Navigate to the file you saved from the MarkupPad and select it. For the purpose of this example, we'll assume it is resource #101.
- Click the Save icon to save the resource file (important step!)
- Close the Resource Editor.
The markup is now available for use in your application. To load the resource into a CJ label:
Me.Label1.Caption = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)
|
The StrConv call is required because the LoadResData function returns the bytes exactly as they are stored in the file (non-unicode), but VB6 requires unicode strings.
Anyway, this might be an obvious route to most of you, but I thought it could be helpful to others. Perhaps you've found a better solution that you can post here?
------------- Product: Xtreme SuitePro (ActiveX) version 16.2.6 Platform: Windows XP - SP3
Language: Visual Basic 6.0 SP6
|