当前位置: 首页>>代码示例>>C#>>正文


C# Button.BringIntoView方法代码示例

本文整理汇总了C#中System.Windows.Controls.Button.BringIntoView方法的典型用法代码示例。如果您正苦于以下问题:C# Button.BringIntoView方法的具体用法?C# Button.BringIntoView怎么用?C# Button.BringIntoView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Button的用法示例。


在下文中一共展示了Button.BringIntoView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: iInvalidateSpeakers

        private void iInvalidateSpeakers()
        {
            //TODO: remove try catch
            try
            {
                Transcription transc = _subtitlesData;
                //   WaveformData currentWave = wave;

                if (transc == null) return;
                //    if (currentWave == null) return;

                foreach (Button pL in speakerButtons)
                {
                    wavegrid.Children.Remove(pL);
                }
                this.speakerButtons.Clear();

                for (int i = 0; i < transc.Chapters.Count; i++)
                {
                    TranscriptionChapter pChapter = transc.Chapters[i];
                    for (int j = 0; j < pChapter.Sections.Count; j++)
                    {
                        TranscriptionSection pSection = pChapter.Sections[j];
                        for (int k = 0; k < pSection.Paragraphs.Count; k++)
                        {
                            TranscriptionParagraph pParagraph = pSection.Paragraphs[k];
                            double pBegin = pParagraph.Begin.TotalMilliseconds;
                            double pEnd = pParagraph.End.TotalMilliseconds;

                            double wavebegin = WaveBegin.TotalMilliseconds;
                            double waveend = WaveEnd.TotalMilliseconds;
                            double wavelength = WaveLength.TotalMilliseconds;

                            if (pEnd < pBegin)
                                pEnd = pBegin;

                            if (pBegin >= 0 && pEnd != pBegin && pEnd >= 0 && pParagraph.End >= TimeSpan.Zero)
                            {
                                if ((pParagraph.Begin < WaveBegin && pParagraph.End < WaveBegin) || (pParagraph.Begin > WaveEnd))
                                {

                                }
                                else
                                {
                                    Button speaker = new Button();

                                    speaker.PreviewMouseMove += new MouseEventHandler(pSpeaker_MouseMove);
                                    speaker.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(pSpeaker_PreviewMouseLeftButtonUp);
                                    speaker.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(pSpeaker_PreviewMouseLeftButtonDown);

                                    speaker.VerticalAlignment = VerticalAlignment.Top;
                                    speaker.HorizontalAlignment = HorizontalAlignment.Left;

                                    double aLeft = (double)(this.ActualWidth * (pBegin - wavebegin) / wavelength);
                                    double aRight = gridTimeline.ActualWidth - (double)(this.ActualWidth * (pEnd - wavebegin) / wavelength);
                                    speaker.Margin = new Thickness(aLeft, speaker.Margin.Top, speaker.Margin.Right, selectionRectangle.Margin.Bottom);
                                    speaker.Width = gridTimeline.ActualWidth - aLeft - aRight;

                                    speaker.Background = Properties.Settings.Default.WaveformSpeakerBackground;
                                    Speaker pSpeaker = pParagraph.Speaker;
                                    string pText = "";
                                    if (pSpeaker != null) pText = pSpeaker.FullName;
                                    speaker.Visibility = Visibility.Visible;
                                    speaker.BringIntoView();
                                    speaker.Focusable = false;
                                    speaker.IsTabStop = false;
                                    speaker.Cursor = Cursors.Arrow;
                                    if (pText != null && pText != "") speaker.ToolTip = speaker.Content;
                                    speaker.Tag = pParagraph;
                                    speaker.Click += new RoutedEventHandler(pSpeaker_Click);
                                    speaker.MouseDoubleClick += new MouseButtonEventHandler(pSepaker_MouseDoubleClick);

                                    DockPanel dp = new DockPanel() { LastChildFill = true, Margin = new Thickness(0, 0, 0, 0) };
                                    dp.Height = 15;
                                    DockPanel dp2 = new DockPanel() { LastChildFill = true, Margin = new Thickness(0, 0, 0, 0) };
                                    dp2.FlowDirection = System.Windows.FlowDirection.RightToLeft;
                                    dp2.Height = 15;
                                    if (k == 0) //prvni zaznam v sekci
                                    {
                                        Ellipse el = new Ellipse();
                                        el.Width = 10;
                                        el.Height = 10;
                                        el.Margin = new Thickness(0, 0, 0, 0);
                                        el.Stroke = null;
                                        el.Fill = Properties.Settings.Default.WaveformBlockMarkColor;

                                        dp.Children.Add(el);

                                    }

                                    if (
                                        (k == pSection.Paragraphs.Count - 2 && j == pChapter.Sections.Count - 1)
                                        ||
                                        (k == pSection.Paragraphs.Count - 1 && j != pChapter.Sections.Count - 1)
                                        )
                                    {
                                        Ellipse el = new Ellipse();
                                        el.Width = 10;
                                        el.Height = 10;
                                        el.Margin = new Thickness(0, 0, 0, 0);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的System.Windows.Controls.Button.BringIntoView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。