PowerApps 中的麦克风控件Microphone control in PowerApps

用户可以用来记录声音的控件。A control with which the user can record sounds.

说明Description

如果添加此控件,用户可从应用运行的任何位置使用一个或多个声音更新数据源。If you add this control, the user can update a data source with one or more sounds from wherever the app is running.

关键属性Key properties

Mic – 在具有多个麦克风的设备上,应用所使用的麦克风的数字 ID。Mic – On a device that has more than one microphone, the numeric ID of the microphone that the app uses.

OnStop – 用户使用麦克风控件停止录制时应用的响应方式。OnStop – How the app responds when the user stops recording with a microphone control.

其他属性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.

Color – 控件中文本的颜色。Color – The color of text in a control.

DisplayMode – 此控件是允许用户输入 (Edit)、仅显示数据 (View),还是已禁用 (Disabled)。DisplayMode – Whether the control allows user input (Edit), only displays data (View), or is disabled (Disabled).

DisabledBorderColor – 控件的 DisplayMode 属性设置为 Disabled 时,该控件边框的颜色。DisabledBorderColor – The color of a control's border if the control's DisplayMode property is set to Disabled.

DisabledColor – 控件的 DisplayMode 属性设置为 Disabled 时,该控件中的文本颜色。DisabledColor – The color of text in a control if its DisplayMode property is set to Disabled.

DisabledFill – 控件的 DisplayMode 属性设置为 Disabled 时,该控件的背景颜色。DisabledFill – The background color of a control if its DisplayMode property is set to Disabled.

Fill – 控件的背景颜色。Fill – The background color of a control.

Height – 控件上边缘和下边缘之间的距离。Height – The distance between a control's top and bottom edges.

HoverBorderColor – 用户将鼠标指针停留在控件上时,该控件边框的颜色。HoverBorderColor – The color of a control's border when the user keeps the mouse pointer on that control.

HoverColor – 用户将鼠标指针停留在控件上时,该控件中的文本颜色。HoverColor – The color of the text in a control when the user keeps the mouse pointer on it.

HoverFill – 用户将鼠标指针停留在控件上时,该控件的背景颜色。HoverFill – The background color of a control when the user keeps the mouse pointer on it.

Image - 图像、音频或麦克风控件中显示的图像名称。Image – The name of the image that appears in an image, audio, or microphone control.

ImagePosition – 屏幕或控件大小与图像大小不同时,其中图像的位置(“填充”、“适应”、“拉伸”、“平铺”或“居中”)。ImagePosition – The position (Fill, Fit, Stretch, Tile, or Center) of an image in a screen or a control if it isn't the same size as the image.

OnSelect – 用户点击或单击某个控件时应用响应的方式。OnSelect – How the app responds when the user taps or clicks a control.

OnStart - 用户使用麦克风控件开始录制时应用如何响应。OnStart – How the app responds when the user starts to record with a microphone control.

PressedBorderColor – 用户在点击或单击控件时,该控件边框的颜色。PressedBorderColor – The color of a control's border when the user taps or clicks that control.

PressedColor – 用户在点击或单击控件时,该控件中的文本的颜色。PressedColor – The color of text in a control when the user taps or clicks that control.

PressedFill – 用户在点击或单击控件时,该控件的背景色。PressedFill – The background color of a control when the user taps or clicks that control.

Reset – 控件是否还原为其默认值。Reset – Whether a control reverts to its default value.

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).

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

示例Example

  1. 添加“麦克风”,将其命名为“MyMic”,并将其 OnStop 属性设置为以下公式:Add a Microphone, name it MyMic, and set its OnStop property to this formula:
    Collect(MySounds, MyMic.Audio)Collect(MySounds, MyMic.Audio)

    不知道如何添加、命名和配置控件Don't know how to add, name, and configure a control?

    想要了解有关 Collect 函数或其他函数的详细信息?Want more information about the Collect function or other functions?

  2. 添加“自定义库”控件,将其移至“MyMic” 下,并将“自定义库”控件的 Items 属性设置为 MysoundsAdd a Custom gallery control, move it below MyMic, and set the Items property for the Custom gallery control to MySounds.
  3. 在“自定义库”控件的模板中,添加音频控件,并将其“媒体”属性设置为 ThisItem.UrlIn the template for the Custom gallery control, add an Audio control, and set its Media property to ThisItem.Url.
  4. 按 F5,单击或点击“MyMic”开始录制,然后再次单击或点击以停止录制。Press F5, click or tap MyMic to start recording, and then click or tap it again to stop recording.
  5. 在“自定义库”控件中,单击或点击音频控件中的播放按钮以播放录制的内容。In the Custom gallery control, click or tap the play button in the Audio control to play back your recording.
  6. 根据需要添加多个录制内容,然后按 Esc 返回到默认工作区。Add as many recordings as you want, and then return to the default workspace by pressing Esc.
  7. (可选)在“自定义库”控件的模板中,添加按钮控件,将 其 OnSelect 属性设置为 Remove(MySounds, ThisItem),按 F5,然后单击或点击相应的“按钮”控件删除录制。(optional) In the template for the Custom gallery control, add a Button control, set its OnSelect property to Remove(MySounds, ThisItem), press F5, and then remove a recording by clicking or tapping the corresponding Button control.

使用 SaveData 函数在本地保存录音,或使用 Patch 函数更新数据源。Use the SaveData function to save the recordings locally or the Patch function to update a data source.