Using PB 2019 R2 build 2353
We built a C# .NET screen to be used by both our Powerbuilder and C# .NET WPF applications.
I wrote in C# .NET a function that takes 8 arguments (all strings) and returns 1 string. The function uses those arguments to open and populate the C# .NET screen. Then I used PB's ".NET DLL Importer" to create an NVO which uses that function.
CODE:
nvo_powerbuilderfunctioncall lnvo_pb
string ls_string
DotNetAssembly ldna
DotNetObject ldno
long li_rc
lnvo_pb = create nvo_powerbuilderfunctioncall
If IsValid(lnvo_pb) then
ldna = create DotNetAssembly
li_rc = ldna.LoadWithDotNetFramework(lnvo_pb.is_assemblypath)
ldno = create DotNetObject
li_rc = ldna.CreateInstance(lnvo_pb.is_classname, ldno)
ls_string = ldno.CallCSharpDotNetFunction(as_str1, as_str2, as_str3, as_str4, &
as_str5, as_str6, as_str7, as_str8)
else
ls_string = "FAIL"
return -1
end if
destroy lnvo_pb
destroy ldno
destroy ldna
PROBLEM: when I run my app in PB and call this function, the C# .NET window opens with the arguments populating its fields. But as it opens, PB resizes itself - the app is resized (but not all the objects within the app), and when I close the app and return to PB, PB itself is resized, and looks silly. The only way to get PB back to normal is to close and restart it.
I'm going to look at any losefocus events in my frame and sheets to see if I can find a cause. Any input you guys have is welcome. Thanks!
Furthermore, we discovered that if we open the properties of the PB190.exe, and change its high DPI settings to override high scaling DPI, and set the scaling to "System", then Powerbuilder and the app I'm working on both retain their original size when opening the C# .NET window.