• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Entities.RPoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TheArtOfDev.HtmlRenderer.Adapters.Entities.RPoint的典型用法代码示例。如果您正苦于以下问题:C# RPoint类的具体用法?C# RPoint怎么用?C# RPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RPoint类属于TheArtOfDev.HtmlRenderer.Adapters.Entities命名空间,在下文中一共展示了RPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ArcTo

 public override void ArcTo(double x, double y, double size, Corner corner)
 {
     float left = (float)(Math.Min(x, _lastPoint.X) - (corner == Corner.TopRight || corner == Corner.BottomRight ? size : 0));
     float top = (float)(Math.Min(y, _lastPoint.Y) - (corner == Corner.BottomLeft || corner == Corner.BottomRight ? size : 0));
     _graphicsPath.AddArc(left, top, (float)size * 2, (float)size * 2, GetStartAngle(corner), 90);
     _lastPoint = new RPoint(x, y);
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:7,代码来源:GraphicsPathAdapter.cs


示例2: Convert

 /// <summary>
 /// Convert from WPF point to core point.
 /// </summary>
 public static Point[] Convert(RPoint[] points)
 {
     Point[] myPoints = new Point[points.Length];
     for (int i = 0; i < points.Length; i++)
         myPoints[i] = Convert(points[i]);
     return myPoints;
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:10,代码来源:Utils.cs


示例3: RRect

 /// <summary>
 /// Initializes a new instance of the <see cref="RRect" /> class with the specified location and size.
 /// </summary>
 /// <param name="location">A <see cref="RPoint" /> that represents the upper-left corner of the rectangular region.</param>
 /// <param name="size">A <see cref="RSize" /> that represents the width and height of the rectangular region.</param>
 public RRect(RPoint location, RSize size)
 {
     _x = location.X;
     _y = location.Y;
     _width = size.Width;
     _height = size.Height;
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:12,代码来源:RRect.cs


示例4: IsInBox

 /// <summary>
 /// Check if the given location is inside the given box deep.<br/>
 /// Check inner boxes and all lines that the given box spans to.
 /// </summary>
 /// <param name="box">the box to check</param>
 /// <param name="location">the location to check</param>
 /// <returns>true - location inside the box, false - otherwise</returns>
 public static bool IsInBox(CssBox box, RPoint location)
 {
     foreach (var line in box.Rectangles)
     {
         if (line.Value.Contains(location))
             return true;
     }
     foreach (var childBox in box.Boxes)
     {
         if (IsInBox(childBox, location))
             return true;
     }
     return false;
 }
开发者ID:ajinkyakulkarni,项目名称:HTML-Renderer,代码行数:21,代码来源:DomUtils.cs


示例5: PerformLayoutImp

        /// <summary>
        /// Measures the bounds of box and children, recursively.<br/>
        /// Performs layout of the DOM structure creating lines by set bounds restrictions.
        /// </summary>
        /// <param name="g">Device context to use</param>
        protected override void PerformLayoutImp(RGraphics g)
        {
            if (Display == CssConstants.None)
                return;

            RectanglesReset();

            var prevSibling = DomUtils.GetPreviousSibling(this);
            double left = ContainingBlock.Location.X + ContainingBlock.ActualPaddingLeft + ActualMarginLeft + ContainingBlock.ActualBorderLeftWidth;
            double top = (prevSibling == null && ParentBox != null ? ParentBox.ClientTop : ParentBox == null ? Location.Y : 0) + MarginTopCollapse(prevSibling) + (prevSibling != null ? prevSibling.ActualBottom + prevSibling.ActualBorderBottomWidth : 0);
            Location = new RPoint(left, top);
            ActualBottom = top;

            //width at 100% (or auto)
            double minwidth = GetMinimumWidth();
            double width = ContainingBlock.Size.Width
                           - ContainingBlock.ActualPaddingLeft - ContainingBlock.ActualPaddingRight
                           - ContainingBlock.ActualBorderLeftWidth - ContainingBlock.ActualBorderRightWidth
                           - ActualMarginLeft - ActualMarginRight - ActualBorderLeftWidth - ActualBorderRightWidth;

            //Check width if not auto
            if (Width != CssConstants.Auto && !string.IsNullOrEmpty(Width))
            {
                width = CssValueParser.ParseLength(Width, width, this);
            }

            if (width < minwidth || width >= 9999)
                width = minwidth;

            double height = ActualHeight;
            if (height < 1)
            {
                height = Size.Height + ActualBorderTopWidth + ActualBorderBottomWidth;
            }
            if (height < 1)
            {
                height = 2;
            }
            if (height <= 2 && ActualBorderTopWidth < 1 && ActualBorderBottomWidth < 1)
            {
                BorderTopStyle = BorderBottomStyle = CssConstants.Solid;
                BorderTopWidth = "1px";
                BorderBottomWidth = "1px";
            }

            Size = new RSize(width, height);

            ActualBottom = Location.Y + ActualPaddingTop + ActualPaddingBottom + height;
        }
开发者ID:ajinkyakulkarni,项目名称:HTML-Renderer,代码行数:54,代码来源:CssBoxHr.cs


示例6: PaintWords

        /// <summary>
        /// Paint all the words in the box.
        /// </summary>
        /// <param name="g">the device to draw into</param>
        /// <param name="offset">the current scroll offset to offset the words</param>
        private void PaintWords(RGraphics g, RPoint offset)
        {
            if (Width.Length > 0)
            {
                var isRtl = Direction == CssConstants.Rtl;
                foreach (var word in Words)
                {
                    if (!word.IsLineBreak)
                    {
                        var wordPoint = new RPoint(word.Left + offset.X, word.Top + offset.Y);
                        if (word.Selected)
                        {
                            // handle paint selected word background and with partial word selection
                            var wordLine = DomUtils.GetCssLineBoxByWord(word);
                            var left = word.SelectedStartOffset > -1 ? word.SelectedStartOffset : (wordLine.Words[0] != word && word.HasSpaceBefore ? -ActualWordSpacing : 0);
                            var padWordRight = word.HasSpaceAfter && !wordLine.IsLastSelectedWord(word);
                            var width = word.SelectedEndOffset > -1 ? word.SelectedEndOffset : word.Width + (padWordRight ? ActualWordSpacing : 0);
                            var rect = new RRect(word.Left + offset.X + left, word.Top + offset.Y, width - left, wordLine.LineHeight);

                            g.DrawRectangle(GetSelectionBackBrush(g, false), rect.X, rect.Y, rect.Width, rect.Height);

                            if (HtmlContainer.SelectionForeColor != RColor.Empty && (word.SelectedStartOffset > 0 || word.SelectedEndIndexOffset > -1))
                            {
                                g.PushClipExclude(rect);
                                g.DrawString(word.Text, ActualFont, ActualColor, wordPoint, new RSize(word.Width, word.Height), isRtl);
                                g.PopClip();
                                g.PushClip(rect);
                                g.DrawString(word.Text, ActualFont, GetSelectionForeBrush(), wordPoint, new RSize(word.Width, word.Height), isRtl);
                                g.PopClip();
                            }
                            else
                            {
                                g.DrawString(word.Text, ActualFont, GetSelectionForeBrush(), wordPoint, new RSize(word.Width, word.Height), isRtl);
                            }
                        }
                        else
                        {
                            //                            g.DrawRectangle(HtmlContainer.Adapter.GetPen(RColor.Black), wordPoint.X, wordPoint.Y, word.Width - 1, word.Height - 1);
                            g.DrawString(word.Text, ActualFont, ActualColor, wordPoint, new RSize(word.Width, word.Height), isRtl);
                        }
                    }
                }
            }
        }
开发者ID:verdesgrobert,项目名称:HTML-Renderer,代码行数:49,代码来源:CssBox.cs


示例7: DrawPolygon

        public override void DrawPolygon(RBrush brush, RPoint[] points)
        {
            if (points != null && points.Length > 0)
            {
                var g = new StreamGeometry();
                using (var context = g.Open())
                {
                    context.BeginFigure(Util.Convert(points[0]), true);
                    for (int i = 1; i < points.Length; i++)
                        context.LineTo(Util.Convert(points[i]));
                    context.EndFigure(false);
                }

                _g.DrawGeometry(((BrushAdapter)brush).Brush, null, g);
            }
        }
开发者ID:tshcherban,项目名称:Perspex,代码行数:16,代码来源:GraphicsAdapter.cs


示例8: DrawString

 public override void DrawString(string str, RFont font, RColor color, RPoint point, RSize size, bool rtl)
 {
     var text = GetText(str, font);
     text.Constraint = Util.Convert(size);
     _g.DrawText(new SolidColorBrush(Util.Convert(color)), Util.Convert(point), text);
 }
开发者ID:tshcherban,项目名称:Perspex,代码行数:6,代码来源:GraphicsAdapter.cs


示例9: CheckNonEmptySelection

        /// <summary>
        /// Check if the current selection is non empty, has some selection data.
        /// </summary>
        /// <param name="loc"></param>
        /// <param name="allowPartialSelect">true - partial word selection allowed, false - only full words selection</param>
        /// <returns>true - is non empty selection, false - empty selection</returns>
        private bool CheckNonEmptySelection(RPoint loc, bool allowPartialSelect)
        {
            // full word selection is never empty
            if (!allowPartialSelect)
                return true;

            // if end selection location is near starting location then the selection is empty
            if (Math.Abs(_selectionStartPoint.X - loc.X) <= 1 && Math.Abs(_selectionStartPoint.Y - loc.Y) < 5)
                return false;

            // selection is empty if on same word and same index
            return _selectionStart != _selectionEnd || _selectionStartIndex != _selectionEndIndex;
        }
开发者ID:cixonline,项目名称:cixreader,代码行数:19,代码来源:SelectionHandler.cs


示例10: CalculateWordCharIndexAndOffset

        /// <summary>
        /// Calculate the character index and offset by characters for the given word and given offset.<br/>
        /// If the location is below the word line then set the selection to the end.<br/>
        /// If the location is to the right of the word then set the selection to the end.<br/>
        /// If the offset is to the left of the word set the selection to the beginning.<br/>
        /// Otherwise calculate the width of each substring to find the char the location is on.
        /// </summary>
        /// <param name="control">used to create graphics to measure string</param>
        /// <param name="word">the word to calculate its index and offset</param>
        /// <param name="loc">the location to calculate for</param>
        /// <param name="inclusive">is to include the first character in the calculation</param>
        /// <param name="selectionIndex">return the index of the char under the location</param>
        /// <param name="selectionOffset">return the offset of the char under the location</param>
        private static void CalculateWordCharIndexAndOffset(RControl control, CssRect word, RPoint loc, bool inclusive, out int selectionIndex, out double selectionOffset)
        {
            selectionIndex = 0;
            selectionOffset = 0f;
            var offset = loc.X - word.Left;
            if (word.Text == null)
            {
                // not a text word - set full selection
                selectionIndex = -1;
                selectionOffset = -1;
            }
            else if (offset > word.Width - word.OwnerBox.ActualWordSpacing || loc.Y > DomUtils.GetCssLineBoxByWord(word).LineBottom)
            {
                // mouse under the line, to the right of the word - set to the end of the word
                selectionIndex = word.Text.Length;
                selectionOffset = word.Width;
            }
            else if (offset > 0)
            {
                // calculate partial word selection
                int charFit;
                double charFitWidth;
                var maxWidth = offset + (inclusive ? 0 : 1.5f * word.LeftGlyphPadding);
                control.MeasureString(word.Text, word.OwnerBox.ActualFont, maxWidth, out charFit, out charFitWidth);

                selectionIndex = charFit;
                selectionOffset = charFitWidth;
            }
        }
开发者ID:cixonline,项目名称:cixreader,代码行数:42,代码来源:SelectionHandler.cs


示例11: HandleMouseMove

        /// <summary>
        /// Handle mouse move to handle hover cursor and text selection.
        /// </summary>
        /// <param name="parent">the control hosting the html to set cursor and invalidate</param>
        /// <param name="loc">the location of the mouse on the html</param>
        public void HandleMouseMove(RControl parent, RPoint loc)
        {
            if (_root.HtmlContainer.IsSelectionEnabled && _mouseDownInControl && parent.LeftMouseButton)
            {
                if (_mouseDownOnSelectedWord)
                {
                    // make sure not to start drag-drop on click but when it actually moves as it fucks mouse-up
                    if ((DateTime.Now - _lastMouseDown).TotalMilliseconds > 200)
                        StartDragDrop(parent);
                }
                else
                {
                    HandleSelection(parent, loc, !_isDoubleClickSelect);
                    _inSelection = _selectionStart != null && _selectionEnd != null && (_selectionStart != _selectionEnd || _selectionStartIndex != _selectionEndIndex);
                }
            }
            else
            {
                // Handle mouse hover over the html to change the cursor depending if hovering word, link of other.
                var link = DomUtils.GetLinkBox(_root, loc);
                if (link != null)
                {
                    _cursorChanged = true;
                    parent.SetCursorHand();

                    if (link != _lastLink)
                    {
                        _root.HtmlContainer.HandleLinkHover(parent, loc, link);
                        _lastLink = link;
                    }
                }
                else if (_root.HtmlContainer.IsSelectionEnabled)
                {
                    var word = DomUtils.GetCssBoxWord(_root, loc);
                    _cursorChanged = word != null && !word.IsImage && !(word.Selected && (word.SelectedStartIndex < 0 || word.Left + word.SelectedStartOffset <= loc.X) && (word.SelectedEndOffset < 0 || word.Left + word.SelectedEndOffset >= loc.X));
                    if (_cursorChanged)
                        parent.SetCursorIBeam();
                    else
                        parent.SetCursorDefault();
                    _lastLink = null;
                }
                else if (_cursorChanged)
                {
                    parent.SetCursorDefault();
                    _lastLink = null;
                }
            }
        }
开发者ID:cixonline,项目名称:cixreader,代码行数:53,代码来源:SelectionHandler.cs


示例12: OffsetByScroll

 /// <summary>
 /// Adjust the offset of the given location by the current scroll offset.
 /// </summary>
 /// <param name="location">the location to adjust</param>
 /// <returns>the adjusted location</returns>
 private RPoint OffsetByScroll(RPoint location)
 {
     return new RPoint(location.X - ScrollOffset.X, location.Y - ScrollOffset.Y);
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:9,代码来源:HtmlContainerInt.cs


示例13: DrawImage

        /// <summary>
        /// Draw video image over the iframe if found.
        /// </summary>
        private void DrawImage(RGraphics g, RPoint offset, RRect rect)
        {
            if (_imageWord.Image != null)
            {
                if (rect.Width > 0 && rect.Height > 0)
                {
                    if (_imageWord.ImageRectangle == RRect.Empty)
                        g.DrawImage(_imageWord.Image, rect);
                    else
                        g.DrawImage(_imageWord.Image, rect, _imageWord.ImageRectangle);

                    if (_imageWord.Selected)
                    {
                        g.DrawRectangle(GetSelectionBackBrush(g, true), _imageWord.Left + offset.X, _imageWord.Top + offset.Y, _imageWord.Width + 2, DomUtils.GetCssLineBoxByWord(_imageWord).LineHeight);
                    }
                }
            }
            else if (_isVideo && !_imageLoadingComplete)
            {
                RenderUtils.DrawImageLoadingIcon(g, HtmlContainer, rect);
                if (rect.Width > 19 && rect.Height > 19)
                {
                    g.DrawRectangle(g.GetPen(RColor.LightGray), rect.X, rect.Y, rect.Width, rect.Height);
                }
            }
        }
开发者ID:ajinkyakulkarni,项目名称:HTML-Renderer,代码行数:29,代码来源:CssBoxFrame.cs


示例14: DrawPolygon

 /// <summary>
 /// Fills the interior of a polygon defined by an array of points specified by Point structures.
 /// </summary>
 /// <param name="brush">Brush that determines the characteristics of the fill. </param>
 /// <param name="points">Array of Point structures that represent the vertices of the polygon to fill. </param>
 public abstract void DrawPolygon(RBrush brush, RPoint[] points);
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:6,代码来源:RGraphics.cs


示例15: DrawString

 /// <summary>
 /// Draw the given string using the given font and foreground color at given location.
 /// </summary>
 /// <param name="str">the string to draw</param>
 /// <param name="font">the font to use to draw the string</param>
 /// <param name="color">the text color to set</param>
 /// <param name="point">the location to start string draw (top-left)</param>
 /// <param name="size">used to know the size of the rendered text for transparent text support</param>
 /// <param name="rtl">is to render the string right-to-left (true - RTL, false - LTR)</param>
 public abstract void DrawString(String str, RFont font, RColor color, RPoint point, RSize size, bool rtl);
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:10,代码来源:RGraphics.cs


示例16: ClearSelection

        /// <summary>
        /// Clear the current selection.
        /// </summary>
        public void ClearSelection()
        {
            // clear drag and drop
            _dragDropData = null;

            ClearSelection(_root);

            _selectionStartOffset = -1;
            _selectionStartIndex = -1;
            _selectionEndOffset = -1;
            _selectionEndIndex = -1;

            _selectionStartPoint = RPoint.Empty;
            _selectionStart = null;
            _selectionEnd = null;
        }
开发者ID:cixonline,项目名称:cixreader,代码行数:19,代码来源:SelectionHandler.cs


示例17: HandleMouseDown

        /// <summary>
        /// Handle mouse down to handle selection.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="loc">the location of the mouse on the html</param>
        /// <param name="isMouseInContainer"> </param>
        public void HandleMouseDown(RControl parent, RPoint loc, bool isMouseInContainer)
        {
            bool clear = !isMouseInContainer;
            if (isMouseInContainer)
            {
                _mouseDownInControl = true;
                _isDoubleClickSelect = (DateTime.Now - _lastMouseDown).TotalMilliseconds < 400;
                _lastMouseDown = DateTime.Now;
                _mouseDownOnSelectedWord = false;

                if (_root.HtmlContainer.IsSelectionEnabled && parent.LeftMouseButton)
                {
                    var word = DomUtils.GetCssBoxWord(_root, loc);
                    if (word != null && word.Selected)
                    {
                        _mouseDownOnSelectedWord = true;
                    }
                    else
                    {
                        clear = true;
                    }
                }
                else if (parent.RightMouseButton)
                {
                    var rect = DomUtils.GetCssBoxWord(_root, loc);
                    var link = DomUtils.GetLinkBox(_root, loc);
                    if (_root.HtmlContainer.IsContextMenuEnabled)
                    {
                        _contextMenuHandler.ShowContextMenu(parent, rect, link);
                    }
                    clear = rect == null || !rect.Selected;
                }
            }

            if (clear)
            {
                ClearSelection();
                parent.Invalidate();
            }
        }
开发者ID:cixonline,项目名称:cixreader,代码行数:46,代码来源:SelectionHandler.cs


示例18: IsMouseInContainer

 /// <summary>
 /// Check if the mouse is currently on the html container.<br/>
 /// Relevant if the html container is not filled in the hosted control (location is not zero and the size is not the full size of the control).
 /// </summary>
 private bool IsMouseInContainer(RPoint location)
 {
     return location.X >= _location.X && location.X <= _location.X + _actualSize.Width && location.Y >= _location.Y + ScrollOffset.Y && location.Y <= _location.Y + ScrollOffset.Y + _actualSize.Height;
 }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:8,代码来源:HtmlContainerInt.cs


示例19: SelectWord

 /// <summary>
 /// Select the word at the given location if found.
 /// </summary>
 /// <param name="control">the control hosting the html to invalidate</param>
 /// <param name="loc">the location to select word at</param>
 public void SelectWord(RControl control, RPoint loc)
 {
     if (_root.HtmlContainer.IsSelectionEnabled)
     {
         var word = DomUtils.GetCssBoxWord(_root, loc);
         if (word != null)
         {
             word.Selection = this;
             _selectionStartPoint = loc;
             _selectionStart = _selectionEnd = word;
             control.Invalidate();
         }
     }
 }
开发者ID:cixonline,项目名称:cixreader,代码行数:19,代码来源:SelectionHandler.cs


示例20: GetAttributeAt

        /// <summary>
        /// Get attribute value of element at the given x,y location by given key.<br/>
        /// If more than one element exist with the attribute at the location the inner most is returned.
        /// </summary>
        /// <param name="location">the location to find the attribute at</param>
        /// <param name="attribute">the attribute key to get value by</param>
        /// <returns>found attribute value or null if not found</returns>
        public string GetAttributeAt(RPoint location, string attribute)
        {
            ArgChecker.AssertArgNotNullOrEmpty(attribute, "attribute");

            var cssBox = DomUtils.GetCssBox(_root, OffsetByScroll(location));
            return cssBox != null ? DomUtils.GetAttribute(cssBox, attribute) : null;
        }
开发者ID:CapitalCoder,项目名称:HTML-Renderer,代码行数:14,代码来源:HtmlContainerInt.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Entities.RRect类代码示例发布时间:2022-05-26
下一篇:
C# Airlines.Airline类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap