如何在wpf中使用c#拖动基于xml标签的T形处理程序?

问题描述 投票:0回答:1

enter image description here

图像中的蓝色标记线是我的canvas。使用画布设置顶部,我试图使用计时器移动拇指(T形图像)。现在我正在使用计时器运行,以便基于计时器我的处理程序正在移动。但是我需要自动移动以及拖动处理程序位置。当我拖动完成后,我需要从放下处理程序的地方开始过渡。

任何人都可以帮助我实现这一目标吗?

我的xml文件

<m_config>
<mixer_streams>
    <file in='0.0' path='d:\ahd_assets\images\A.png' interlace='' aspect_ratio='' scale_type='default' external_audio='' external_audio_offset='' preview.pull='false' img_stub='' img.default_duration='5' img.tone='' no_breaks='false' open_file.max_wait='10000' open_url.max_wait='10000' read_url.max_wait='3000' read_file.max_wait='3000' force_mpeg_tc='false' audio_track='0' video_track='0' subtitle_track='-1' ts_program='-1' network.buffer_min='1.0' network.buffer_max='10.0' network.rate_control='true' file.buffer_min='0.0' file.buffer_max='2.0' decode='auto' decode.fallback='false' out_point.mode='wait' mfreader.convert_format='true' output.10bit='false' file.max_forward_rate='4.0' stream_id='LA' start_timecode='' format_3d='default' right_eye_video='' in_preroll='1.0' tc_preroll='1.0' duration='5.0' ref_id='0x4CB41140' loop='true'>
        <info/>
        <video video_format='HD1080-29p' width='1920' height='-1080' rate='29.97003' pixel_format='ARGB32' aspect_ratio='16:9' interlace='progressive'/>
        <audio track_split=''/>
        <object imaudio.enabled='true' audio_channels='' audio_gain='' gpu.rgb_transform_matrix='' default_name='MFile' default_tracks='0' channels_per_track='0' internal.convert_frame='false' experimental.buffers='0' pause.fields='2' pause.use_reference='false' afilter='' scaling_quality='auto' crop='' mirror='' rotate='' overlay_rms='false' overlay_rms.pos='0.1' overlay_rms.color='green' overlay_waveform='false' overlay_waveform.pos='-0.3' overlay_waveform.color='' audio.variable_rate='true' audio.lufs='false' audio.lufs_state='' audio.lufs_channels='' audio.gain_normalization='false' gain_normalization.target_i='-23.0' gain_normalization.skip_frames='20.0' timecode.time_sync='0' timecode.offset='' mfconverter.enabled='true' format.set_default_pixelformat='true' mdelay.enabled='false' mdelay.live_preview='false' file.max_reverse_rate='2.0' gain_normalization.gating='-100.0' gain_normalization.loudness_type='rms' playback_rate='1.0' statistics.extended='' network.buffer_wait_kf='false' network.max_video_gap='80' file.buffer_wait_kf='false'/>
        <mitem_props stop_in='' stop_out='' pause_in='' pause_out='' video='true' audio='true' drop_frames='false' master='false' stream_id='LA'>
            <file/>
            <device/>
            <object/>
        </mitem_props>
    </file>
    <file in='0.0' path='d:\ahd_assets\images\B.png' interlace='' aspect_ratio='' scale_type='default' external_audio='' external_audio_offset='' preview.pull='false' img_stub='' img.default_duration='5' img.tone='' no_breaks='false' open_file.max_wait='10000' open_url.max_wait='10000' read_url.max_wait='3000' read_file.max_wait='3000' force_mpeg_tc='false' audio_track='0' video_track='0' subtitle_track='-1' ts_program='-1' network.buffer_min='1.0' network.buffer_max='10.0' network.rate_control='true' file.buffer_min='0.0' file.buffer_max='2.0' decode='auto' decode.fallback='false' out_point.mode='wait' mfreader.convert_format='true' output.10bit='false' file.max_forward_rate='4.0' stream_id='LB' start_timecode='' format_3d='default' right_eye_video='' in_preroll='1.0' tc_preroll='1.0' duration='5.0' ref_id='0x20A6A370' loop='true'>
        <info/>
        <video video_format='HD1080-29p' width='1920' height='-1080' rate='29.97003' pixel_format='ARGB32' aspect_ratio='16:9' interlace='progressive'/>
        <audio track_split=''/>
        <object imaudio.enabled='true' audio_channels='' audio_gain='' gpu.rgb_transform_matrix='' default_name='MFile' default_tracks='0' channels_per_track='0' internal.convert_frame='false' experimental.buffers='0' pause.fields='2' pause.use_reference='false' afilter='' scaling_quality='auto' crop='' mirror='' rotate='' overlay_rms='false' overlay_rms.pos='0.1' overlay_rms.color='green' overlay_waveform='false' overlay_waveform.pos='-0.3' overlay_waveform.color='' audio.variable_rate='true' audio.lufs='false' audio.lufs_state='' audio.lufs_channels='' audio.gain_normalization='false' gain_normalization.target_i='-23.0' gain_normalization.skip_frames='20.0' timecode.time_sync='0' timecode.offset='' mfconverter.enabled='true' format.set_default_pixelformat='true' mdelay.enabled='false' mdelay.live_preview='false' file.max_reverse_rate='2.0' gain_normalization.gating='-100.0' gain_normalization.loudness_type='rms' playback_rate='1.0' statistics.extended='' network.buffer_wait_kf='false' network.max_video_gap='80' file.buffer_wait_kf='false'/>
        <mitem_props stop_in='' stop_out='' pause_in='' pause_out='' video='true' audio='true' drop_frames='false' master='false' stream_id='LB'>
            <file/>
            <device/>
            <object/>
        </mitem_props>
    </file>
