How do I make a black selected color change to another color when the mouse clicks on the item cell? Original

Source: Internet
Author: User
Tags modify variables string
Cell | select | original
How do I make a black selected color change to another color when the mouse clicks on the item cell?

Problem Description:

How do I make a black selected color change to another color when the mouse clicks the item cell (TAB order 0)?

Solution:

1, first the DW properties in the column moving and mouse selection two items are deselected;

2. Write code in the clicked event in DW:

The relevant variables used in the declaration are stated here;

Long Ll_curcol,ll_pos,ll_cols

String Ls_modstring,ls_colname,ls_color_1,ls_color_2,ls_curcol



If row = 0 then return



Here are two color variables assigned to the value;

ls_color_1 = string (RGB (255,255,255))

ls_color_2 = string (15780518)//Here Set the selected cell to Sky sky blue



Gets the current column number and the total number of columns here;

Ll_curcol=dw_1.getcolumn ()

Ls_curcol = Left (Dw_1.getobjectatpointer (), POS (Dw_1.getobjectatpointer (), "~t")-1)

Ll_cols = Long (Dw_1.Object.DataWindow.Column.Count)



This sets the background mode property of all columns to opaque; (Note: The following two sentences can actually be executed in the form's Open event or in the constructor of the DW to improve efficiency;)

Dw_1.setredraw (False)

For ll_pos = 1 to Ll_cols

Ls_colname = Dw_1.describe ("#" +string (Ll_pos) + ". Name ")

Dw_1.modify (ls_colname+). Background.mode= ' 0 ' ")

Next



The Background.color property of the Action column is set here as an expression with an if judgment, while the background expressions for the columns in addition are set to constant values;

For ll_pos = 1 to Ll_cols

Ls_colname = Dw_1.describe ("#" +string (Ll_pos) + ". Name ")

If ll_pos<> Ll_curcol Then

If Ls_colname <> Ls_curcol Then

ls_modstring = ls_colname+ ". Background.color= ' "+ls_color_1+" "

Else

ls_modstring = ls_colname+ ". Background.color= ' "+ls_color_1+" ~t if (GetRow () =currentrow (), "+ls_color_2+", "+ls_color_1+") ' "

End If

Background color modification is performed here;

Dw_1.modify (ls_modstring)

Next



Refresh Displays the new background color;

Dw_1.setredraw (True)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.