本文整理汇总了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() };
}
示例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);
}
示例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>";
}
}
示例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)
});
}
}
示例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");
}
示例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);
}
示例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();
}
示例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++;
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例15: OnLayoutDeleted
public void OnLayoutDeleted(Layout layout)
{
if (LayoutDeleted != null)
{
LayoutDeleted(new SingleItemEventArgs<Layout>(layout));
}
}