</mixer_streams>
<m_scenes active_scene='New_18'>
    <m_scene name='New_18'>
        <scene_3d view_angle='45.0' show='true'>
            <group id='ahd_trn' duration='2' fixed='0' swap='1' reverse='1'>
                <group id='virtual'>
                    <object id='object_000' src='d:\ahd_assets\3ds\07126\RINGS EDITED.3DS' y='0.100' z='1' r='0' rv='50' show='true' LayerA.png='LA' LayerB.png='LB'/>
                    <video id='video_A_OUT' stream_id='LA' stream_idx='-1' audio_gain='-80' show='true' z='1.000' w='0.171' x='0'/>
                    <video id='video_B_in' stream_id='LB' stream_idx='-1' audio_gain='-80' z='1.000' w='0.171' x='1.000' show='true'/>
                </group>
            </group>
            <camera/>
        </scene_3d>
        <view>
            <view id='t_00' duration='3.0' hold='0.0' reverse='0'>
                <video show='true' x='-1.000' target_id='scene_3d::ahd_trn::virtual::video_A_OUT'/>
                <video show='true' rv='0' z='1.100' y='0.100' target_id='scene_3d::ahd_trn::virtual::object_000'/>
            </view>
            <view id='t_01' duration='20.0' hold='0.0' reverse='0'>
                <video show='true' rh='360' y='0.100' z='1.050' target_id='scene_3d::ahd_trn::virtual::object_000'/>
            </view>
            <view id='t_02' duration='3.0' hold='0.0' reverse='0'>
                <video show='true' rv='50' z='1' y='0.100' target_id='scene_3d::ahd_trn::virtual::object_000'/>
                <video show='true' x='0' target_id='scene_3d::ahd_trn::virtual::video_B_in'/>
            </view>
            <view id='t_03' duration='0.0' hold='0.0' reverse='1'>
                <object target_id='scene_3d::ahd_trn::virtual::object_000' show='true' y='0.100' z='1.000' rv='50' rh='0'/>
                <video target_id='scene_3d::ahd_trn::virtual::video_A_OUT' show='true' x='-1.000'/>
                <video target_id='scene_3d::ahd_trn::virtual::video_B_in' show='true' x='0.000' z='1.000' w='0.171'/>
            </view>
            <view id='t_04' duration='3.0' hold='0.0' reverse='1'>
                <object target_id='scene_3d::ahd_trn::virtual::object_000' show='true' y='0.100' z='1.000' rv='0'/>
                <video show='true' x='1.000' z='1.000' w='0.171' target_id='scene_3d::ahd_trn::virtual::video_B_in'/>
            </view>
            <view id='t_05' duration='20.0' hold='0.0' reverse='1'>
                <object target_id='scene_3d::ahd_trn::virtual::object_000' show='true' rh='360' y='0.100' z='1.050'/>
            </view>
            <view id='t_06' duration='3.0' hold='0.0' reverse='1'>
                <video show='true' x='0.000' z='1.000' w='0.171' target_id='scene_3d::ahd_trn::virtual::video_A_OUT'/>
                <object show='true' rv='50' z='1.000' y='0.100' target_id='scene_3d::ahd_trn::virtual::object_000'/>
            </view>
        </view>
        <background/>
        <foreground parallax-shift='0.05'/>
    </m_scene>
