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


C# Layout类代码示例

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


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

示例1: ReportPdf

        public ReportPdf(Stream Output, Layout Layout, Template Template, Dictionary<string, string> ConfigParams)
            : base(Output, Layout, Template, ConfigParams)
        {
            Rectangle pageSize = new Rectangle(mm2pt(Template.PageSize.Width), mm2pt(Template.PageSize.Height));

            // Initialization
            m_Document = new Document(pageSize, mm2pt(Template.Margin.Left), mm2pt(Template.Margin.Right), mm2pt(Template.Margin.Top), mm2pt(Template.Margin.Bottom));
            m_Writer = PdfWriter.GetInstance(m_Document, Output);

            m_Document.AddCreationDate();
            m_Document.AddCreator("StrengthReport http://dev.progterv.info/strengthreport) and KeePass (http://keepass.info)");
            m_Document.AddKeywords("report");
            m_Document.AddTitle(Layout.Title+" (report)");

            // Header
            HeaderFooter header = new HeaderFooter(new Phrase(Layout.Title+", "+DateTime.Now.ToString(), m_Template.ReportFooter.getFont()), false);
            header.Alignment = Template.ReportFooter.getAlignment();
            m_Document.Header = header;

            // Footer
            HeaderFooter footer = new HeaderFooter(new Phrase(new Chunk("Page ", m_Template.ReportFooter.getFont())), new Phrase(new Chunk(".", m_Template.ReportFooter.getFont())));
            footer.Alignment = Template.ReportFooter.getAlignment();
            m_Document.Footer = footer;

            // TODO: Metadata
            // Open document
            m_Document.Open();

            // Report Heading
            {
                PdfPTable reportTitle = new PdfPTable(1);
                PdfPCell titleCell = new PdfPCell(new Phrase(Layout.Title, m_Template.ReportHeader.getFont()));
                titleCell.Border = 0;
                titleCell.FixedHeight = mm2pt(m_Template.ReportHeader.Height);
                titleCell.VerticalAlignment = Element.ALIGN_MIDDLE;
                titleCell.HorizontalAlignment = m_Template.ReportHeader.getAlignment();
                reportTitle.AddCell(titleCell);
                reportTitle.WidthPercentage = 100;
                m_Document.Add(reportTitle);
            }

            // Create main table
            m_Table = new PdfPTable(Layout.GetColumnWidths());
            m_Table.WidthPercentage = 100;
            m_Table.HeaderRows = 1;
            foreach (LayoutElement element in Layout) {
                PdfPCell cell = new PdfPCell(new Phrase(element.Title, m_Template.Header.getFont()));
                cell.BackgroundColor = m_Template.Header.Background.ToColor();
                cell.MinimumHeight = mm2pt(m_Template.Header.Height);
                cell.VerticalAlignment = Element.ALIGN_MIDDLE;
                m_Table.AddCell(cell);
            }

            m_colorRow = new CMYKColor[] { m_Template.Row.BackgroundA.ToColor(), m_Template.Row.BackgroundB.ToColor() };
        }
开发者ID:jonbws,项目名称:strengthreport,代码行数:55,代码来源:ReportPdf.cs

示例2: AddRude

 public void AddRude(Layout l, Station s)
 {
     base.Add(s);
     this.m_htDBID2Station[s.ID] = s;
     this.m_htName2Station[s.ID] = s;
     s.InitAfterLoad(l);
 }
开发者ID:belsoft,项目名称:traingraph,代码行数:7,代码来源:Stations.cs

示例3: btn_Click

    protected void btn_Click(object sender, EventArgs e)
    {
        try
        {
            // Para finalizar o Reg<T> trata um unico registro
            // a Classe 'Layout' é capaz de identificar e gerar multiplos tipos de registros      
            // este exemplo é otimo para comparar linhas geradas e assim fazer um DEBUG

            Layout l;
            if (rblTipo.SelectedIndex == 0) // remessa
                //l = new Layout(typeof(CNAB400Header1Bradesco), typeof(CNAB400Remessa1Bradesco), typeof(CNAB400ArquivoTrailer));
                l = new Layout(typeof(CNAB240HeaderLoteCaixa), typeof(CNAB240SegmentoPCaixa), typeof(CNAB240SegmentoQCaixa));
            else // retorno
                // l = new Layout(typeof(CNAB400Header1Bradesco), typeof(CNAB400Retorno1Bradesco), typeof(CNAB400ArquivoTrailer));
                l = new Layout(typeof(CNAB400SantanderHeader), typeof(CNAB400SantanderRemessa1), typeof(CNAB400SantanderTrailer));

            l.Conteudo = txt.Text;
            lbl.Text = "Processo OK";

            dtg1.DataSource = l.Table(l.GetLayoutType(0));
            dtg1.DataBind();

            dtg2.DataSource = l.Table(l.GetLayoutType(1));
            dtg2.DataBind();

            dtg3.DataSource = l.Table(l.GetLayoutType(2));
            dtg3.DataBind();

            lbl.Text = "Grids OK";
        }
        catch (Exception ex)
        {
            lbl.Text = ex.Message + "<pre>" + ex.StackTrace + "</pre>";
        }
    }
