PowerApps 中的相機控制項Camera control in PowerApps

使用者可以使用裝置上的相機來拍攝相片的控制項。A control with which the user can take photos by using the camera on the device.


如果您新增此控制項,使用者可以從應用程式執行的任何位置,使用一或多張相片來更新資料來源。If you add this control, the user can update a data source with one or more photos from wherever the app is running.

主要屬性Key properties

Camera – 在具有多個相機的裝置上,應用程式使用之相機的數字識別碼。Camera – On a device that has more than one camera, the numeric ID of the camera that the app uses.

其他屬性Additional properties

BorderColor – 控制項框線的色彩。BorderColor – The color of a control's border.

BorderStyle – 決定控制項的框線為實線虛線點線BorderStyle – Whether a control's border is Solid, Dashed, Dotted, or None.

BorderThickness – 控制項框線的粗細。BorderThickness – The thickness of a control's border.

Brightness – 使用者想要看到的影像亮度。Brightness – How much light the user is likely to perceive in an image.

Contrast – 使用者如何輕鬆地區分影像中的類似色彩。Contrast – How easily the user can distinguish between similar colors in an image.

DisplayMode – 控制項允許使用者輸入 (編輯)、只顯示資料 (檢視) 或者已停用 (停用)。DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).

Height – 控制項的頂端和底部邊緣之間的距離。Height – The distance between a control's top and bottom edges.

OnSelect – 在使用者點選或按一下控制項時,應用程式的回應方式。OnSelect – How the app responds when the user taps or clicks a control.

OnStream – 更新 Stream 屬性時,應用程式的回應方式。OnStream – How the app responds when the Stream property is updated.

Photo – 使用者拍攝圖片時所擷取的影像。Photo – The image captured when the user takes a picture.

Stream – 根據 StreamRate 屬性自動更新影像。Stream – Automatically updated image based on the StreamRate property.

StreamRate – 在 Stream 屬性上更新影像的頻率 (以毫秒為單位)。StreamRate – How often to update the image on the Stream property, in milliseconds. 這個值的範圍可介於 100 (1/10 秒) 到 3,600,000 (1 小時)。This value can range from 100 (1/10th of a second) to 3,600,000 (1 hour).

Tooltip – 使用者將滑鼠指標停留在控制項上方時所顯示的說明文字。Tooltip – Explanatory text that appears when the user hovers over a control.

Visible – 控制項顯示或隱藏。Visible – Whether a control appears or is hidden.

Width – 控制項左邊緣與右邊緣之間的距離。Width – The distance between a control's left and right edges.

X – 控制項左邊緣與其父容器 (沒有父容器時則為螢幕) 左邊緣之間的距離。X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y – 控制項上邊緣與其父容器 (沒有父容器時則為螢幕) 上邊緣之間的距離。Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

Zoom – 相機中影像的放大百分比,或 PDF 檢視器中檔案的檢視百分比。Zoom – The percentage by which an image from a camera is magnified or the view of a file in a PDF viewer.

Patch( DataSource, BaseRecord, ChangeRecord )Patch( DataSource, BaseRecord, ChangeRecord )


  1. 新增相機控制項,並將其命名為 MyCamera,然後將其 OnSelect 屬性設為以下公式:Add a Camera control, name it MyCamera, and set its OnSelect property to this formula:
    Collect(MyPix, MyCamera.Photo)Collect(MyPix, MyCamera.Photo)

    不知道如何新增、命名和設定控制項嗎?Don't know how to add, name, and configure a control?

    想要了解 Collect 函式或其他函式的詳細資訊嗎?Want more information about the Collect function or other functions?

  2. 按 F5 鍵,然後按一下或點選 MyCamera來拍照。Press F5, and then take a photo by clicking or tapping MyCamera.
  3. 新增圖像藝廊控制項,然後重新調整其影像控制項、其範本和圖像藝廊控制項本身的大小,以將其放入螢幕中。Add an Image gallery control, and then resize its Image control, its template, and the Image gallery control itself to fit in the screen.
  4. 圖像藝廊控制項的 Items 屬性設定為這個運算式:Set the Items property of the Image gallery control to this expression:
  5. 在藝廊中將影像控制項的 Image 屬性設定為這個運算式:Set the Image property of the Image control in the gallery to this expression:

    所拍攝的相片會出現在圖像藝廊控制項中。The photo that you took appears in the Image gallery control.

  6. 視需要拍攝想要數目的相片,然後按下 Esc 鍵以返回預設工作區。Take as many photos as you want, and then return to the default workspace by pressing Esc.
  7. (選擇性) 將圖像藝廊控制項中影像控制項的 OnSelect 屬性設定為 Remove(MyPix, ThisItem),並按下 F5 鍵,然後按一下或點選相片以將它移除。(optional) Set the OnSelect property of the Image control in the Image gallery control to Remove(MyPix, ThisItem), press F5, and then click or tap a photo to remove it.

使用 SaveData 函式以在本機將儲存相片,或使用 Patch 函式來更新資料來源。Use the SaveData function to save the photos locally or the Patch function to update a data source.