H
HKSHK
Hello,
I've got this problem:
I loaded an icon (with alpha and smoothing) into a graphics object.
Now I want to display it. The best solution would be if I could convert
it
into an image object so the picture box can display it.
Does anybody have an idea how I could do that?
Thanks a lot in advance.
Best Regards,
HKSHK
This is my source code:
'START
Private Declare Function ExtractIcon Lib "shell32.dll" Alias
"ExtractIconA" (ByVal hInst As IntPtr, ByVal lpszExeFileName As String,
ByVal nIconIndex As Int32) As IntPtr
Private sub Test (ByVal ExeOrDLL As String, ByVal ResourceID As Int32)
hIcon = ExtractIcon(IntPtr.Zero, ExeOrDLL, ResourceID)
ico = Icon.FromHandle(hIcon)
Dim g As Graphics = Me.PictureBox1.CreateGraphics
g.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.DrawIcon(ico, 0, 0)
'END
When calling it as Test ("C:\windows\system\user32.dll", 3) the
function will show the "Critical" icon (like MsgBox).
I've got this problem:
I loaded an icon (with alpha and smoothing) into a graphics object.
Now I want to display it. The best solution would be if I could convert
it
into an image object so the picture box can display it.
Does anybody have an idea how I could do that?
Thanks a lot in advance.
Best Regards,
HKSHK
This is my source code:
'START
Private Declare Function ExtractIcon Lib "shell32.dll" Alias
"ExtractIconA" (ByVal hInst As IntPtr, ByVal lpszExeFileName As String,
ByVal nIconIndex As Int32) As IntPtr
Private sub Test (ByVal ExeOrDLL As String, ByVal ResourceID As Int32)
hIcon = ExtractIcon(IntPtr.Zero, ExeOrDLL, ResourceID)
ico = Icon.FromHandle(hIcon)
Dim g As Graphics = Me.PictureBox1.CreateGraphics
g.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.DrawIcon(ico, 0, 0)
'END
When calling it as Test ("C:\windows\system\user32.dll", 3) the
function will show the "Critical" icon (like MsgBox).