开发者ID:impactro,项目名称:Boleto-ASP.NET,代码行数:35,代码来源:Exemplo5-Layout.aspx.cs

示例4: DelimitedFileTests

        public DelimitedFileTests()
        {
            layout = new Layout<TestObject>.DelimitedLayout()
                    .WithDelimiter(";")
                    .WithQuote("\"")
                    .HeaderLines(2)
                    .WithMember(o => o.Id, set => set.WithLength(5).WithLeftPadding('0'))
                    .WithMember(o => o.Description, set => set.WithLength(25).WithRightPadding(' '))
                    .WithMember(o => o.NullableInt, set => set.WithLength(5).AllowNull("=Null").WithLeftPadding('0'))
                    .WithMember(o => o.NullableEnum, set => set.WithLength(10).AllowNull("").WithLeftPadding(' '))
                    .WithMember(o => o.Date, set => set.WithFormat(new CultureInfo("pt-PT")));

            DateTime now = DateTime.UtcNow;
            objects = new List<TestObject>();
            for (int i = 1; i <= 10; i++)
            {
                objects.Add(new TestObject
                {
                    Id = i,
                    Description = "Description " + i,
                    NullableInt = i % 5 == 0 ? null : (int?)3,
                    NullableEnum = i % 3 == 0 ? null : (Gender?)(i % 3),
                    Date = now.AddDays(i)
                });
            }
        }
开发者ID:kappy,项目名称:FlatMapper,代码行数:26,代码来源:DelimitedFileTests.cs

