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


C# Box.SetSize方法代码示例

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


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

示例1: Example_01

    public Example_01()
    {
        FileStream fos = new FileStream("Example_01.pdf", FileMode.Create);
        BufferedStream bos = new BufferedStream(fos);

        PDF pdf = new PDF(bos);
        pdf.setCompressor(Compressor.ORIGINAL_ZLIB);

        Page page = new Page(pdf, Letter.PORTRAIT);

        Box flag = new Box();
        flag.SetPosition(100.0, 100.0);
        flag.SetSize(190.0, 100.0);
        flag.SetColor(RGB.WHITE);
        flag.DrawOn(page);

        double sw = 7.69;   // stripe width
        Line stripe = new Line(0.0, sw/2, 190.0, sw/2);
        stripe.SetWidth(sw);
        stripe.SetColor(RGB.OLD_GLORY_RED);
        for (int row = 0; row < 7; row++) {
            stripe.PlaceIn(flag, 0.0, row * 2 * sw);
            stripe.DrawOn(page);
        }

        Box union = new Box();
        union.SetSize(76.0, 53.85);
        union.SetColor(RGB.OLD_GLORY_BLUE);
        union.SetFillShape(true);
        union.PlaceIn(flag, 0.0, 0.0);
        union.DrawOn(page);

        double h_si = 12.6; // horizontal star interval
        double v_si = 10.8; // vertical star interval
        Point star = new Point(h_si/2, v_si/2);
        star.SetShape(Point.STAR);
        star.SetRadius(3.0);
        star.SetColor(RGB.WHITE);
        star.SetFillShape(true);

        for (int row = 0; row < 6; row++) {
            for (int col = 0; col < 5; col++) {
                star.PlaceIn(union, row * h_si, col * v_si);
                star.DrawOn(page);
            }
        }
        star.SetPosition(h_si, v_si);
        for (int row = 0; row < 5; row++) {
            for (int col = 0; col < 4; col++) {
                star.PlaceIn(union, row * h_si, col * v_si);
                star.DrawOn(page);
            }
        }

        pdf.Flush();
        bos.Close();
    }
开发者ID:pauljs,项目名称:Justin-Paul-s-Projects,代码行数:57,代码来源:Example_01.cs

示例2: Example_02

    public Example_02()
    {
        FileStream fos = new FileStream("Example_02.pdf", FileMode.Create);
        BufferedStream bos = new BufferedStream(fos);

        PDF pdf = new PDF(bos);
        pdf.setCompressor(Compressor.ORIGINAL_ZLIB);

        Page page = new Page(pdf, Letter.PORTRAIT);

        Box flag = new Box(85, 85, 64, 32);

        PDFjet.NET.Path path = new PDFjet.NET.Path();
        path.Add(new Point(13.0,  0.0));
        path.Add(new Point(15.5,  4.5));
        path.Add(new Point(18.0,  3.5));

        path.Add(new Point(15.5, 13.5, Point.IS_CURVE_POINT));
        path.Add(new Point(15.5, 13.5, Point.IS_CURVE_POINT));
        path.Add(new Point(20.5,  7.5, Point.IS_CURVE_POINT));

        path.Add(new Point(21.0,  9.5));
        path.Add(new Point(25.0,  9.0));
        path.Add(new Point(24.0, 13.0));
        path.Add(new Point(25.5, 14.0));
        path.Add(new Point(19.0, 19.0));
        path.Add(new Point(20.0, 21.5));
        path.Add(new Point(13.5, 20.5));
        path.Add(new Point(13.5, 27.0));
        path.Add(new Point(12.5, 27.0));
        path.Add(new Point(12.5, 20.5));
        path.Add(new Point( 6.0, 21.5));
        path.Add(new Point( 7.0, 19.0));
        path.Add(new Point( 0.5, 14.0));
        path.Add(new Point( 2.0, 13.0));
        path.Add(new Point( 1.0,  9.0));
        path.Add(new Point( 5.0,  9.5));
        path.Add(new Point( 5.5,  7.5));

        path.Add(new Point(10.5, 13.5, Point.IS_CURVE_POINT));
        path.Add(new Point(10.5, 13.5, Point.IS_CURVE_POINT));
        path.Add(new Point( 8.0,  3.5, Point.IS_CURVE_POINT));

        path.Add(new Point(10.5,  4.5));
        path.setClosePath(true);
        path.SetColor(RGB.RED);
        path.SetFillShape(true);
        path.PlaceIn(flag, 19.0, 3.0);
        path.DrawOn(page);

        Box box = new Box();
        box.SetSize(16, 32);
        box.SetColor(RGB.RED);
        box.SetFillShape(true);
        box.PlaceIn(flag, 0.0, 0.0);
        box.DrawOn(page);
        box.PlaceIn(flag, 48.0, 0.0);
        box.DrawOn(page);

        path.ScaleBy(15.0);
        path.SetFillShape(false);
        path.DrawOn(page);

        pdf.Flush();
        bos.Close();
    }
