-
Notifications
You must be signed in to change notification settings - Fork 32
Add in-memory image support and contextual help to RibbonExtensions #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add in-memory image support and contextual help to RibbonExtensions #11
Conversation
Introduced a new method `SetContextualHelp` for the `RibbonItem` class, enabling the assignment of contextual help via a URL. Comprehensive XML documentation has been added to clarify its purpose, parameters, return value, and provide usage examples.
This commit introduces several using directives for WPF and image handling namespaces, enabling the use of WPF features in the Ribbon UI. A new private static method, `ConvertToImageSource`, is added to the `RibbonExtensions` class to convert `System.Drawing.Bitmap` to a WPF `ImageSource`, suitable for button icons. XML documentation comments are included for clarity. The existing code structure remains unchanged.
Implemented two new methods, `SetImage` and `SetLargeImage`, for the `RibbonExtensions` class. These methods enable setting images for Ribbon buttons using in-memory `System.Drawing.Bitmap` objects. Comprehensive XML documentation has been added for both methods, detailing their purpose, parameters, return values, remarks, and usage examples.
Updated `Nice3point.Revit.Extensions.csproj` to include a new package reference for `System.Drawing.Common` version `8.0.8` in the `<ItemGroup>` section.
Eliminated the `using System.Windows.Media.Imaging;` directive to clean up unused namespaces and avoid potential conflicts in the context of Revit 2024 or greater.
Clarified that the method converts a System.Drawing.Bitmap to a WPF-compatible BitmapSource. Updated parameter and return type descriptions, and added remarks about unmanaged HBITMAP handling. Changed the method signature to return BitmapSource instead of ImageSource for better specificity.
|
Hi @Nice3point, could you take a look at this pull request? |
|
I see you are trying to add support for |
Thanks, @Nice3point . Quick clarification:
Intent: enable scenarios where icons are produced at runtime or come from streams/embedded data and are already available as |
|
Give me an example with a Bitmap and where BitmapImage is not enough |
Summary of the Pull Request
What is this about:
Add in-memory image support and contextual help to RibbonExtensions
Description:
This PR introduces new features and improvements to the Ribbon extensions for Revit:
SetImage(Bitmap)andSetLargeImage(Bitmap)methods to apply 16x16 and 32x32 icons directly fromSystem.Drawing.Bitmap.BitmapSource, enabling runtime or embedded resource icons.SetContextualHelp(string url)method to quickly associate documentation or support pages with Ribbon buttons.System.Drawing.Commondependency to the project.ConvertToImageSource()helper for safe and efficient GDI+ to WPF conversion.These additions make Revit UI customization more flexible and dynamic, supporting both runtime-generated icons and integrated online help.
Quality Checklist