示例5: LayoutConstructorTest

 public void LayoutConstructorTest()
 {
     string layout_file = string.Empty; // TODO: Initialize to an appropriate value
     DirectoryInfo project_dir = null; // TODO: Initialize to an appropriate value
     Layout target = new Layout(layout_file, project_dir);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:fparaggio,项目名称:WindSimBattery,代码行数:7,代码来源:LayoutTest.cs

示例6: Awake

    public void Awake()
    {
        spriteBranco = hexPrefab.GetComponent<SpriteRenderer>().sprite;
        spritePreto = hexPreto.GetComponent<SpriteRenderer>().sprite;

        m_layout = new Layout(m_layout.orientation, new Vector2(hexPrefab.GetComponent<SpriteRenderer>().bounds.size.x / 2, hexPrefab.GetComponent<SpriteRenderer>().bounds.size.x / 2), m_layout.origin);
    }
开发者ID:vittis,项目名称:hexsum-experiments,代码行数:7,代码来源:GraphicCampo.cs

示例7: RocketCommanderGame_Mouse_Test

        public void RocketCommanderGame_Mouse_Test()
        {
            var game = new TestGame();

            Layout layout = null;
            game.Initialized += (o, e) =>
                {
                    layout = new Layout("MouseState", game.Framework.AssetManager)
                    {
                        DestRect = new Rectangle(0.0f, 0.1f, 1.0f, 1.0f)
                    };

                    var mouseBlock = new TextBlock(layout, game.Framework.AssetManager)
                    {
                        Font = game.Framework.AssetManager.DefaultFont,
                        Foreground = Color.Red,
                        Name = "MouseBlock"
                    };

                    game.AddLayout(layout);
                };
            game.Mouse.MouseMove += (o, e) =>
                {
                    var mouseBlock = layout.GetElement("MouseBlock") as TextBlock;
                    mouseBlock.Text = game.Mouse.Position.ToString();
                };

            game.Run();
        }
开发者ID:HaKDMoDz,项目名称:Irelia,代码行数:29,代码来源:RocketCommanderGameTest.cs

示例8: SetLayout

        public void SetLayout(Rectangle windowSize, Layout layout)
        {
            int h = Position.Height / _elements.Count;
            int c = 0;
            Rectangle pos = new Rectangle();

            if (layout == Layout.LeftAlign)
            {
                pos = Position;
                foreach (TextSprite ts in _elements)
                {
                    pos.Y += c * h;
                    ts.setRelatvePos(pos, windowSize.Width, windowSize.Height);
                    c++;
                }
            }
            else if (layout == Layout.MiddleAlign)
            {
                pos = Position;
                foreach (TextSprite ts in _elements)
                {
                    pos.Y += c * h;
                    pos.Width = (int)(((float)h / ts.GetOriginalTextSize().Y) * ts.GetOriginalTextSize().X);
                    pos.X = Position.X + Position.Width / 2 - pos.Width / 2;
                    if (pos.X < Position.X)
                    {
                        pos.X = Position.X;
                        pos.Width = Position.Width;
                    }
                    ts.setRelatvePos(pos, windowSize.Width, windowSize.Height);
                    c++;
                }
            }
        }
开发者ID:Nicomplex,项目名称:The-Revenge-Of-the-Dark-Side,代码行数:34,代码来源:MultipleTextSprite.cs

示例9: Render

        public void Render(Layout layout, ProviderFactory loader)
        {
            int resolution = GetValue<int>("resolution");

              var size = layout.GetPageSizeInPixels(resolution);
              var composed = new Image(size.ToDimensions(), ImageBaseType.Rgb);

              if (layout.Render(loader,
            new ImageRenderer(layout, composed, resolution)))
            ;

              // Fix me: check next couple of lines!
            #if false
            DialogState = DialogStateType.SrcImgValid;
              else
            DialogState = DialogStateType.SrcImgInvalid;
            #endif
              if (GetValue<bool>("flatten"))
            {
              composed.Flatten();
            }

              if (GetValue<int>("color_mode") == 0) // ColorMode.GRAY)
            {
              composed.ConvertGrayscale();
            }

              new Display(composed);
              Display.DisplaysFlush();
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:30,代码来源:Renderer.cs

示例10: GetWidth

		protected float GetWidth(Layout option, Rect rect)
		{
			if (option != null && option.width.HasValue)
				return option.width.Value;

			return width.HasValue ? width.Value : rect.width;
		}
开发者ID:srndpty,项目名称:VFW,代码行数:7,代码来源:GUIBlock.cs

示例11: ReportAbstract

 /// <summary>
 /// Creates a new ReportAbstract, it used in children as base() when contructing.
 /// </summary>
 /// <param name="Filename">The output file's path</param>
 /// <param name="layout">The layout (list of columns) of the report.</param>
 /// <param name="ConfigParams">Misc configuration parameters vary for each ReportFormat</param>
 public ReportAbstract(Stream output, Layout layout, Template template, Dictionary<string, string> configParams)
 {
     m_Output       = output;
     m_Layout       = layout;
     m_Template     = template;
     m_ConfigParams = configParams;
 }
开发者ID:jonbws,项目名称:strengthreport,代码行数:13,代码来源:ReportAbstract.cs

示例12: btnTest_Click

 protected void btnTest_Click(object sender, EventArgs e)
 {
     Layout lay = new Layout(typeof(NFeV2detalhe));
     lay.Conteudo = txtIn.Text;
     gv.DataSource = lay.Table(typeof(NFeV2detalhe));
     gv.DataBind();
 }
开发者ID:impactro,项目名称:Boleto-ASP.NET,代码行数:7,代码来源:RPS-Retorno1.aspx.cs

示例13: Enter

        public override void Enter()
        {
            this.layout = this.framework.AssetManager.Load(@"RocketCommander\GUI\Help.layout") as Layout;
            this.game.AddLayout(this.layout);

            GetButton("BackButton").MouseLeftButtonDown += backButton_MouseLeftButtonDown;
        }
开发者ID:HaKDMoDz,项目名称:Irelia,代码行数:7,代码来源:HelpScreen.cs

示例14: OpenDiv

        private void OpenDiv(Layout layout, bool writeHorizontalAlign, bool writeWrapping) {
            WriteBeginTag("div");
            if (writeHorizontalAlign) {
                String alignment;
                switch (layout.Align) {
                case HorizontalAlign.Right:
                    alignment = "text-align:right";
                    break;

                case HorizontalAlign.Center:
                    alignment = "text-align:center";
                    break;

                default:
                    alignment = "text-align:left";
                    break;
                }

                WriteAttribute("style", alignment);
            }
            if (writeWrapping) {
                WriteAttribute("mode",
                               layout.Wrap == true ? "wrap" : "nowrap");
            }
            Write('>');
            _currentWrittenLayout = layout;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:27,代码来源:HTMLTextWriter.cs

示例15: OnLayoutDeleted

 public void OnLayoutDeleted(Layout layout)
 {
     if (LayoutDeleted != null)
     {
         LayoutDeleted(new SingleItemEventArgs<Layout>(layout));
     }
 }
开发者ID:wezmag,项目名称:BetterCMS,代码行数:7,代码来源:LayoutEvents.cs


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