</m_scenes>

`

在此xml中,我的视图标签位于底部。如何通过处理程序拖动链接我的标签。例如,视图id = t_06,如果我将处理程序中的t图像拖到底部,它应该给我一些变量a = t_06的值。如果我向上移动与小鼠leftbutton它应该给一个= t_04或t_03这样。

用于t处理程序的wpf xaml代码

 <DockPanel Grid.Row="1" Background="#FF2C2C2C">
        <Grid x:Name="pnlM" Width="13" Panel.ZIndex="0" Margin="44.5,0,0,0">
            <Grid.Background>
                <ImageBrush ImageSource="/Mep_Agh;component/Resources/handle-stripe-M.png"/>
            </Grid.Background>
            <Grid.RowDefinitions >
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
                <RowDefinition Height="15"></RowDefinition>
            </Grid.RowDefinitions>

        </Grid>
        <!--<StackPanel x:Name="pnlM" Width="13" Panel.ZIndex="0" Margin="44.5,0,0,0" Orientation="Horizontal">
            <StackPanel.Background>
                <ImageBrush ImageSource="/Mep_Agh;component/Resources/handle-stripe-M.png"/>
            </StackPanel.Background>

        </StackPanel>-->
        <!--<ScrollViewer Height="Auto" Width="Auto" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"  >-->
            <Canvas x:Name="MyCanvas"  >

            <Image  x:Name="btnH" Height="27" Width="60" Canvas.Left="-36"  Source="/Mep_Agh;component/Resources/handle.png"
                    MouseMove="Control_MouseMove" MouseLeftButtonDown="Control_MouseLeftButtonDown" MouseLeftButtonUp="Control_MouseLeftButtonUp" AllowDrop="True"  >
            </Image>
            <!--<Button x:Name="btnH" Height="27" Style="{StaticResource MyButton}" VerticalAlignment="Top" Width="60" BorderBrush="{x:Null}" Panel.ZIndex="1" HorizontalAlignment="Left" DockPanel.Dock="Top" Canvas.Left="-37" Canvas.Top="1" MouseMove="Control_MouseMove" MouseLeftButtonDown="Control_MouseLeftButtonDown" MouseLeftButtonUp="Control_MouseLeftButtonUp">
                    <Button.Background>
                        <ImageBrush ImageSource="/Mep_Agh;component/Resources/joy_thumb.bmp" Stretch="Uniform"/>
                    </Button.Background>
                </Button>-->
            </Canvas>
        <!--</ScrollViewer>-->
    </DockPanel>

行定义,我创建它以匹配视图标签的数量。

图像中的蓝色标记线是我的canvas。使用画布设置顶部,我试图使用计时器移动拇指(T形图像)。现在我正在使用计时器运行,以便基于计时器我的处理程序正在移动。 ...

c# wpf c#-4.0 wpf-controls c#-3.0
1个回答
0
投票

我获得了视图索引,并且也能够完成我的任务。下面是代码

© www.soinside.com 2019 - 2024. All rights reserved.