Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > Re: Cell Select...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3303 of 3321
Post > Topic >>

Re: Cell Select in a ListBox

by Anic297 <here@[EMAIL PROTECTED] > Feb 28, 2008 at 05:41 PM

fontoholic a écrit:
> Hi
> 
> Can anyone tell me how I can highlight a single cell when the user
clicks on 
> it? I have tried lots of methods but they all seem to highlight the
complete 
> row. The closest I have come is to use CellClick to get the row and
column 
> index, then pass that onto CellBackgroundPaint.

Here's an example (you were almost right):
In the cellbackground paint event

   if column=MyStoredColumn then Return False 'Allow the OS to do 
standard highlight for the selected column

   //For other columns, empty the row:
   g.ForeColor=RGB(255,255,255)
   g.FillRect 0,0,g.Width,g.Height

   return true 'Prevent the os to highlight the cell

In the CellTextPaint event:

   g.ForeColor=RGB(0,0,0) 'g keeps the colour given in the 
CellBackgroundPaint event, so we set it to black
   g.DrawString me.Cell(row,column),x,y 'and we draw the content of the
cell
   Return True

HTH
 




 3 Posts in Topic:
Cell Select in a ListBox
"fontoholic" &l  2008-02-28 13:47:55 
Re: Cell Select in a ListBox
Anic297 <here@[EMAIL P  2008-02-28 17:41:56 
Re: Cell Select in a ListBox
"fontoholic" &l  2008-02-29 13:56:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 22:41:11 CDT 2008.