OberonPlace.com Forums  

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

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

Hi
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
  #2  
Old 07-07-2011, 18:09
maroq
Guest
 
Posts: n/a
Default

I don't think so but you may use this code:
Code:
Private Sub UserForm_Click()
    Dim intIndex As Integer
    With ListBox1
        .Clear
        .AddItem Space(4) & "Samp1"
        .AddItem Space(4) & "Samp2"
        .AddItem Space(4) & "Samp3"
        .AddItem Space(4) & "Samp4"
    End With
    Randomize
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
  #3  
Old 08-07-2011, 03:19
shark shark is offline
Senior Member
 
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146
Default

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


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 14:43
How can i .additem in listbox? Kursad CorelDRAW/Corel DESIGNER VBA 1 16-07-2009 02:08
Listbox Control with images ? hschneider CorelDRAW/Corel DESIGNER VBA 4 18-03-2008 06:28
ListBox with ColumnHeads fadimas CorelDRAW/Corel DESIGNER VBA 0 20-03-2007 03:43
shape-names in listbox Seelenquell Code Critique 5 14-02-2006 12:12


All times are GMT -5. The time now is 17:29.


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