OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Thread Tools Search this Thread Display Modes
Old 18-05-2011, 09:15
shark shark is offline
Senior Member
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default ListBox in color

Please advice...
My macro have a ListBox on the form. ListBox contains 3 columns and 10 rows.
3*10 = 30 cells
Is it possible to display the data in some cells in a different color? (Red or blue)
Reply With Quote
Old 07-07-2011, 19:09
Posts: n/a

I don't think so but you may use this code:
Private Sub UserForm_Click()
    Dim intIndex As Integer
    With ListBox1
        .AddItem Space(4) & "Samp1"
        .AddItem Space(4) & "Samp2"
        .AddItem Space(4) & "Samp3"
        .AddItem Space(4) & "Samp4"
    End With
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Dim intIndex As Integer
    intIndex = ListBox1.ListIndex
    ListBox1.List(intIndex) = "• " & Trim(ListBox1.List(intIndex))
End Sub
Private Sub Listbox1_Click()
    Dim intIndex As Integer
    Dim r, g, b As Integer
    r = Rand(0, 255)
    g = Rand(0, 255)
    b = Rand(0, 255)
    ListBox1.ForeColor = RGB(r, g, b)
End Sub

Public Function Rand(ByVal Low As Long, ByVal High As Long) As Long
  Rand = Int((High - Low + 1) * Rnd) + Low
End Function
You will need userform and ListBox.
This code will change color of all fonts written inside listbox.
Maybe in X5 in VSTA you will be able to do more. To use different colors inside listbox you will need different item then normal listbox or maybe Visual Studio 6.
Reply With Quote
Old 08-07-2011, 04:19
shark shark is offline
Senior Member
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146

Thank you very much, it greatly aided me.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox table shark Macros/Add-ons 3 10-12-2010 15:43
How can i .additem in listbox? Kursad CorelDRAW/Corel DESIGNER VBA 1 16-07-2009 03:08
Listbox Control with images ? hschneider CorelDRAW/Corel DESIGNER VBA 4 18-03-2008 07:28
ListBox with ColumnHeads fadimas CorelDRAW/Corel DESIGNER VBA 0 20-03-2007 04:43
shape-names in listbox Seelenquell Code Critique 5 14-02-2006 13:12

All times are GMT -5. The time now is 18:08.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com