0 Replies - 1805 Views - Last Post: 09 May 2011 - 04:38 PM

#1 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Draw 3D Vertical Line Win32 asm

Posted 09 May 2011 - 04:38 PM

Description: Needs user32.dll and gdi32.dll
In WM_PAINT handler:
After your call to BeginPain and before your call to EndPaint:
        push    410             ; Line Bottom
        push    5               ; Line Left
        push    333             ; Line Top
        push    ps.hdc          ; pointer to PAINTSTRUCT.hdc
        call    Draw3DVertLineDraws a 3D vertical line on Window/Dialog



Draw3DVertLine:
    ; [ebp + 8] == hDC
    ; [ebp + 12] == Line left
    ; [ebp + 16] == Line top
    ; [ebp + 20] == Line bottom
    push    ebp
    mov     ebp, esp
    sub     esp , 8
    
    ;###### Right line ######
    push    COLOR_BTNSHADOW
    call    GetSysColor
	
	push    eax
	push    1
	push    PS_SOLID
	call    CreatePen
    mov     dword ptr [ebp - 4], eax
	
    push    eax
    push    [ebp + 8]
    call    SelectObject
    mov     dword ptr [ebp - 8], eax

    push    0                               ;
    push    [ebp + 16]                      ; Line top
    push    [ebp + 12]                      ; Line Left
    push    [ebp + 8]                       ; hDC
    call    MoveToEx

    push    [ebp + 20]                      ; Line bottom
    push    [ebp + 12]                      ; Line left
    push    [ebp + 8]                       ; hDC
    call    LineTo    
    
    push    [ebp + 8]
    push    [ebp - 8]
    call    SelectObject
    
    push    [ebp - 4]
    call    DeleteObject

    ;###### Left Line ######
    dec     dword ptr [ebp + 12]            ; move line left 1

    push    COLOR_BTNHILIGHT
    call    GetSysColor
    
    push    eax
    push    1
    push    PS_SOLID
    call    CreatePen
    mov     dword ptr [ebp - 4], eax

    push    eax
    push    [ebp + 8]
    call    SelectObject
    mov     dword ptr [ebp - 8], eax

    push    0                               ;
    push    [ebp + 16]                      ; Line top
    push    [ebp + 12]                      ; Line Left
    push    [ebp + 8]                       ; hDC
    call    MoveToEx

    push    [ebp + 20]                      ; Line bottom
    push    [ebp + 12]                      ; Line Left
    push    [ebp + 8]                       ; hDC
    call    LineTo    
    
    push    [ebp + 8]
    push    [ebp - 8]
    call    SelectObject
    
    push    [ebp - 4]
    call    DeleteObject
    
    leave
    ret     16



Is This A Good Question/Topic? 0
  • +

Page 1 of 1