Delphi and DirectX Delphix (5): First Knowledge tdximagelist

Source: Internet
Author: User

After the new project, add separately on the form: DXDRAW1, DXImageList1;

You can then display the DELPHIX.DXG image in DXDraw1 with only four lines of code below:

procedure TForm1.Button1Click(Sender: TObject);
begin
 DXImageList1.Items.LoadFromFile('C:\Temp\DelphiX.dxg');
 DXImageList1.DXDraw := DXDraw1;
 DXImageList1.Items[0].Draw(DXDraw1.Surface, 10, 10, 0);
 DXDraw1.Flip;
end;

If you do not have dxg format image, download this example use of the image bar (download and extract to C:\Temp\):

Http://files.cnblogs.com/del/DelphiX_img.rar

DXImageList1 is a list of images that would have been easy to add with LoadFromFile, but now this command is very difficult to use;

But it doesn't matter, there are other ways to create an image list:

1. Double-click the DXImageList1 icon at design time ... This method is also bad, currently only support DXG and part of BMP (Dib I did not try);

2. Double-click its Items property from DXImageList1 ... This method is good and supports a variety of formats;

3, Tdximagelist is still VCL control, it can interact with other VCL; As long as the other controls can load the picture it can be used.

The following example is a second way to add two pictures, run the effect of the chart:

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.