MJW Posted February 17, 2020 Share Posted February 17, 2020 I have a use for a pan slider control with no background image. I simply want a square with either a white or (preferably) colored background. I could create an appropriately-sized bitmap, fill it with the desired color, and call: ImageResource bgImage = ImageResource.FromImage(bitmap); configUI.SetPropertyControlValue(name, ControlInfoPropertyNames.StaticImageUnderlay, bgImage); There are at least two reasons I'd prefer a different approach if one exists. First, since it's a bitmap, I assume I should dispose of it when the effect exits, which prevents me (as far as I can see) from creating it at the low level of the call that configures the control. Second, I want to make the bitmap as small as possible, while still creating a full-sized rectangle in the control. That seems like it might depend on the screen resolution, which would prevent me from determining the correct size through trial and error. If I just want a white background, I can leave off the SetPropertyControlValue call. That works, except it creates a rectangle without a border. I want a border. Is there a way, other than using a bitmap, to create a pan slider control with a blank background and a border? And if not, how do I determine the correct size for the bitmap, so that it works with all displays? Quote Link to comment Share on other sites More sharing options...
HyReZ Posted February 17, 2020 Share Posted February 17, 2020 (edited) When Rick added new icons to Paint.NET he talked about using SVG to produce them and something about high DPI scaling and dynamic DPI infrastructure. Maybe that is something that could apply to your query and not just to the UI of Paint.NET? Edited February 17, 2020 by HyReZ Quote Link to comment Share on other sites More sharing options...
BoltBait Posted February 17, 2020 Share Posted February 17, 2020 My Effects > Fill > With Clipboard does this. After generating a VS solution from the CodeLab script, I made the following changes: //Surface sourceSurface1 = this.EnvironmentParameters.SourceSurface; //Bitmap bitmap1 = sourceSurface1.CreateAliasedBitmap(); ImageResource imageResource1 = ImageResource.FromImage(new Bitmap(typeof(FillFromClipboardEffectPlugin), "BlankCanvas.png")); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.StaticImageUnderlay, imageResource1); BlankCanvas.png is an 81x81 bitmap that is completely white. Just include in project and set to Embedded Resource. 1 Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
MJW Posted February 17, 2020 Author Share Posted February 17, 2020 Thanks, BoltBait. I was (and still am, somewhat) concerned that for high-resolution screens PDN would create larger UIs, so that it's a better size for the user, and therefore a rectangle size the works with my monitor might be too small with some other types. Creating the bitmap as a resource instead of programmatically, as I was thinking, is most likely a better way to go. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.