RTF Control with inline shortcut menu

The code below shows how to implement a shortcut menu in RTF control when user types '#' character into control. It uses code from Windows API support class and Pixels and Foxels.

Pixels and Foxels

Foxel is a Visual FoxPro term that corresponds to the maximum height and average width of a character in the current font. The row height corresponds to the maximum height of a letter in the current font; the column width corresponds to the average width of a letter in the current font.

Determine Printer Margins Programmatically

The GetDeviceCaps function can be used to retrieve printer-specific information as demonstrated below.

This is sample code. Add error handling and adjust to your requirements as necessary.

#DEFINE LOGPIXELSX    88    && Logical pixels/inch in X         
#DEFINE LOGPIXELSY    90    && Logical pixels/inch in Y         
#DEFINE PHYSICALWIDTH   110 && Physical Width in device units   
#DEFINE PHYSICALHEIGHT  111 && Physical Height in device units  
#DEFINE PHYSICALOFFSETX 112 && Physical Printable Area x margin 
Syndicate content