- myneoreport_bin.zip
- Designer
- app.config
- BuildInfo.cs
- Docs
- Forms
- FwDetector.cs
- Icons
- barcode.ico
- bringtofront.ico
- bullet.ico
- checksql_24.png
- config2_16.ico
- connection.ico
- copyToClipboard.ico
- custom.ico
- databarcode.ico
- dataimage.ico
- db.ico
- dblabel.ico
- Details.ico
- download.ico
- error.ico
- error_tl.ico
- fileassociation.ico
- folder.ICO
- Group.ico
- GroupSection.ico
- i16.ico
- image.ico
- label16.ico
- movedown.ico
- moveitem.ico
- moveup.ico
- MyDesigner.ico
- MyReport.ico
- MyReport2.ico
- MyViewer.ico
- PageFooter.ico
- PageHeader.ico
- print.ico
- Props16.ico
- redo.ico
- Refresh.ico
- Remove.ico
- report.ico
- ReportFooter.ico
- ReportHeader.ico
- save16.ico
- Section.ico
- SectionTemplate.ico
- sendtoback.ico
- shape.ico
- table.ico
- Thumbs.db
- undo.ico
- w16.ico
- x16.ico
- MyDesigner.ico
- MyNRDesigner.csproj
- MyNRDesigner.sln
- Program.cs
- Properties
- Settings.cs
- UI
- Undo
- Mr6UpdateSupport
- NeoDataType.LiveCodeEngine.dll
- NeoDataType.MyNeoReport.dll
- NeoDataType.Serialization.1.2.dll
- readme.txt
- UpdateMr5.exe
- MyNRDesigner.exe
- MyNRViewer.exe
- neodatatype.license.txt
- NeoDataType.LiveCodeEngine.dll
- NeoDataType.MyNeoReport.dll
- NeoDataType.MyNeoReport.XML
- upgradeinfo.txt
- myneoreport_designers_src.zip
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using NeoDataType.MyNeoReport;
// This is to avoid ambiguity between
// System.Windows.Form.Label/Image and NeoDataType.MyNeoReport.Label/Image
using Rpt = NeoDataType.MyNeoReport;
namespace SimpleDesigner
{
public partial class MainForm : Form
{
Report _report = new Report();
Section _workingSection;
const string FILE_FILTER = "MyNeoReport Documents|*.mr5|" +
"All files|*.*";
public MainForm()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
pageControl1.SetPage(_report.Page);
}
private void showPreviewToolStripMenuItem_Click(object sender, EventArgs e)
{
// Select the destination printer
_report.ShowPrinterDialog();
// Show the preview
_report.ShowPreview();
}
private void addGroupSectionToolStripMenuItem_Click(object sender, EventArgs e)
{
// TODO: Set the grouping fields
string fieldList = "";
GroupSection groupSection = _report.Page.AddGroupSection();
groupSection.GroupFieldList = fieldList;
}
private void addLabelToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_workingSection != null)
{
Rpt.Label label = _workingSection.AddLabel();
// Example of how you can control the item via code:
// - Set the text
label.Text = "Label added at " + DateTime.Now.ToString();
// - Set horizontal autosize
label.HorizontalSizeMode = TextHorizontalSizeMode.TextWidth;
}
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
// Clear the page and sections
_report.Page.Clear();
}
private void bringToFrontToolStripMenuItem_Click(object sender, EventArgs e)
{
_report.Page.SelectedItem.BringToFront();
}
private void sendToBackSelectedItemToolStripMenuItem_Click(object sender, EventArgs e)
{
_report.Page.SelectedItem.SendToBack();
}
private void addImageToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_workingSection != null)
{
Rpt.Image image = _workingSection.AddImage();
if (_report.FileName.Length > 0)
{
// You can embed the image into the report setting
// image.UseImageFile = false (default), otherwise
// the report will search for the physical file.
image.UseImageFile = true;
// One way to load images...
// You can also set it just passing the
// image data to image.RawImage
// {@ReportPath} is a special embedded function
// as described in the NeoDataType forum:
// http://www.neodatatype.net/forum/topic.asp?TOPIC_ID=149
image.ImageFile = "{@ReportPath}\\neodatatype_logo.png";
}
}
}
private void toolStripComboBox1_Click(object sender, EventArgs e)
{
}
private void pageControl1_ItemSelected(object sender, ItemSelectedEventArgs e)
{
propertyGrid1.SelectedObject = e.Item;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openFile = new OpenFileDialog();
openFile.FileName = "";
openFile.Filter = FILE_FILTER;
if (openFile.ShowDialog() == DialogResult.OK)
{
_report.LoadFrom(openFile.FileName);
// Force the refresh of the Page control
pageControl1.SetPage(_report.Page);
}
openFile.Dispose();
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_report.FileName.Length > 0)
{
SaveFileDialog saveFile = new SaveFileDialog();
saveFile.FileName = _report.FileName;
saveFile.Filter = FILE_FILTER;
if (saveFile.ShowDialog() == DialogResult.OK)
{
_report.SaveTo(saveFile.FileName);
}
saveFile.Dispose();
}
}
private void deleteBringToFrontSelectedItemToolStripMenuItem_Click(object sender, EventArgs e)
{
// Get the selected Item
ItemBase selectedItem = _report.Page.SelectedItem;
// Remove it from its section
selectedItem.Section.RemoveItem(selectedItem);
}
private void addShapeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_workingSection != null)
{
Shape shape = _workingSection.AddShape();
// Example of how you can control the item via code:
// - Set the shape to be drawn
shape.ShapeType = ShapeType.RoundRectangle;
// - Use antialias: this can be useful for rotated items
shape.AntiAlias = true;
}
}
private void addDataLabelToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_workingSection != null)
{
// This show that you can add an item also by a new istance:
DataLabel dataLabel = new DataLabel();
// Example of how you can control the item via code:
// - Set the datafield on which the datalabel is binded
dataLabel.DataField = "ProductName";
_workingSection.AddItem(dataLabel);
}
}
private void addDataImageToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_workingSection != null)
{
// This show that you can add an item also by a new istance:
DataImage dataImage = new DataImage();
// Example of how you can control the item via code:
// - Set the datafield on which the dataImage is binded
// This field can be a simple blob field containing
// a raw image (in for of byte array) or an OLE picture
dataImage.DataField = "Picture";
_workingSection.AddItem(dataImage);
}
}
private void setDetailsConnectionStringToolStripMenuItem_Click(object sender, EventArgs e)
{
// Default datasource is OleDbDataSource that let you connect to OleDb providers.
// You can choose to pass data to a datasource changing it to a TableDataSource
// with section.ChangeDatasourceType(DataSourceType.UseDataTable)
OleDbDataSource dataSource = (OleDbDataSource)_report.Page.Details.DataSource;
dataSource.ShowConnectionStringWizard();
propertyGrid1.SelectedObject = _report.Page.Details.DataSource;
MessageBox.Show("Now you need to edit the SQLText property of the Details DataSource in the property grid",
"Details Datasource", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void selectTheWorkingSectionToolStripMenuItem_Click(object sender, EventArgs e)
{
// Set the working section
BrowseSectionForm sectionListForm = new BrowseSectionForm(_report.Page);
if (sectionListForm.ShowDialog() == DialogResult.OK)
{
_workingSection = sectionListForm.SelectedSection;
selectTheWorkingSectionToolStripMenuItem.Text = "Select the working section [" + _workingSection.Name + "]";
propertyGrid1.SelectedObject = _workingSection;
}
sectionListForm.Dispose();
}
private void moveSelectedItemToTheSectionToolStripMenuItem_Click(object sender, EventArgs e)
{
// Set the destination section
BrowseSectionForm sectionListForm = new BrowseSectionForm(_report.Page);
if (sectionListForm.ShowDialog() == DialogResult.OK)
{
_report.Page.SelectedItem.MoveToSection(sectionListForm.SelectedSection);
}
sectionListForm.Dispose();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.