ACC2000: Lm th? no ? chuy?n ?i Twips ? pixel

D?ch tiu ? D?ch tiu ?
ID c?a bi: 210590 - Xem s?n ph?m m bi ny p d?ng vo.
Nng cao: ?i h?i chuyn gia m? ha, kh? nng tng tc, v multiuser k? nng.

Bi vi?t ny p d?ng cho m?t c s? d? li?u Microsoft Access (.mdb) v v?i m?t d? n truy c?p Microsoft (.adp).

Bung t?t c? | Thu g?n t?t c?

TM T?T

B?i v? Microsoft Access lu tr? thu?c tnh chi?u h?ng/?a i?m nh twips, trong tr?ng h?p nh?t ?nh b?n c th? ph?i chuy?n ?i twips ? pixel, ch?ng h?n nh khi b?n g?i hm Windows API. Bi vi?t ny cho th?y b?n lm th? no ? lm i?u ny.

Microsoft cung c?p l?p tr?nh v d? ? minh ho? ch?, khng c b?o hnh ho?c th? hi?n hay ng? ?. i?u ny bao g?m, nhng khng gi?i h?n, b?o ?m ng? ? kh? nng bn hng ho?c cho m?t m?c ch c? th?. Bi vi?t ny gi? ?nh r?ng b?n ? quen thu?c v?i ngn ng? l?p tr?nh m ang ?c ch?ng minh v v?i nh?ng cng c? ?c s? d?ng ? t?o ra v g? l?i th? t?c. Microsoft h? tr? cc k? s c th? gip gi?i thch cc ch?c nng c?a m?t th? t?c c? th?, nhng h? s? khng s?a ?i cc v d? ? cung c?p thm ch?c nng ho?c xy d?ng quy tr?nh ? p ?ng cc yu c?u c? th? c?a b?n.

THNG TIN THM

B?n c th? s? d?ng ch?c nng ConvertTwipsToPixels() sau y ? chuy?n ?i twips ? i?m ?nh. Lu ? r?ng pixel khng lun lun vung (chi?u cao v Chi?u r?ng l khng gi?ng); V? v?y, n l c?n thi?t ? v?t qua trong cc mong mu?n "h?ng" ? s? d?ng (ngang ho?c d?c).
  1. T?o m?t m-un m?i v g? nh sau trong ph?n khai bo:
    Option Explicit
    
    Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
      ByVal hdc As Long) As Long
    Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
      ByVal nIndex As Long) As Long
    
    Const WU_LOGPIXELSX = 88
    Const WU_LOGPIXELSY = 90
    						
    LU ?: B?n c th? c m?t s? ch?c nng Microsoft Windows API ?c ?nh ngh?a trong m?t th vi?n Microsoft Access hi?n c; do , t? khai c?a b?n c th? b?n sao. N?u b?n nh?n ?c m?t thng bo l?i th? t?c trng l?p tn, lo?i b? ho?c nh?n xt ra tuyn b? khai bo m? c?a b?n.
  2. G? th? t?c sau y:
    Function ConvertTwipsToPixels (lngTwips as Long, _
       lngDirection as long) As Long
    
       'Handle to device
       Dim lngDC as long                        
       Dim lngPixelsPerInch as Long
       Const nTwipsPerInch = 1440
       lngDC = GetDC(0)
       
       If (lngDirection = 0) Then       'Horizontal
          lngPixelsPerInch = GetDeviceCaps(lngDC, WU_LOGPIXELSX)
       Else                            'Vertical
          lngPixelsPerInch = GetDeviceCaps(lngDC, WU_LOGPIXELSY)
       End If
       lngDC = ReleaseDC(0, lngDC)
       ConvertTwipsToPixels = (lngTwips / nTwipsPerInch) * lngPixelsPerInch
    
    End Function
    					
? g?i t?i ch?c nng ny, v?t qua s? l?ng twips b?n mu?n chuy?n ?i, v tham s? khc cho th?y cc php o ngang ho?c d?c (0 cho ngang, khng cho d?c). D?i y l m?t cu?c g?i m?u:
Function ShowConvert()
   Dim lngOldTwips As Long
   lngOldTwips = 2377
   ShowConvert = ConvertTwipsToPixels(lngOldTwips, 0)
End Function
				

Thu?c tnh

ID c?a bi: 210590 - L?n xem xt sau cng: 17 Thang Chin 2011 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Access 2000 Standard Edition
T? kha:
kbinfo kbprogramming kbmt KB210590 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:210590

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com