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


C# System.Drawing.Rectangle.Inflate方法代码示例

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


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

示例1: UpdateRectangles

        /// <summary>Update the rectangles for the list box control</summary>
        protected override void UpdateRectangles()
        {
            // Get bounding box
            base.UpdateRectangles();

            // Calculate the size of the selection rectangle
            selectionRect = boundingBox;
            selectionRect.Width -= scrollWidth;
            selectionRect.Inflate(-border, -border);
            textRect = selectionRect;
            textRect.Inflate(-margin, 0);

            // Update the scroll bars rects too
            scrollbarControl.SetLocation(boundingBox.Right - scrollWidth, boundingBox.Top);
            scrollbarControl.SetSize(scrollWidth, height);
            FontNode fNode = DialogResourceManager.GetGlobalInstance().GetFontNode((int)(elementList[0] as Element).FontIndex);
            if ((fNode != null) && (fNode.Height > 0))
            {
                scrollbarControl.PageSize = (int)(textRect.Height / fNode.Height);

                // The selected item may have been scrolled off the page.
                // Ensure that it is in page again.
                scrollbarControl.ShowItem(selectedIndex);
            }
        }
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:26,代码来源:dxmutgui.cs

示例2: Add

        /// <summary>
        /// Add a <see cref="System.Drawing.Bitmap"/> thumbnail to the page.
        /// </summary>
        /// <param name="thumbnail">The <see cref="System.Drawing.Bitmap"/>
        /// thumbnail.</param>
        /// <param name="time">The <see cref="TimeSpan">time</see> the thumbnail was
        /// captured.</param>
        /// <param name="fileNum">The file number
        /// (&gt;0 for multi-file <see cref="AVFileSet"/>s).</param>
        /// <param name="fileStartTime">The file start time.</param>
        /// <param name="highlight">if set to <c>true</c> highlight thumbnail border.</param>
        /// <returns>
        ///   <c>true</c> if the page is now full.
        /// </returns>
        public bool Add(System.Drawing.Bitmap thumbnail, TimeSpan time, 
            int fileNum, TimeSpan fileStartTime, bool highlight)
        {
            int x = _tgrid.Layout.Margin + _tgrid.Layout.Border +
                    _currentCol * (_tgrid.ThumbWidth + _tgrid.Layout.Margin +
                                   2*_tgrid.Layout.Border);
            int y = _tgrid.Layout.Height + _tgrid.Layout.Border -
                    (_tgrid.NRows - _currentRow) *
                    (_tgrid.ThumbHeight + _tgrid.Layout.Margin + 2*_tgrid.Layout.Border);

            using (System.Drawing.Imaging.ImageAttributes att =
                        new System.Drawing.Imaging.ImageAttributes ())
                {
                att.SetWrapMode (System.Drawing.Drawing2D.WrapMode.TileFlipXY);

                System.Drawing.Rectangle thumbRect =
                    new System.Drawing.Rectangle (x, y,
                                                _tgrid.ThumbWidth, _tgrid.ThumbHeight);
                System.Drawing.Rectangle borderRect = thumbRect;

                _graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                _graphics.DrawImage (thumbnail,
                                     thumbRect,
                                     0, 0, _tgrid.ThumbWidth, _tgrid.ThumbHeight,
                                     System.Drawing.GraphicsUnit.Pixel,
                                     att);

                thumbRect.Inflate (-_tgrid.Layout.Margin, -_tgrid.Layout.Margin);

                if (_tgrid.Layout.Border > 0)
                    {
                    borderRect.X -= _tgrid.Layout.Border;
                    borderRect.Y -= _tgrid.Layout.Border;
                    borderRect.Width += _tgrid.Layout.Border;
                    borderRect.Height += _tgrid.Layout.Border;

                    //borderRect.Width = borderRect.Width + 1;
                    //borderRect.Height = borderRect.Height + 1;
                    if (highlight)
                        {
                        _graphics.DrawRectangle (_borderHilightPen, borderRect);
                        borderRect.Inflate (1, 1);
                        _graphics.DrawRectangle (_borderHilightPen, borderRect);
                        }
                    else
                        _graphics.DrawRectangle (_borderPen, borderRect);

                    //borderRect.Offset (-1, -1);
                    //_graphics.DrawRectangle (System.Drawing.Pens.Red, borderRect);
                    //borderRect.Offset (2, 2);
                    //_graphics.DrawRectangle (System.Drawing.Pens.Green, borderRect);
                    }

                TimeSpan relativeTime = time - fileStartTime;
                string timeString;
                string timeFormat = @"h\:mm\:ss";

                if (time.Milliseconds > 0)
                    {
                    if (_creator.TNSettings.AlwaysShowMilliseconds || (_pageNum > 0 && fileNum > 0))
                        timeFormat = @"h\:mm\:ss\.ffff";
                    else if (time.Milliseconds >= 500)
                        time += _oneSecond;
                    }
                timeString = time.ToString (timeFormat);

                // Multi-part files
                if (fileNum > 0)
                    {
                    //Detail pages
                    if (_pageNum > 0)
                        {
                        timeFormat = @"h\:mm\:ss";

                        if (relativeTime.Milliseconds > 0)
                            timeFormat = @"h\:mm\:ss\.ffff";
                        timeString += String.Format (" (#{0} {1})", fileNum,
                                                     relativeTime.ToString (timeFormat));
                        }
                    else
                        {
                        if (highlight)
                            {
                            timeString += String.Format (" #{0}", fileNum);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:rm2,项目名称:CLAutoThumbnailer,代码行数:101,代码来源:ThumbnailPage.cs

示例3: OnSizeChanged

        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            System.Drawing.Rectangle DayView = new System.Drawing.Rectangle(ClientRectangle.Location, ClientRectangle.Size);

            DayView.Y = 20;
            DayView.Height -= 20;
            DayView.Inflate(-1, -1);

            m_DayView.Location = DayView.Location;
            m_DayView.Size = DayView.Size;

            Invalidate();
        }
开发者ID:abstractspoon,项目名称:ToDoList_Plugins,代码行数:15,代码来源:DayViewUIExtensionCore.cs


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