using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Globalization;
using System.Diagnostics;
using EasiReports.Report;
using EasiReports.Metadata;
using EasiReports.Algorithms;
using EasiReports.Controls;
namespace EasiReports
{
/// <summary>
/// Summary description for DlgDataControl.
/// </summary>
internal class CDlgData : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Label lblTable;
private System.Windows.Forms.ComboBox cbTable;
private System.Windows.Forms.Label lblField;
private System.Windows.Forms.ComboBox cbField;
private System.Windows.Forms.Label lblFont;
private System.Windows.Forms.TextBox tbFont;
private System.Windows.Forms.Button btnFont;
private System.Windows.Forms.Label lblBackColour;
private System.Windows.Forms.Button btnBackColour;
private System.Windows.Forms.Panel pnlBackColour;
private System.Windows.Forms.Label lblForeColour;
private System.Windows.Forms.Button btnForeColour;
private System.Windows.Forms.Panel pnlForeColour;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TextBox textTableDescription;
private System.Windows.Forms.TextBox textFieldDescription;
private System.Windows.Forms.ComboBox comboBoxHorizontalAlignment;
private System.Windows.Forms.Label labelHorizontalAlignment;
private System.Windows.Forms.ComboBox comboBoxVerticalAlignment;
private System.Windows.Forms.CheckBox checkBoxVerticalText;
private System.Windows.Forms.Label labelVerticalAlignment;
private System.Windows.Forms.CheckBox checkBoxRightToLeft;
private System.Windows.Forms.Label labelFormat;
private System.Windows.Forms.TextBox textBoxFormat;
private System.Windows.Forms.Button buttonFormat;
private System.Windows.Forms.ComboBox comboAlgorithmLanguage;
private System.Windows.Forms.Label labelAlgorithm;
private System.Windows.Forms.ComboBox comboAlgorithmName;
private System.Windows.Forms.CheckBox checkPrintBackground;
private HelpProvider HelpProvider = new HelpProvider();
private EasiReport _Report = null;
private CMetadata _Metadata = null;
private DataControl _Data = null;
private Font _Font = null;
private DataSelectionHelper _FormatControlAlgorithmHelper = null;
public CDlgData( EasiReport r, DataControl d )
{
InitializeComponent();
HelpProvider.HelpNamespace = Glob.HelpNamespace;
HelpProvider.SetHelpNavigator( this, Glob.HelpNavigator );
HelpProvider.SetHelpKeyword( this, "EasiReporter.Dialogs.Data.htm" );
_Report = r;
_Metadata = r.Metadata;
_Data = d;
_Font = _Data.Font;
_FormatControlAlgorithmHelper = new DataSelectionHelper(
_Report,
AlgorithmsDirector.FormatControlGroup,
_Data.FormatControlAlgorithm,
comboAlgorithmLanguage,
comboAlgorithmName );
}
/// <summary>Clean up any resources being used.</summary>
/// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
/// <remarks>Releases the unmanaged resources and optionally releases the managed resources.</remarks>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CDlgData));
this.lblTable = new System.Windows.Forms.Label();
this.cbTable = new System.Windows.Forms.ComboBox();
this.lblField = new System.Windows.Forms.Label();
this.cbField = new System.Windows.Forms.ComboBox();
this.lblFont = new System.Windows.Forms.Label();
this.tbFont = new System.Windows.Forms.TextBox();
this.btnFont = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.lblBackColour = new System.Windows.Forms.Label();
this.btnBackColour = new System.Windows.Forms.Button();
this.pnlBackColour = new System.Windows.Forms.Panel();
this.lblForeColour = new System.Windows.Forms.Label();
this.btnForeColour = new System.Windows.Forms.Button();
this.pnlForeColour = new System.Windows.Forms.Panel();
this.textTableDescription = new System.Windows.Forms.TextBox();
this.textFieldDescription = new System.Windows.Forms.TextBox();
this.comboBoxHorizontalAlignment = new System.Windows.Forms.ComboBox();
this.labelHorizontalAlignment = new System.Windows.Forms.Label();
this.labelVerticalAlignment = new System.Windows.Forms.Label();
this.comboBoxVerticalAlignment = new System.Windows.Forms.ComboBox();
this.checkBoxVerticalText = new System.Windows.Forms.CheckBox();
this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox();
this.labelFormat = new System.Windows.Forms.Label();
this.textBoxFormat = new System.Windows.Forms.TextBox();
this.buttonFormat = new System.Windows.Forms.Button();
this.comboAlgorithmLanguage = new System.Windows.Forms.ComboBox();
this.labelAlgorithm = new System.Windows.Forms.Label();
this.comboAlgorithmName = new System.Windows.Forms.ComboBox();
this.checkPrintBackground = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// lblTable
//
this.lblTable.Location = new System.Drawing.Point(24, 8);
this.lblTable.Name = "lblTable";
this.lblTable.Size = new System.Drawing.Size(80, 23);
this.lblTable.TabIndex = 0;
this.lblTable.Text = "Table";
//
// cbTable
//
this.cbTable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTable.Location = new System.Drawing.Point(24, 32);
this.cbTable.Name = "cbTable";
this.cbTable.Size = new System.Drawing.Size(192, 21);
this.cbTable.TabIndex = 1;
this.cbTable.SelectedIndexChanged += new System.EventHandler(this.cbTable_SelectedIndexChanged);
//
// lblField
//
this.lblField.Location = new System.Drawing.Point(224, 8);
this.lblField.Name = "lblField";
this.lblField.TabIndex = 2;
this.lblField.Text = "Field";
//
// cbField
//
this.cbField.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbField.Location = new System.Drawing.Point(224, 32);
this.cbField.Name = "cbField";
this.cbField.Size = new System.Drawing.Size(192, 21);
this.cbField.TabIndex = 3;
this.cbField.SelectedIndexChanged += new System.EventHandler(this.cbField_SelectedIndexChanged);
//
// lblFont
//
this.lblFont.Location = new System.Drawing.Point(24, 232);
this.lblFont.Name = "lblFont";
this.lblFont.Size = new System.Drawing.Size(40, 23);
this.lblFont.TabIndex = 15;
this.lblFont.Text = "Font";
//
// tbFont
//
this.tbFont.Location = new System.Drawing.Point(64, 232);
this.tbFont.Name = "tbFont";
this.tbFont.ReadOnly = true;
this.tbFont.Size = new System.Drawing.Size(320, 20);
this.tbFont.TabIndex = 16;
this.tbFont.Text = "tbFont";
//
// btnFont
//
this.btnFont.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnFont.Location = new System.Drawing.Point(384, 232);
this.btnFont.Name = "btnFont";
this.btnFont.Size = new System.Drawing.Size(32, 23);
this.btnFont.TabIndex = 17;
this.btnFont.Text = "...";
this.btnFont.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btnFont.Click += new System.EventHandler(this.btnFont_Click);
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnOK.Location = new System.Drawing.Point(132, 352);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 28;
this.btnOK.Text = "OK";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnCancel.Location = new System.Drawing.Point(236, 352);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 29;
this.btnCancel.Text = "Cancel";
//
// lblBackColour
//
this.lblBackColour.Location = new System.Drawing.Point(24, 272);
this.lblBackColour.Name = "lblBackColour";
this.lblBackColour.Size = new System.Drawing.Size(72, 16);
this.lblBackColour.TabIndex = 18;
this.lblBackColour.Text = "Back Colour";
//
// btnBackColour
//
this.btnBackColour.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnBackColour.Location = new System.Drawing.Point(184, 272);
this.btnBackColour.Name = "btnBackColour";
this.btnBackColour.Size = new System.Drawing.Size(32, 23);
this.btnBackColour.TabIndex = 21;
this.btnBackColour.Text = "...";
this.btnBackColour.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btnBackColour.Click += new System.EventHandler(this.btnBackColour_Click);
//
// pnlBackColour
//
this.pnlBackColour.Location = new System.Drawing.Point(112, 272);
this.pnlBackColour.Name = "pnlBackColour";
this.pnlBackColour.Size = new System.Drawing.Size(72, 24);
this.pnlBackColour.TabIndex = 20;
//
// lblForeColour
//
this.lblForeColour.Location = new System.Drawing.Point(232, 272);
this.lblForeColour.Name = "lblForeColour";
this.lblForeColour.Size = new System.Drawing.Size(80, 16);
this.lblForeColour.TabIndex = 22;
this.lblForeColour.Text = "Fore Colour";
//
// btnForeColour
//
this.btnForeColour.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnForeColour.Location = new System.Drawing.Point(384, 272);
this.btnForeColour.Name = "btnForeColour";
this.btnForeColour.Size = new System.Drawing.Size(32, 23);
this.btnForeColour.TabIndex = 24;
this.btnForeColour.Text = "...";
this.btnForeColour.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btnForeColour.Click += new System.EventHandler(this.btnForeColour_Click);
//
// pnlForeColour
//
this.pnlForeColour.Location = new System.Drawing.Point(312, 272);
this.pnlForeColour.Name = "pnlForeColour";
this.pnlForeColour.Size = new System.Drawing.Size(72, 24);
this.pnlForeColour.TabIndex = 23;
//
// textTableDescription
//
this.textTableDescription.Location = new System.Drawing.Point(24, 64);
this.textTableDescription.Multiline = true;
this.textTableDescription.Name = "textTableDescription";
this.textTableDescription.ReadOnly = true;
this.textTableDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textTableDescription.Size = new System.Drawing.Size(192, 40);
this.textTableDescription.TabIndex = 4;
this.textTableDescription.TabStop = false;
this.textTableDescription.Text = "textTableDescription";
//
// textFieldDescription
//
this.textFieldDescription.Location = new System.Drawing.Point(224, 64);
this.textFieldDescription.Multiline = true;
this.textFieldDescription.Name = "textFieldDescription";
this.textFieldDescription.ReadOnly = true;
this.textFieldDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textFieldDescription.Size = new System.Drawing.Size(192, 40);
this.textFieldDescription.TabIndex = 5;
this.textFieldDescription.TabStop = false;
this.textFieldDescription.Text = "textFieldDescription";
//
// comboBoxHorizontalAlignment
//
this.comboBoxHorizontalAlignment.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxHorizontalAlignment.Items.AddRange(new object[] {
"Left",
"Centre",
"Right"});
this.comboBoxHorizontalAlignment.Location = new System.Drawing.Point(136, 128);
this.comboBoxHorizontalAlignment.Name = "comboBoxHorizontalAlignment";
this.comboBoxHorizontalAlignment.Size = new System.Drawing.Size(80, 21);
this.comboBoxHorizontalAlignment.TabIndex = 7;
//
// labelHorizontalAlignment
//
this.labelHorizontalAlignment.Location = new System.Drawing.Point(24, 128);
this.labelHorizontalAlignment.Name = "labelHorizontalAlignment";
this.labelHorizontalAlignment.Size = new System.Drawing.Size(112, 16);
this.labelHorizontalAlignment.TabIndex = 6;
this.labelHorizontalAlignment.Text = "Horizontal Alignment";
//
// labelVerticalAlignment
//
this.labelVerticalAlignment.Location = new System.Drawing.Point(24, 160);
this.labelVerticalAlignment.Name = "labelVerticalAlignment";
this.labelVerticalAlignment.Size = new System.Drawing.Size(96, 16);
this.labelVerticalAlignment.TabIndex = 8;
this.labelVerticalAlignment.Text = "Vertical Alignment";
//
// comboBoxVerticalAlignment
//
this.comboBoxVerticalAlignment.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxVerticalAlignment.Items.AddRange(new object[] {
"Top",
"Centre",
"Bottom"});
this.comboBoxVerticalAlignment.Location = new System.Drawing.Point(136, 160);
this.comboBoxVerticalAlignment.Name = "comboBoxVerticalAlignment";
this.comboBoxVerticalAlignment.Size = new System.Drawing.Size(80, 21);
this.comboBoxVerticalAlignment.TabIndex = 9;
//
// checkBoxVerticalText
//
this.checkBoxVerticalText.Location = new System.Drawing.Point(256, 160);
this.checkBoxVerticalText.Name = "checkBoxVerticalText";
this.checkBoxVerticalText.TabIndex = 11;
this.checkBoxVerticalText.Text = "Vertical Text";
//
// checkBoxRightToLeft
//
this.checkBoxRightToLeft.Location = new System.Drawing.Point(256, 128);
this.checkBoxRightToLeft.Name = "checkBoxRightToLeft";
this.checkBoxRightToLeft.TabIndex = 10;
this.checkBoxRightToLeft.Text = "Right To Left";
//
// labelFormat
//
this.labelFormat.Location = new System.Drawing.Point(24, 200);
this.labelFormat.Name = "labelFormat";
this.labelFormat.Size = new System.Drawing.Size(40, 23);
this.labelFormat.TabIndex = 12;
this.labelFormat.Text = "Format";
//
// textBoxFormat
//
this.textBoxFormat.Location = new System.Drawing.Point(64, 200);
this.textBoxFormat.Name = "textBoxFormat";
this.textBoxFormat.Size = new System.Drawing.Size(320, 20);
this.textBoxFormat.TabIndex = 13;
this.textBoxFormat.Text = "textBoxFormat";
//
// buttonFormat
//
this.buttonFormat.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonFormat.Location = new System.Drawing.Point(384, 200);
this.buttonFormat.Name = "buttonFormat";
this.buttonFormat.Size = new System.Drawing.Size(32, 23);
this.buttonFormat.TabIndex = 14;
this.buttonFormat.Text = "...";
this.buttonFormat.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.buttonFormat.Click += new System.EventHandler(this.buttonFormat_Click);
//
// comboAlgorithmLanguage
//
this.comboAlgorithmLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboAlgorithmLanguage.Location = new System.Drawing.Point(93, 312);
this.comboAlgorithmLanguage.Name = "comboAlgorithmLanguage";
this.comboAlgorithmLanguage.Size = new System.Drawing.Size(115, 21);
this.comboAlgorithmLanguage.TabIndex = 26;
//
// labelAlgorithm
//
this.labelAlgorithm.Location = new System.Drawing.Point(29, 312);
this.labelAlgorithm.Name = "labelAlgorithm";
this.labelAlgorithm.Size = new System.Drawing.Size(59, 23);
this.labelAlgorithm.TabIndex = 25;
this.labelAlgorithm.Text = "Algorithm";
//
// comboAlgorithmName
//
this.comboAlgorithmName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboAlgorithmName.Location = new System.Drawing.Point(216, 312);
this.comboAlgorithmName.Name = "comboAlgorithmName";
this.comboAlgorithmName.Size = new System.Drawing.Size(200, 21);
this.comboAlgorithmName.TabIndex = 27;
//
// checkPrintBackground
//
this.checkPrintBackground.Location = new System.Drawing.Point(96, 272);
this.checkPrintBackground.Name = "checkPrintBackground";
this.checkPrintBackground.Size = new System.Drawing.Size(16, 24);
this.checkPrintBackground.TabIndex = 19;
//
// CDlgData
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(442, 384);
this.Controls.Add(this.checkPrintBackground);
this.Controls.Add(this.comboAlgorithmLanguage);
this.Controls.Add(this.labelAlgorithm);
this.Controls.Add(this.comboAlgorithmName);
this.Controls.Add(this.checkBoxVerticalText);
this.Controls.Add(this.labelHorizontalAlignment);
this.Controls.Add(this.comboBoxHorizontalAlignment);
this.Controls.Add(this.textFieldDescription);
this.Controls.Add(this.textTableDescription);
this.Controls.Add(this.tbFont);
this.Controls.Add(this.textBoxFormat);
this.Controls.Add(this.lblForeColour);
this.Controls.Add(this.btnForeColour);
this.Controls.Add(this.pnlForeColour);
this.Controls.Add(this.lblBackColour);
this.Controls.Add(this.btnBackColour);
this.Controls.Add(this.pnlBackColour);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnFont);
this.Controls.Add(this.lblFont);
this.Controls.Add(this.cbField);
this.Controls.Add(this.lblField);
this.Controls.Add(this.cbTable);
this.Controls.Add(this.lblTable);
this.Controls.Add(this.labelVerticalAlignment);
this.Controls.Add(this.comboBoxVerticalAlignment);
this.Controls.Add(this.checkBoxRightToLeft);
this.Controls.Add(this.labelFormat);
this.Controls.Add(this.buttonFormat);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "CDlgData";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Data Properties";
this.Load += new System.EventHandler(this.CDlgData_Load);
this.ResumeLayout(false);
}
#endregion
private void CDlgData_Load( object sender, System.EventArgs e )
{
// FillCombo.FillTables( _Metadata, cbTable);
//
// if ( _Data.Source == null )
// try
// {
// cbTable.SelectedIndex = 0;
// }
// catch {}
// else
// cbTable.SelectedItem = _Data.Source;
//
// if ( cbTable.SelectedIndex != -1 )
// FillCombo.FillFields( _Metadata, cbTable.SelectedItem.ToString(), cbField );
//
// if ( _Data.Field == null )
// try
// {
// cbField.SelectedIndex = 0;
// }
// catch {}
// else
// cbField.SelectedItem = _Data.Field;
FillCombo.AddTables( _Report, cbTable );
FillCombo.AddClasses( _Report, AlgorithmsDirector.DataAlgorithmGroup, cbTable );
FillCombo.Select( _Data.DataSelection, cbTable );
textBoxFormat.Text = _Data.FormatString;
if ( _Data.HorizontalAlignment == StringAlignment.Near ) comboBoxHorizontalAlignment.SelectedIndex = 0;
if ( _Data.HorizontalAlignment == StringAlignment.Center ) comboBoxHorizontalAlignment.SelectedIndex = 1;
if ( _Data.HorizontalAlignment == StringAlignment.Far ) comboBoxHorizontalAlignment.SelectedIndex = 2;
if ( _Data.VerticalAlignment == StringAlignment.Near ) comboBoxVerticalAlignment.SelectedIndex = 0;
if ( _Data.VerticalAlignment == StringAlignment.Center ) comboBoxVerticalAlignment.SelectedIndex = 1;
if ( _Data.VerticalAlignment == StringAlignment.Far ) comboBoxVerticalAlignment.SelectedIndex = 2;
checkBoxRightToLeft .Checked = _Data.RightToLeft ;
checkBoxVerticalText.Checked = _Data.VerticalText ;
SetTextBoxFont( _Font );
checkPrintBackground.Checked = _Data.PrintBackground;
pnlBackColour.BackColor = _Data.BackColour;
pnlForeColour.BackColor = _Data.ForeColour;
// switch ( _Data.FormatAlgorithmLanguage )
// {
// case Language.CSharp : comboAlgorithmLanguage.SelectedIndex = 0; break;
// case Language.VBasic : comboAlgorithmLanguage.SelectedIndex = 1; break;
// default: Debug.Assert(false); break;
// }
// comboAlgorithmName.SelectedItem = _Data.FormatAlgorithmName;
_FormatControlAlgorithmHelper.Load();
}
private void SetTextBoxFont( Font f )
{
tbFont.Text = f.Name + ", ";
if ( f.Bold ) tbFont.Text += "Bold, ";
if ( f.Italic ) tbFont.Text += "Italic, ";
tbFont.Text += f.Size.ToString( CultureInfo.CurrentCulture ) + "pt";
tbFont.Font = f;
}
private void cbTable_SelectedIndexChanged(object sender, System.EventArgs e)
{
// FillCombo.FillFields( _Metadata, cbTable.SelectedItem.ToString(), cbField );
// cbField.SelectedIndex = 0;
//
// TableInfo table = _Metadata.GetTable( cbTable.Text );
// if ( table == null ) { Debug.Assert(false); return; }
// textTableDescription.Text = table.Description;
textTableDescription.Text = String.Empty;
cbField.Items.Clear();
textFieldDescription.Text = String.Empty;
DataSelection selection = cbTable.SelectedItem as DataSelection;
if ( selection != null )
{
if ( selection.DataSelectionType == DataSelectionType.Field )
{
TableInfo ti = _Metadata.GetTable( selection.Table );
if ( ti == null ) { Debug.Assert(false); }
else
textTableDescription.Text = ti.Description;
}
FillCombo.AddFields(
_Report,
selection,
AlgorithmsDirector.DataAlgorithmGroup,
cbField );
FillCombo.Select( _Data.DataSelection, cbField );
}
}
private void cbField_SelectedIndexChanged(object sender, System.EventArgs e)
{
// ColumnInfo column = _Metadata.GetColumn( cbTable.Text, cbField.Text );
// if ( column == null ) { Debug.Assert(false); return; }
// textFieldDescription.Text = column.Description;
DataSelection selection = FillCombo.GetDataSelection( cbField );
if ( selection != null )
{
if ( selection.DataSelectionType == DataSelectionType.Field )
{
ColumnInfo ci = _Metadata.GetColumn( selection.Table, selection.Field );
if ( ci == null ) { Debug.Assert(false); }
else
textFieldDescription.Text = ci.Description;
}
}
}
private void buttonFormat_Click(object sender, System.EventArgs e)
{
Type type = typeof( object );
DataSelection selection = FillCombo.GetDataSelection( cbField );
if ( selection != null ) type = selection.ReturnType( _Report );
CDlgFormat dlg = new CDlgFormat( type );
dlg.FormatString = textBoxFormat.Text;
if ( dlg.ShowDialog() != DialogResult.OK ) return;
textBoxFormat.Text = dlg.FormatString;
}
private void btnFont_Click(object sender, System.EventArgs e)
{
FontDialog dlg = new FontDialog();
dlg.Font = _Font;
if ( dlg.ShowDialog() != DialogResult.OK ) return;
_Font = dlg.Font;
SetTextBoxFont( _Font );
}
private void btnBackColour_Click(object sender, System.EventArgs e)
{
ColorDialog dlg = new ColorDialog();
dlg.Color = pnlBackColour.BackColor;
if ( dlg.ShowDialog() != DialogResult.OK ) return;
pnlBackColour.BackColor = dlg.Color;
checkPrintBackground.Checked = ( dlg.Color != _Data.Section.BackColour );
}
private void btnForeColour_Click(object sender, System.EventArgs e)
{
ColorDialog dlg = new ColorDialog();
dlg.Color = pnlForeColour.BackColor;
if ( dlg.ShowDialog() != DialogResult.OK ) return;
pnlForeColour.BackColor = dlg.Color;
}
// private void comboAlgorithmLanguage_SelectedIndexChanged(object sender, System.EventArgs e)
// {
// switch ( comboAlgorithmLanguage.SelectedIndex )
// {
// case 0:
// FillCombo.FillFormatControlAlgorithms( _Report.CSharpAlgorithms, comboAlgorithmName );
// break;
//
// case 1:
// FillCombo.FillFormatControlAlgorithms( _Report.VBasicAlgorithms, comboAlgorithmName );
// break;
//
// default:
// Debug.Assert(false);
// comboAlgorithmName.Items.Clear();
// break;
// }
// }
private void btnOK_Click(object sender, System.EventArgs e)
{
// _Data.Source = cbTable.Text;
// _Data.Field = cbField.Text;
DataSelection selection = cbField.SelectedItem as DataSelection;
if ( selection == null ) Debug.Assert( false );
else
_Data.DataSelection = new DataSelection ( selection );
_Data.FormatString = textBoxFormat.Text;
switch ( comboBoxHorizontalAlignment.SelectedIndex )
{
case 0: _Data.HorizontalAlignment = StringAlignment.Near ; break;
case 1: _Data.HorizontalAlignment = StringAlignment.Center ; break;
case 2: _Data.HorizontalAlignment = StringAlignment.Far ; break;
default: Debug.Assert(false); break;
}
switch ( comboBoxVerticalAlignment.SelectedIndex )
{
case 0: _Data.VerticalAlignment = StringAlignment.Near ; break;
case 1: _Data.VerticalAlignment = StringAlignment.Center ; break;
case 2: _Data.VerticalAlignment = StringAlignment.Far ; break;
default: Debug.Assert(false); break;
}
_Data.RightToLeft = checkBoxRightToLeft .Checked;
_Data.VerticalText = checkBoxVerticalText.Checked;
_Data.Font = new FontEX( _Font );
_Data.PrintBackground = checkPrintBackground.Checked;
_Data.BackColour = pnlBackColour.BackColor;
_Data.ForeColour = pnlForeColour.BackColor;
// switch ( comboAlgorithmLanguage.SelectedIndex )
// {
// case 0: _Data.FormatAlgorithmLanguage = Language.CSharp; break;
// case 1: _Data.FormatAlgorithmLanguage = Language.VBasic; break;
// default: Debug.Assert(false); break;
// }
// _Data.FormatAlgorithmName = comboAlgorithmName.Text;
// if ( comboAlgorithmName.Text == "<none>" ) _Data.FormatAlgorithmName = "";
_Data.FormatControlAlgorithm = _FormatControlAlgorithmHelper.GetDataSelection();
}
}
}