1. Overview
Runtime screen zoom is one of the most common HMI enhancement requests on plant-floor displays: operators want a single-click magnification of a trend, an alarm summary, or a process overview without losing context. In the Siemens WinCC ecosystem the implementation differs substantially between WinCC V7 classic (TIA Portal's predecessor SCADA), the modern WinCC Unified V20 runtime in TIA Portal, and the connected AVEVA InTouch HMI runtime that many plants have running alongside. This reference consolidates all three implementation paths, focusing on the original problem statement: toggling a 500x500 pixel trend screen to 1000x1000 pixels and back, with a single button click.
The article covers the internal-tag toggle method (the approach explicitly referenced in the field report), the C script SetPropWord path for the PictureWindow Zoom property, the VBScript HMIRuntime path for V7, the TIA Portal V20 Inspector "Zoom - allow" property, and the AVEVA InTouch Ctrl + scroll wheel method. Each method is paired with commissioning verification and a fault matrix.
2. Zoom Methods Across Platforms
Before writing any code, identify which runtime is in scope. The zoom mechanism is not portable across product generations.
| Platform | Configuration Path | Runtime Trigger | Scope of Zoom |
|---|---|---|---|
| WinCC V7 (classic) | Graphics Designer > Picture Window properties > Zoom, or C/VBS script | Button event > C-script SetPropWord / VBS HMIRuntime | Per Picture Window, per screen |
| WinCC Unified V20 (TIA Portal) | Inspector > Properties > Format > "Zoom - allow" | Touch pinch / Ctrl+wheel, button event > JS | Entire main screen window |
| AVEVA InTouch HMI | No configuration required (default enabled) | Ctrl + mouse wheel scroll | Frame contents from cursor anchor |
Reference: Configuring zooming and scrolling for runtime (RT Unified) - TIA Portal V20 documents the Inspector property in TIA Portal V20. Reference: Zoom at runtime - AVEVA Documentation documents the InTouch Ctrl+wheel behavior.
3. Prerequisites
Before any code is written, confirm the following on the engineering station and the runtime target.
- WinCC V7.4 SP1 or later for full SetPropWord/SetPropDouble support on PictureWindow Zoom. Earlier V7 versions expose the property as read-only at runtime.
- TIA Portal V20 engineering license for the Unified runtime path; the Inspector property is not present in V17 or earlier.
- WinCC Graphics Designer with the same version as the runtime RT (mismatches cause silent script failures).
-
Internal tag license for "HEIGHT_WIDTH" (or equivalent). The field report explicitly names an "Unsigned 16-bit Value" internal tag named
HEIGHT_WIDTH. - Picture Window on the parent screen for the V7 internal-tag method, with the trend screen assigned as its Picture Name property and Independent picture window flag enabled.
- WinCC V7 scripting runtime enabled in the project properties (Project > Properties > Options > Activate scripting). If disabled, C and VBS events fire silently.
4. WinCC V7 Classic - Internal-Tag Toggle Method
The field report's recommended approach is the simplest, most portable pattern for V7. It uses one internal tag to encode the current zoom state and a single button that toggles it. A C action (cyclic or tag-triggered) reads the tag and resizes the Picture Window.
4.1 Create the Internal Tag
- Open Tag Management > Internal Tags.
- Create a new tag:
HEIGHT_WIDTH - Data type: Unsigned 16-bit Value
- Start value:
500(initial trending screen size in pixels) - Update cycle: do not set (internal tags are event-driven)
4.2 Wire the Toggle Button
On the parent screen, draw a button ("Zoom"). Under Events > Mouse > Press left, attach a C action:
// V7 C action - toggle zoom state
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
DWORD current = GetTagWord("HEIGHT_WIDTH");
if (current == 500)
{
SetTagWord("HEIGHT_WIDTH", 1000);
}
else
{
SetTagWord("HEIGHT_WIDTH", 500);
}
}
4.3 Apply the Tag Value to the Picture Window
On the Picture Window's Width and Height properties, set a tag connection to HEIGHT_WIDTH. WinCC will scale the window from 500x500 to 1000x1000 and back on each toggle.
| Picture Window Property | Tag Connection | Mapping |
|---|---|---|
| Width | 500 ↔ 1000 px | |
| Height | 500 ↔ 1000 px | |
| Picture Name | Constant: Trend.pdl | Same trend regardless of size |
4.4 Verification (V7 Internal-Tag Method)
- Activate the project and open the parent screen.
- Click the Zoom button once - the Picture Window grows from 500 to 1000 px in both axes.
- Confirm
HEIGHT_WIDTHreads1000in WinCC Explorer > Tag Management > Internal Tags. - Click again - the window collapses to 500 px and the tag returns to
500. - Verify the trend continues to update during the transition (no frozen curves).
5. WinCC V7 Classic - C Script SetPropWord Path
For cases where the picture is not embedded in a Picture Window, or where more than one screen must zoom simultaneously, use the SetPropWord function on the Zoom property of the picture or PictureWindow object.
// V7 C action - explicit Zoom property
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
// Zoom value range: 10 to 800 (percent), 100 = no zoom
// 500x500 source on a 1000x1000 host = 200% zoom
float current = (float)GetPropDouble(lpszPictureName, "PictureWindow1", "Zoom");
if (current < 150.0f)
{
// Zoom in to 200%
SetPropDouble(lpszPictureName, "PictureWindow1", "Zoom", 200.0f);
}
else
{
// Zoom out to 100%
SetPropDouble(lpszPictureName, "PictureWindow1", "Zoom", 100.0f);
}
}
5.1 Property Reference
| Function | Return Type | Object | Property | Unit |
|---|---|---|---|---|
| GetPropDouble | double | PictureWindow / Screen | Zoom | % (10-800) |
| SetPropDouble | BOOL (0/1) | PictureWindow / Screen | Zoom | % (10-800) |
| SetPropWord | BOOL (0/1) | PictureWindow | Zoom | % (integer 10-800) |
6. WinCC V7 Classic - VBScript Approach
VBScript is the recommended path for V7 projects that mix WinCC with Office automation or that have C-scripting disabled by IT policy. The HMIRuntime object model exposes the same Zoom property through the ScreenItems collection.
' V7 VBS action - toggle Zoom via HMIRuntime
Sub OnClick(ByVal Item)
Dim objPW
Set objPW = HMIRuntime.Screens("MainOverview").ScreenItems("PictureWindow1")
If objPW.Zoom < 150 Then
objPW.Zoom = 200 ' 200% (1000x1000 of a 500x500 base)
objPW.Left = (objPW.Parent.Width - objPW.Width) / 2
objPW.Top = (objPW.Parent.Height - objPW.Height) / 2
Else
objPW.Zoom = 100 ' 100% (500x500 base)
objPW.Left = 100
objPW.Top = 100
End If
End Sub
6.1 VBS Property Reference
| Property | Type | Read/Write | Range |
|---|---|---|---|
| Zoom | Double | RW | 10 to 800 (%) |
| Width | Long | RW | pixels |
| Height | Long | RW | pixels |
| Left | Long | RW | pixels |
| Top | Long | RW | pixels |
objPW.Zoom = 200 followed by an immediate readback occasionally returns the previous value. Insert a 50 ms HMIRuntime.Wait 50 before the If check if scripting races with the redraw.7. WinCC Unified V20 - Inspector Zoom Property
The TIA Portal V20 Unified runtime takes a different approach. Zoom is a container property activated in the Inspector, not a scriptable attribute. Configure it as follows.
- Open the main screen in the TIA Portal editor.
- Select the screen window (not individual objects).
- Open the Inspector window.
- Navigate to Properties > Format.
- Locate the "Zoom - allow" property and set it to
true(the option is enabled by default per the official TIA Portal V20 documentation). - Optionally restrict the zoom range with Zoom - minimum and Zoom - maximum if uncontrolled zoom-out is a concern.
Reference: Configuring zooming and scrolling for runtime (RT Unified) - TIA Portal V20.
7.1 JavaScript Trigger in Unified V20
Unified screens use JavaScript in the Events tab. To bind a button to the zoom toggle:
// Unified V20 - JavaScript on a button "Click" event
export function ZoomToggle_OnClick(item) {
let screen = item.Parent;
let currentZoom = screen.ZoomFactor; // read current
if (currentZoom < 1.5) {
screen.ZoomFactor = 2.0; // 200%
} else {
screen.ZoomFactor = 1.0; // 100%
}
// recenter the visible area on the trend
screen.HorizontalScrollPosition = 0;
screen.VerticalScrollPosition = 0;
}
ZoomFactor is a double where 1.0 equals 100% (no zoom). This differs from V7's integer percentage property. Always read back the property in a Unified script - the runtime may clamp values outside the configured minimum/maximum range.8. AVEVA InTouch HMI - Ctrl + Scroll Wheel
AVEVA InTouch provides runtime zoom with no configuration beyond default installation. Operators zoom by holding Ctrl and scrolling the mouse wheel; the view zooms in from the cursor anchor, which mirrors the behavior of a magnifier lens.
Reference: Zoom at runtime - AVEVA Documentation.
| Action | Result |
|---|---|
| Ctrl + scroll up | Zoom in from current cursor position |
| Ctrl + scroll down | Zoom out from current cursor position |
| Drag with right mouse button held | Pan the zoomed frame contents |
For a single-button toggle in InTouch, use the AnimationLinks - Discrete Value or an Action Script that sets the WindowPainter magnification factor. InTouch does not expose a SetZoom equivalent through the standard animation palette; custom script is required:
' AVEVA InTouch QuickScript - window magnification toggle
IF $WindowMagFactor < 1.5 THEN
SetWindowMag 2.0;
ELSE
SetWindowMag 1.0;
ENDIF;
9. Trend Screen Implementation: 500x500 to 1000x1000
Apply the V7 internal-tag method to the original problem statement. The trend screen is a child PDL with one WinCC Online Trend Control (object name TrendControl1). The parent screen has one Picture Window and one button.
9.1 Parent Screen - Object Inventory
| Object | Name | Initial Geometry | Purpose |
|---|---|---|---|
| Picture Window | PW_Trend | 500x500, position (100,100) | Hosts the trend PDL |
| Button | btn_Zoom | 80x40, position (620,100) | Toggles the size |
| Static Text | txt_Status | 120x20, position (620,150) | Displays current size |
9.2 Tag Connection on Picture Window
Bind PW_Trend Width and Height to HEIGHT_WIDTH. WinCC will re-layout the window when the value changes. Set Picture Name to Trend.pdl.
9.3 Button C-Action
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
DWORD size = GetTagWord("HEIGHT_WIDTH");
DWORD newSize = (size == 500) ? 1000 : 500;
SetTagWord("HEIGHT_WIDTH", newSize);
SetText(lpszPictureName, "txt_Status",
newSize == 1000 ? "Zoomed: 1000x1000" : "Normal: 500x500");
}
9.4 Verification Checklist
- Runtime, click
btn_Zoom:PW_Trendsnaps to 1000x1000, trend redraws at higher resolution. - Status text reads "Zoomed: 1000x1000".
- Click again:
PW_Trendcollapses to 500x500, status returns to "Normal: 500x500". - Operator workflow: trend remains interactive at both sizes, no dialog boxes interrupt the toggle.
- On screen change and return:
HEIGHT_WIDTHretains its last value (internal tags persist for the runtime session).
10. Common Errors and Verification Matrix
| Symptom | Root Cause | Fix | Verification |
|---|---|---|---|
| Button click has no effect | C scripting disabled in project properties | Project > Properties > Options > Activate scripting | Re-test button; GSC Runtime logs show C-action execution |
| Picture Window resizes but trend does not redraw | Trend Control "Adjust to window size" flag disabled | Trend Control properties > General > Adjust to window = yes | Curves stretch to fill new window |
| Zoom flickers or jumps to 100% on every click | Independent picture window flag not set | PW properties > Options > Independent picture window = yes | Stable toggle without reset |
| VBS error 424 "object required" on HMIRuntime.Screens | Screen name typo or screen not loaded | Verify screen name in WinCC Explorer matches script string | No error; PW.Zoom updates |
| Unified V20: ZoomFactor change has no visible effect | Inspector "Zoom - allow" property = false | Inspector > Properties > Format > Zoom - allow = true | Operator can pinch / Ctrl+wheel in runtime |
| AVEVA InTouch: Ctrl+scroll does not zoom | Mouse focus on a control that intercepts the wheel | Click on the window background first, then Ctrl+scroll | Frame contents zoom in/out from cursor anchor |
| Tag overflow at 65535 | Internal tag misconfigured as 16-bit unsigned but value > 65535 | Re-evaluate max needed size; 1000 is well within range | Tag value clamped to expected value |
11. Performance and Safety Considerations
11.1 CPU Impact
WinCC V7 repaints the entire screen on each Zoom change. On a 1920x1080 panel with 4 trend controls, a 100% to 200% transition can consume 80-150 ms of CPU on a Core i5-6500. The internal-tag method triggers a single property change; the C-script SetPropDouble method triggers a full screen redraw. Prefer the internal-tag method for frequently toggled zoom.
11.2 Memory Footprint
Each Picture Window allocates a back-buffer bitmap equal to its current size. Doubling 500x500 to 1000x1000 quadruples the bitmap footprint (4x the pixel count). On panels with 4 GB RAM or less, rapid toggling can fragment the heap. Test with the largest expected configuration before commissioning.
11.3 Operator Safety
Zoom should never block acknowledgement of an alarm. Add the following guard in the button event:
// C-Action - guard against zoom during active alarm
DWORD size = GetTagWord("HEIGHT_WIDTH");
DWORD alarmCount = GetTagWord("ALARM_UNACK_COUNT");
if (alarmCount > 0 && size == 500) {
return; // Block zoom-out; keep operator on 1000x1000 for visibility
}
SetTagWord("HEIGHT_WIDTH", (size == 500) ? 1000 : 500);
11.4 Multi-Monitor Consistency
If the same project runs on a 22" panel and a 65" overview wall, the 100% zoom on the 65" wall shows the same pixel count as 200% on the 22" panel. Use a project-level constant ZOOM_BASE_PERCENT to normalize the visual size across display classes.
12. Migration Notes: V7 to Unified V20
Projects migrated from V7 to TIA Portal Unified lose the Picture Window Zoom property and the C-script SetPropWord / SetPropDouble path. Convert internal-tag-driven size changes to ScreenItem.ZoomFactor in JavaScript, and use the Inspector Zoom - allow property for operator touch/ctrl-wheel fallback.
| V7 Concept | Unified V20 Equivalent |
|---|---|
| SetPropWord("Zoom", 200) | ScreenItem.ZoomFactor = 2.0 |
| Picture Window width tied to internal tag | JavaScript dynamic resize of container |
| C action on Mouse Click | JavaScript on Event "Click" of button |
| No inspector zoom property | Inspector > Properties > Format > "Zoom - allow" |
13. FAQ
How do I zoom a WinCC V7 screen from 500x500 to 1000x1000 with one button?
Create an internal tag HEIGHT_WIDTH of type Unsigned 16-bit with start value 500. On the button's C-action, toggle the tag between 500 and 1000. Bind the Picture Window's Width and Height properties to the tag - WinCC rescales on every change.
What is the V7 property name for the PictureWindow Zoom attribute?
Use SetPropDouble(lpszPictureName, "PictureWindow1", "Zoom", 200.0) for fractional zoom or SetPropWord for integer percent. The Zoom property accepts 10 to 800 (%) on V7.4 SP1 and later.
How is zoom configured in TIA Portal Unified V20?
Select the screen window, open Inspector, go to Properties > Format, and set "Zoom - allow" to true. The option is enabled by default. Use JavaScript on the button Click event to set ScreenItem.ZoomFactor.
What zoom range does AVEVA InTouch support without scripting?
With the default configuration, InTouch zooms frame contents in or out from the cursor anchor when the operator holds Ctrl and scrolls the mouse wheel. There is no fixed percentage range; zoom is limited by the host graphics adapter's texture size.
Why does my Picture Window reset to 100% on every click in V7?
The most common cause is the "Independent picture window" flag being disabled. Enable it in the Picture Window properties so the parent screen's tag updates do not propagate into the embedded trend. Verify with the GSC Runtime log - look for the message "PictureWindow resetted" immediately before the zoom event.