Add helpful static functions to `PICTDESC`
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- C#
- Stars
- 2.5k
- Forks
- 124
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 9
Description
These static functions below are in winforms. FromIcon might be hard without a method to resolve dependencies added from templates.
public static PICTDESC FromBitmap(Bitmap bitmap, IntPtr paletteHandle = default)
{
PICTDESC desc = new PICTDESC
{
picType = PICTYPE.BITMAP
};
desc.Union.bmp.hbitmap = bitmap.GetHbitmap();
desc.Union.bmp.hpal = paletteHandle;
return desc;
}
public static PICTDESC FromIcon(Icon icon, bool copy)
{
PICTDESC desc = new PICTDESC
{
picType = PICTYPE.ICON
};
desc.Union.icon.hicon = copy ?
User32.CopyImage(
icon.Handle,
User32.IMAGE.ICON,
icon.Width,
icon.Height,
User32.LR.DEFAULTCOLOR)
: icon.Handle;
GC.KeepAlive(icon);
return desc;
}
public static PICTDESC FromMetafile(Metafile metafile)
{
PICTDESC desc = new PICTDESC
{
picType = PICTYPE.ENHMETAFILE
};
desc.Union.emf.hemf = metafile.GetHenhmetafile();
return desc;
}
Winforms Tracking: https://github.com/dotnet/winforms/issues/7468
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named in the issue. Start by locating the PICTDESC definition and comparing the requested static functions with the WinForms tracking issue; done means the three helpers are available with the shown bitmap, icon, and metafile behavior and the relevant tests or validation pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100