开发者ID:pauljs,项目名称:Justin-Paul-s-Projects,代码行数:66,代码来源:Example_02.cs

示例3: ResetGroup

    public ResetGroup(float width)
    {
        this.width = width;

        AddChild(plusBox = new MathBox(MathType.Plus));
        AddChild(minusBox = new MathBox(MathType.Minus));

        AddChild(zeroBox = new ZeroBox());

        AddChild(cancelBox = new SpriteBox(Player.NullPlayer,"Icons/Cancel",100,100));
        AddChild(okBox = new SpriteBox(Player.NullPlayer,"Icons/Checkmark",100,100));

        plusBox.hasFastRepeatZones = true;
        minusBox.hasFastRepeatZones = true;

        if(PlayerPrefs.HasKey(PREFS_KEY))
        {
            zeroBox.resetAmount = PlayerPrefs.GetInt(PREFS_KEY);
        }

        float boxSize = Config.SLOT_HEIGHT;
        float padding = Config.PADDING_S;

        plusBox.SetSize(boxSize,boxSize);
        minusBox.SetSize(boxSize,boxSize);
        zeroBox.SetSize(width-boxSize*2-padding*2,boxSize);

        plusBox.SetPosition(zeroBox.width/2 + padding + plusBox.width/2, padding/2 + plusBox.height/2);
        minusBox.SetPosition(-zeroBox.width/2 - padding - minusBox.width/2, padding/2 + minusBox.height/2);
        zeroBox.SetPosition(0,padding/2 + zeroBox.height/2);

        cancelBox.SetSize((width-padding)/2,boxSize);
        okBox.SetSize((width-padding)/2,boxSize);

        cancelBox.SetPosition(-padding/2 - cancelBox.width/2, -padding/2 - cancelBox.height/2);
        okBox.SetPosition(padding/2 + okBox.width/2, -padding/2 - okBox.height/2);

        minusBox.SignalTick += (b,ticks) =>
        {
            zeroBox.resetAmount -= ticks;
            UpdateResetAmount();
        };

        plusBox.SignalTick += (b,ticks) =>
        {
            zeroBox.resetAmount += ticks;
            UpdateResetAmount();
        };

        zeroBox.SignalRelease += (b) =>
        {
            zeroBox.DoTapEffect();
            FSoundManager.PlaySound("UI/ResetToZero");
            zeroBox.resetAmount = 0;
            UpdateResetAmount();
        };

        cancelBox.SignalRelease += (b) =>
        {
            Keeper.instance.slotList.ApplyResetScores(false);
            cancelBox.isTouchable = false;
            cancelBox.DoTapEffect();
            Keeper.instance.EndResetMode();
            FSoundManager.PlaySound("UI/Cancel");
        };

        okBox.SignalRelease += (b) =>
        {
            Keeper.instance.slotList.ApplyResetScores(true);
            okBox.isTouchable = false;
            okBox.DoTapEffect();
            Keeper.instance.EndResetMode();
            FSoundManager.PlaySound("UI/ResetOk");

            SKDataManager.MarkDirty();
        };

        UpdateResetAmount();

        instance = this;
    }
开发者ID:MattRix,项目名称:ScorekeeperX,代码行数:81,代码来源:ResetGroup.cs


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