Using Delphi to write multi-screen programs

Source: Internet
Author: User

Not now. Some POS machines are dual-screen (such as Casiva POS machine), a screen can be used when the customer display, when idle can also display some ads. In fact, using Delphi to write a dual-screen program is relatively simple, screen.monitorcount is the current number of system screen, Tform also have screen-related properties, such as Defalumonitor, But I want to set a form to show on which screen it looks like there is no property (I may not have found it), but the study VCL code found how to display a form on a screen (see Tcustomform's Setwindowtomonitor method) and extract it to encapsulate it as a function:

Form: Target form Monitorindex: Shows on which screen 0 is the current screen, 1 is the 2nd screen ....

Procedure Setformmonitor (form:tcustomform; Monitorindex:integer);
Begin
if (monitorindex>-1) and (Monitorindex<screen.monitorcount) then//ensure that the screen index is within range
Begin
Form.setbounds (Screen.monitors[monitorindex]. Left + ((Screen.monitors[monitorindex]. Width-form.width) Div 2),
Screen.monitors[monitorindex]. Top + ((screen.monitors[monitorindex). Height-form.height) Div 2),
Form.width, Form.height);
End
End

After that, you want to show which form is on which screen to tune the function.

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.