本文整理汇总了C#中Timeline.GetTrackAreaBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Timeline.GetTrackAreaBounds方法的具体用法?C# Timeline.GetTrackAreaBounds怎么用?C# Timeline.GetTrackAreaBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timeline
的用法示例。
在下文中一共展示了Timeline.GetTrackAreaBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RectangleToTrackExtents
/// <summary>
/// Calculate the bounding rectangle in screen-space that would hold a track of the same extents as the given rectangle.
/// </summary>
/// <param name="rect">A rectangle which left and right edge represent the start and end of a track item. The top and bottom edge are ignored.</param>
/// <param name="timeline">The timeline the assumed track would live on. Used to determine the top and bottom edge of the bounding rectangle.</param>
/// <param name="assumedTrackIndex">The assumed index of the track. Used to determine the top edge of the bounding rectangle.</param>
/// <returns>A bounding rectangle that would hold a track of the same extents as the given rectangle.</returns>
internal static RectangleF RectangleToTrackExtents( RectangleF rect, Timeline timeline, int assumedTrackIndex )
{
Rectangle trackAreaBounds = timeline.GetTrackAreaBounds();
int actualRowHeight = (int)( ( timeline.TrackHeight ) * timeline.RenderingScale.Y + timeline.TrackSpacing );
// Calculate the Y offset for the track.
int trackOffsetY = (int)( trackAreaBounds.Y + ( actualRowHeight * assumedTrackIndex ) + timeline.RenderingOffset.Y );
// Calculate the X offset for track.
int trackOffsetX = (int)( trackAreaBounds.X + ( rect.X * timeline.RenderingScale.X ) + timeline.RenderingOffset.X );
// The extent of the track, including the border
RectangleF trackExtent = new RectangleF( trackOffsetX, trackOffsetY, rect.Width * timeline.RenderingScale.X, timeline.TrackHeight * timeline.RenderingScale.Y );
return trackExtent;
}