2024年4月5日发(作者:)

看到《如何在DW中设置自动列宽》,从我的类库中扣了一段代码回复了,后来又从

旧硬盘中找到原来老外写的对象,上传给大家吧

$PBExportHeader$n_

$PBExportComments$Performs autowidth on grid datawindow columns

forward

global type n_dwautowidth from nonvisualo b j e c t

end type

end forward

type os_size from structure

long cx

long cy

end type

global type n_dwautowidth from nonvisualo b j e c t autoinstantiate

end type

type prototypes

Function ulong GetDC(ulong hWnd) Library ""

Function ulong SelectObject(ulong hdc, ulong hWnd) Library ""

Function boolean GetTextExtentPoint32A(ulong hdcr, string lpString,

nCount, ref os_size size) Library ""

Function long ReleaseDC(ulong hWnd, ulong hdcr) Library ""

end prototypes

type variables

Constant Integer WM_GETFONT = 49

Window iw_parent

Datawindow idw_data

Integer ii_original[]

end variables

forward prototypes

long