Allow Drawings in Designer Functions

I can define a designer function with a return type LlParamType.Drawing.


.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #a31515; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

var
function = new DesignerFunction() {
FunctionName = “GetBitmap”, Description =
“Erwartet als Parameter den Namen einer Datei und liefert ein Bitmap Objekt”,
GroupName = “Sonstiges”, Visible = true, MinimalParameters = 1, MaximumParameters = 1,
Parameter1 = new DesignerFunctionParameter() {
Description = “Name der Datei”, Type = LlParamType.String
}, ResultType = LlParamType.Drawing,
};

function.EvaluateFunction += (_sender, _e) = > {
var fileName = (string) _e.Parameter1;
_e.ResultValue = new Bitmap(fileName);
_e.ResultType = LlParamType.Drawing;
}

However, If I return a Bitmap-Object the designer just prints out “System.Drawing.Bitmap”. Please allow Designer Functions that return an image.



 

Promoted to “planned” state