In my programs I often use Block-Based Dialogs, as described in "Getting started with SNAP.pdf".
Everything works nice, except bitmaps. On top of each dialog I have my bitmap, but it looks good only at my computer. On other computers (with different screen resolution?) bitmaps are usually trimmed.
I my code I have following commands:
Public Logo As UI.Block.LabelBlock
Public mpOpisBledu As UI.Block.LabelBlock
Logo = New UI.Block.LabelBlock
Logo.Bitmap = "my_logo.bmp"
mpOpisBledu = New UI.Block.LabelBlock
mpOpisBledu.WordWrap = True
mpOpisBledu.Label = "any content"
this bitmap is located in UGII_BITMAP_PATH location
I use Visual Studio to create my programs.
I have exactly the same problem also when using "Windows Forms"
(for Windows Forms I have this bitmaps sourced to my project)
I'm looking for any advice how to make my Block-Based Dialogs and Windows Forms looks the same irrespective of screen size or resolution
You need to enable DPI aware windows.
For WinForms you have the following options:
In the main code add:
' Any control offering "FlatStyle" must have this set to "System" System.Windows.Forms.Application.EnableVisualStyles()
In the WinForms code make sure to use:
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
I don't know if there is a way to do this for block styler dialogs.
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk Testing: NX12.0
How to Get the Most from Your Signature in the Community
Thank you Stefan. I will give it a try with WinForms.
And I am still looking how to fix this in Block-Based Dialogs. (if it matters, I'm not using "Block UI Styler" from NX - I'm just building/modifying this procedures in VB)
Try using a DrawingArea block. With this, you can specify the height and width of the region in which the image is placed.
To be honest, I'm having trouble figuring out how the Height and Width properties work. Width is the width of the region, measured in pixels, I think, and that seems to work OK. But Height doesn't seem to have any impact on the display; it looks like the height of the region is being computed from the image, to me. But at least you have some control.
Here is my test code:
Option Infer On Public Class TestDialog : Inherits Snap.UI.BlockForm Dim pictureBlock As Snap.UI.Block.DrawingArea Public Sub New() Me.Title = "Test DrawingArea" ' Text to be shown in title bar of dialog Me.Cue = "Does it look right??" ' Text to be shown in cue line pictureBlock = New Snap.UI.Block.DrawingArea() pictureBlock.Image = "D:\sammie.bmp" ' Need to provide your own image pictureBlock.Width = 200 ' Width in pixels. Seems to work pictureBlock.Height = 9999 ' Seems to have no impact Me.AddBlocks(pictureBlock) End Sub Public Shared Sub Main() Dim myForm = New TestDialog() myForm.Show() End Sub End Class