Convert bitmap to icon

前端 未结 4 1175
闹比i
闹比i 2021-02-18 18:01

I am trying to convert bitmap into icon. But there is some error as the resultant file is just blank.

private void btnCnvrtSave_Click(object sender, EventArgs e)         


        
4条回答
  •  无人及你
    2021-02-18 18:34

    Please, use DestroyIcon after GetHicon, to prevent memory leak

    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    extern static bool DestroyIcon(IntPtr handle);
    

    MSDN : https://msdn.microsoft.com/en-us/library/system.drawing.bitmap.gethicon%28v=vs.110%29.aspx

提交回复
热议问题