Results 1 to 40 of 110

Thread: [VB6] GDI+ Usage & Samples

Threaded View

  1. #11
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: [VB6] GDI+ Usage & Samples

    EDIT: Fixed, thanks very much for this!

    Here is the final code:
    Code:
    Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long
    Private Declare Function DrawIconEx Lib "user32.dll" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
    Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long
    Private Const IMAGE_ICON As Long = 1
    Private Const LR_LOADFROMFILE As Long = &H10
    Private Const DI_NORMAL As Long = &H3
    
    Private Sub Command1_Click()
    Dim hIcon As Long
    Picture1.Picture = Nothing
    hIcon = LoadImage(0&, App.Path & "\1.ico", IMAGE_ICON, 0&, 0&, LR_LOADFROMFILE)
    If hIcon Then
        DrawIconEx Picture1.hDC, 0, 0, hIcon, 0&, 0&, 0&, 0&, DI_NORMAL
        DestroyIcon hIcon
    End If
    End Sub
    Last edited by MikiSoft; Aug 12th, 2015 at 06:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width