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


C# Panel.Width方法代码示例

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


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

示例1: PlotPanel

        public PlotPanel(RenderState state)
        {
            this.state = state;

            Plot = new Panel();
            Left = new Panel();
            Right = new Panel();
            Top = new Panel();
            Bottom = new Panel();
            Overlay = new Panel();

            Add(Plot);
            Add(Left);
            Add(Right);
            Add(Top);
            Add(Bottom);
            Add(Overlay);

            Plot.SetStroke(Color.Gray, 0.5).SetOrder(100000);

            this.x0 = () => screen.Left;
            this.y0 = () => screen.Top;
            this.x1 = () => screen.Right - 1;
            this.y1 = () => screen.Bottom - 1;

            // flip y axis and put 0 at left
            this.Transform = new Transform
            {
                transform = p => new PointF(p.X - (float)this.x0(), (float)this.y1() - p.Y),
                untransform = p => new PointF(p.X + (float)this.x0(), (float)this.y1() + p.Y)
            };

            Overlay.x0 = () => 0;
            Overlay.y0 = () => 0;
            Overlay.x1 = () => this.Width();
            Overlay.y1 = () => this.Height();

            Overlay.Transform = new Transform
            {
                transform = p => new PointF((float)(p.X * Plot.Width()), (float)(p.Y * Plot.Height())),
                untransform = p => new PointF((float)(p.X / Plot.Width()), (float)(p.Y / Plot.Height()))
            };

            Plot.x0 = () => state.MarginLeft;
            Plot.y0 = () => state.MarginBottom;
            Plot.x1 = () => this.Width() - state.MarginRight;
            Plot.y1 = () => this.Height() - state.MarginTop;

            Plot.Clip = true;

            Plot.Transform = Transform.Range(state.XVisibleRange, state.YVisibleRange).Concat(new Transform
            {
                transform = p => new PointF((float)(p.X * Plot.Width()), (float)(p.Y * Plot.Height())),
                untransform = p => new PointF((float)(p.X / Plot.Width()), (float)(p.Y / Plot.Height()))
            });

            Left.x0 = () => 0;
            Left.y0 = () => state.MarginBottom;
            Left.x1 = () => state.MarginLeft;
            Left.y1 = () => this.Height() - state.MarginTop;

            Left.Transform = Transform.Range(() => Range.Identity, state.YVisibleRange).Concat(new Transform
            {
                transform = p => new PointF((float)(p.X + Left.x1()), (float)(p.Y * Left.Height())),
                untransform = p => new PointF((float)(p.X - Left.x1()), (float)(p.Y / Left.Height()))
            });

            Bottom.x0 = () => state.MarginLeft;
            Bottom.y0 = () => 0;
            Bottom.x1 = () => this.Width() - state.MarginRight;
            Bottom.y1 = () => state.MarginBottom;

            Bottom.Transform = Transform.Range(state.XVisibleRange, () => Range.Identity).Concat(new Transform
            {
                transform = p => new PointF((float)(p.X * Bottom.Width()), (float)(p.Y + Bottom.y1())),
                untransform = p => new PointF((float)(p.X / Bottom.Width()), (float)(p.Y - Bottom.y1()))
            });

            //Right.Transform.Concat(Transform.Range(() =>Range.Identity, env.YVisibleRange));
            //Top.Transform.Concat(Transform.Range(env.XVisibleRange, () => Range.Identity));
        }
开发者ID:jtalbot,项目名称:Labeling,代码行数:81,代码来源:PlotPanel.cs


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