Beautify custom data tables on Windows Mobile

Source: Internet
Author: User


Some time ago, as a lab project, data needs to be presented to users in the form of reports. The first thing I think of is the built-in listview of Visual Studio, which is more convenient to use, but it is not beautiful. To put it bluntly, it is not attractive enough. So I thought of using alphablend to create a table with a translucent effect. Because in February this year, Alex yakhnin made 《24 hours of Windows Mobile Application Development: Creating compelling and attractive UIS for Windows Mobile applications"Webcast, I was deeply impressed, I think that for the UI part, the use of alpha blend is quite large.

There are two ways to make images transparent. First, use the imageattributes under the system. Drawing. Imaging namespace in. Net cf.Setcolorkey(Color, color. Second, we can use the platform call for alpha blending. Some principles of alpha blending are described in 《Alpha blending and alpha channel on Windows MobileThis post provides some instructions, so I will not repeat them here.

In addition, we can use the gradient effect of color to gradually transition from one color to another. Similarly, this can also be applied to the Windows Mobile Interface Design. 《How to: display a gradient fillThis articleArticleIt describes how to implement gradient filling in. NET Framework.

So how can we apply the above alpha blending and gradientfill to our own project? First, encapsulate the alphablend, bitblt, and gradientfill functions of Win32 for platforminvoke. Then, extend these methods to make it easier to call and increase the readability of users. Alex yakhnin has helped us with these jobs. We"This link is downloadedSource code. After decompression, the five files in the platformapi folder are what we need, as shown in 1:

Figure 1: Related P/invoke files

Headercontrol is added to highlight the data of the header and the row where the selected text is located. CS and customselectioncolumn. CS files are mainly used to reload the paint, onpaint, onmousedown, and onmouseup functions, and call the alphablending and gradient fill functions encapsulated by platformapi to achieve the expected transparency and gradient effect.

In our own project, we can declare a DataGrid and headercontrol.


After the control is initialized, create a dataset and add a datatable to the dataset. Then, we can set the gradient style of each row in the able, that is, use the lineargradient (color, color) function to set customcolumn. selectedgradient to customize the gradient color of each row.

At the same time, to highlight the header, we can also set the gradient style of the header separately, that is, we can use lineargradient (color, color) to set headercontrol. backroundgradient.

In use, we will find that the color of the row selected by the user is different from that of other rows. This is because, in customselectioncolumn. in the paint overload function of the CS file, the rows selected by the user and other rows are classified.

The final display effect of this table is shown in 2:

Figure 2:

In addition to highlighted colors such as red, white, and blue, RGB colors are hard to remember. Here we recommend a webpage:Rgb.txt decoded. 3 provides some information.

Figure 3: RGB values and their color effects

I hope this method will be useful for you to do the UI on Windows Mobile.


Reference link:

1.24 hours of Windows Mobile Application Development: Creating compelling and attractive UIS for Windows Mobile applications

2.Alpha blending and alpha channel on Windows Mobile

3.How to: display a gradient fill

4.Rgb.txt decoded

Related Article

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: 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.