Print Page | Close Window

TIP: XAML Markup & Labels

Printed From: Codejock Forums
Category: General
Forum Name: XAML Snippets
Forum Description: Post your XAML snippets here for everyone to enjoy :)
URL: http://forum.codejock.com/forum_posts.asp?TID=10582
Printed Date: 24 November 2024 at 6:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TIP: XAML Markup & Labels
Posted By: jpbro
Subject: TIP: XAML Markup & Labels
Date Posted: 10 May 2008 at 6:56pm
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:

  1. Create the markup in the MarkupPad and then save the file to <something>.xaml
  2. Start VB6, and make sure the VB6 Resource Editor add-in is loaded in the Add-ins menu > Add-in Manager
  3. If your project doesn't already have a resource file associated with it, click the Project menu, and then click Add New Resource File.
  4. Save the new resource file (for example, xaml.res).
  5. In the Project Explorer window, under "Related Documents", double-click your resource file to open the Resource Editor.
  6. In the resource editor toolbar, click the "Add Custom Resource" icon.
  7. 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.
  8. Click the Save icon to save the resource file (important step!)
  9. 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net