WebMap for Blazor
  • WebMap Blazor
    • Modernization
      • Overview
      • Modernization Challenges
      • Our solution
      • What is Blazor?
      • How does Blazor Work?
      • Windows Forms in Blazor
      • Deployment
      • Interfacing with hardware devices
    • Research for Blazor
      • Handling Reference Parameters in Async Methods with Ref<T>
      • Alternatives to Async Properties in C#
      • Issue with using "MessageBox.Show" in Blazor
      • File Upload Functionality
      • Async/Await Feature for WebMap Blazor
    • Assessment Tool
    • Conversion Tool
      • Getting Started
      • Modals and Dialogs
      • Static Service Management
      • ImageListStreamer
      • Solution and Project Structure
        • Solution Generator
    • DCP: Desktop Compatibility Library
      • API Documentation
        • Blazor DCP: Gap.Blazor.Application Class Reference
      • Components Information
        • Button Component
        • Application Data Component
        • GroupBox Component
        • Label Component
        • CheckBox
        • CheckedListBox
        • ComboBox
        • DateTimePicker
        • Form
        • ListBox
        • ListView
          • WMListViewDetails
        • Mdi Container Component
        • MenuStrip
        • MessageBox
        • MonthCalendar
        • Panel
        • PictureBox
        • ProgressBar
        • RadioButton
        • StatusStrip
        • ToolStripStatusLabel
        • TabControl
        • TabPage
        • TextBox
        • ToolStrip
          • ToolStripButton
          • ToolStripLabel
          • ToolStripSeparator
        • ToolTip
    • Post Conversion
      • How To?
        • Create a new WebMap Window?
        • Create a new WebMap Component?
        • Create a native Blazor Window in a WebMap app?
        • Create a native Blazor Component in a WebMap Window?
        • Change the default WebMap visual layout?
    • WebMap: Angular vs Blazor
      • Footprint
      • Binaries size
      • Chatiness
      • Performance
      • Extensibility
      • Maintainability
      • Debugging
      • Project Structure
    • WebMap for Blazor Release Notes
      • Beta version
    • FAQ
    • Errors and Troubleshooting
    • License
Powered by GitBook
On this page
  • Description
  • Usage
  • Properties
  • Methods
  • Dynamic Rendering
  • Styles
  • Events
Export as PDF
  1. WebMap Blazor
  2. DCP: Desktop Compatibility Library
  3. Components Information

PictureBox

Description

This component represents an image display control in Blazor using the Gap.Blazor.PictureBox model. It renders an image with optional tooltip text and click interaction, and visually reflects the enabled state through opacity.

Usage

@namespace Gap.Blazor.Components
@inherits WMControlComponentBase

<WMStyleBase model=@pictureBox></WMStyleBase>
<div class="@(model.GetStringClasses() + " " + pictureBox.GetToolTipClass())">
    @if (pictureBox.Image != null)
    {
        <img Title="@pictureBox.ToolTipText"
             alt="@pictureBox.Name"
             src="@this.GetImage()"
             onclick="@this.onClickHandler" />
    }
</div>

<style>
    .@model.GetComponentClass() {
        opacity: @this.GetOpacity();
    }
</style>

Properties

  • PictureBox: Instance of the Gap.Blazor.PictureBox model.

  • Image: The image to display, retrieved via pictureBox.Image.GetImage().

  • ToolTipText: Text shown when hovering over the image.

  • Name: Used as the alt attribute for accessibility.

Methods

  • GetOpacity(): Returns "1" if the component is enabled, "0.3" if disabled, simulating the enabled/disabled visual state.

  • onClickHandler(): Invokes the Click event on the model if the component is enabled.

  • GetImage(): Retrieves the image source from the model.

Dynamic Rendering

  • Conditional Image Display: The <img> tag is only rendered if pictureBox.Image is not null.

  • Tooltip and Alt Text: Provided via ToolTipText and Name.

  • CSS Styling: Dynamically adjusts opacity based on the enabled state.

Styles

.@model.GetComponentClass() {
    opacity: [1 or 0.3 depending on Enabled];
}

Events

  • Click: Triggered when the image is clicked, if the component is enabled.

PreviousPanelNextProgressBar

Last updated 2 days ago