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


C# Canvas.DrawFillRect方法代码示例

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


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

示例1: OnRender

        public override void OnRender(Canvas c)
        {

            c.DrawFillRect(_client_area, _background_color_material);
            _font.DrawText(null, _text, ClientArea, DrawTextFormat.VerticalCenter | DrawTextFormat.Center, ForegroundColor);

            c.DrawRect(_client_area, BorderColor);
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:8,代码来源:PanelLabel.cs

示例2: OnRender

        public override void OnRender(Canvas c)
        {
                SetViewportDimensions(_panel_area);
                StartViewport(c);
            lock(this) {
                if (MenuOptions != null)
                {
                    c.DrawFillRect(_client_area, _background_color_material);
                    if (MenuOptions.Length > 0)
                    {
                        int height = 0;
                        int width = 0;

                        if ((_layout == PanelLayout.Vertical) || (_layout == PanelLayout.Horizontal))
                        {
                            height = _client_area.Height / MenuOptions.Length;
                            width = _client_area.Width / MenuOptions.Length;
                        }

                        for (int i = 0; i < MenuOptions.Length; i++)
                        {
                            switch (_layout)
                            {
                                case PanelLayout.Vertical:
                                    MenuLocations[i].X = StartX;
                                    MenuLocations[i].Y = StartY + (i * height);
                                    MenuLocations[i].Width = _client_area.Width;
                                    MenuLocations[i].Height = height - 2;
                                    break;
                                case PanelLayout.Horizontal:
                                    MenuLocations[i].X = StartX + (i * width);
                                    MenuLocations[i].Y = StartY;
                                    MenuLocations[i].Width = width - 2;
                                    MenuLocations[i].Height = _client_area.Height;
                                    break;
                                case PanelLayout.HorizontalFree:
                                    MenuLocations[i].X = StartX + width;
                                    MenuLocations[i].Y = StartY;
                                    MenuLocations[i].Height = _client_area.Height;
                                    width += MenuLocations[i].Width;
                                    break;
                                case PanelLayout.VerticalFree:
                                    MenuLocations[i].X = StartX;
                                    MenuLocations[i].Y = StartY + height;
                                    MenuLocations[i].Width = _client_area.Width;
                                    height += MenuLocations[i].Height;
                                    break;
                                default:
                                    throw new ArgumentException("Unsupported Layout type.");
                            }

                            if (i != _selected_index)
                            {
                                _font.DrawText(null, MenuOptions[i], MenuLocations[i], DrawFormat, ForegroundColor);
                            }
                            else
                            {
                                _font.DrawText(null, MenuOptions[i], MenuLocations[i], DrawFormat, Color.Yellow);
                            }
                        }
                    }
                }
                    EndViewport(c);

                    switch (_layout)
                    {
                        case PanelLayout.Horizontal:
                            goto case PanelLayout.HorizontalFree;
                        case PanelLayout.HorizontalFree:
                            if (_panel_area.Width < _menu_item_height)
                            {
                                    c.DrawFillRect(_left_button_area, _button_material);
                                if (!HideLeftScrollBtn)
                                {
                                    if ((_draw_bounding_box == BoundingBox.LEFT))
                                    {
                                        c.DrawFillTri(_left_arrow, _arrow_selected, DIRECTION.LEFT);
                                    }
                                    else
                                    {
                                        c.DrawFillTri(_left_arrow, _arrow_material, DIRECTION.LEFT);
                                    }
                                }
                                    c.DrawFillRect(_right_button_area, _button_material);
                                if (!HideRightScrollBtn)
                                {
                                    if ((_draw_bounding_box == BoundingBox.RIGHT))
                                    {
                                        c.DrawFillTri(_right_arrow, _arrow_selected, DIRECTION.RIGHT);
                                    }
                                    else
                                    {
                                        c.DrawFillTri(_right_arrow, _arrow_material, DIRECTION.RIGHT);
                                    }
                                }
                            }
                            break;
                        case PanelLayout.Vertical:
                            goto case PanelLayout.VerticalFree;
                        case PanelLayout.VerticalFree:
//.........这里部分代码省略.........
开发者ID:wshanshan,项目名称:DDD,代码行数:101,代码来源:PanelMenu.cs

示例3: OnRender

        public override void OnRender(Canvas c)
        {
            if ((_font != null) && !Hide)
            {
                c.DrawFillRect(_client_area, _background_material);

                _slider_area.Width = _client_area.Width - 18;
                _slider_area.Height = Height;

                _txt_area = _font.MeasureString(null, _percent, DrawTextFormat.None, ForegroundColor);
                _font.DrawText(null, _percent, _client_area, DrawTextFormat.Center | DrawTextFormat.Top, ForegroundColor);

                _left_arrow.X = _client_area.Left;
                _left_arrow.Y = _client_area.Y + _txt_area.Height + 1;
                _left_arrow.Width = 8;
                _left_arrow.Height = _slider_area.Height;
                c.DrawFillTri(_left_arrow, _arrow_material, DIRECTION.LEFT);

                _slider_area.X = _left_arrow.Right + 1;
                _slider_area.Y = _client_area.Y + _txt_area.Height + 1;
                c.DrawProgressBar(_slider_area, _slider_background_material, _slider_foreground_material, _slider_position);

                _right_arrow.X = _slider_area.Right + 1;
                _right_arrow.Y = _client_area.Y + _txt_area.Height + 1;
                _right_arrow.Width = 8;
                _right_arrow.Height = _slider_area.Height;
                c.DrawFillTri(_right_arrow, _arrow_material, DIRECTION.RIGHT);

                c.DrawRect(_client_area, BorderColor);
            }
            
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:32,代码来源:PanelSlider.cs

示例4: OnRender

        public override void OnRender(Canvas c)
        {

            c.DrawFillRect(_client_area, BackgroundMaterial);
            _font.DrawText(null, _text, ClientArea, DrawTextFormat.VerticalCenter | DrawTextFormat.Center, ForegroundColor);

            if (Selected)
            {
                DrawBoundingBox(c);
            }
            else
            {
                c.DrawRect(_client_area, BorderColor);
            }
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:15,代码来源:PanelStaticButton.cs


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