本文整理汇总了C#中Page.GetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Page.GetMetadata方法的具体用法?C# Page.GetMetadata怎么用?C# Page.GetMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.GetMetadata方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadPanel
/// <summary>
/// Loads the current panel
/// </summary>
private void LoadPanel(Page page)
{
DataRow row = page.GetMetadata().GetPageSetupData(page.GetView());
if (_fieldPanel != null)
{
foreach (Control control in _fieldPanel.Controls)
{
control.Font = null; //GDI Memory leak
}
}
_fieldPanel = new Panel();
float dpiX;
Graphics graphics = _fieldPanel.CreateGraphics();
dpiX = graphics.DpiX;
try
{
int height = (int)row["Height"];
int width = (int)row["Width"];
if (dpiX != 96)
{
float scaleFactor = (dpiX * 1.041666666f) / 100;
height = Convert.ToInt32(((float)height) * (float)scaleFactor);
width = Convert.ToInt32(((float)width) * (float)scaleFactor);
}
if (row["Orientation"].ToString() == "Landscape")
{
_fieldPanel.Size = new System.Drawing.Size(height, width);
}
else
{
_fieldPanel.Size = new System.Drawing.Size(width, height);
}
canvas.Size = _fieldPanel.Size;
canvas.SetPanelProperties(_fieldPanel);
currentPage = page;
ControlFactory factory = ControlFactory.Instance;
canvas.canvasPanel.Size = new Size(_fieldPanel.Size.Width, _fieldPanel.Size.Height);
List<Control> controls = factory.GetPageControls(page, canvas.canvasPanel.Size);
canvas.AddControlsToPanel(controls, _fieldPanel);
SetZeeOrderOfGroups(_fieldPanel);
_fieldPanel.Visible = false;
_fieldPanel.SendToBack();
foreach (Control controlOnPanel in _fieldPanel.Controls)
{
if (controlOnPanel is DataGridView)
{
((DataGridView)controlOnPanel).DataSource = null;
}
}
while (canvas.canvasPanel.Controls.Count > 0)
canvas.canvasPanel.Controls[0].Dispose();//User Handles Memory leak
// canvas.canvasPanel.Controls.Clear();
canvas.canvasPanel.Controls.Add(_fieldPanel);
}
finally
{
}
}
示例2: SetFocusToFirstControl
/// <summary>
/// Sets the focus to the first input control on the current panel
/// </summary>
/// <param name="currentPage">The current page</param>
/// <param name="currentPanel">The current panel</param>
public void SetFocusToFirstControl(Page currentPage, Panel currentPanel)
{
#region Input Validation
if (currentPage == null)
{
throw new ArgumentNullException("Epi.Windows.Enter.SetFocusToFirstControl currentPage is null");
}
if (currentPanel == null)
{
throw new ArgumentNullException("Epi.Windows.Enter.SetFocusToFirstControl currentPanel is null");
}
#endregion //Input Validation
double minTabIndex = currentPage.GetMetadata().GetMinTabIndex(currentPage.Id, currentPage.GetView().Id);
if (minTabIndex != -1)
{
foreach (Control control in currentPanel.Controls)
{
if (control is TextBox || control is RichTextBox || control is CheckBox || control is ComboBox || control is MaskedTextBox || control is Button)
{
Epi.Windows.Enter.PresentationLogic.ControlFactory factory = Epi.Windows.Enter.PresentationLogic.ControlFactory.Instance;
Field field = factory.GetAssociatedField(control);
((RenderableField)field).Tag = "";
}
}
foreach (Control control in currentPanel.Controls)
{
if (control is TextBox || control is RichTextBox || control is CheckBox || control is ComboBox || control is MaskedTextBox || control is Button)
{
Epi.Windows.Enter.PresentationLogic.ControlFactory factory = Epi.Windows.Enter.PresentationLogic.ControlFactory.Instance;
Field field = factory.GetAssociatedField(control);
if (((RenderableField)field).TabIndex == minTabIndex)
{
if (control.Enabled)
{
// The problem with calling SetFocusToControl directly is that
// later on, other controls steal the focus in ways that we
// cannot control. This theft has unintended side-effects, e.g
// running check code in ways that aren't desired, and/or the focus
// doesn't actually get placed in the first field of the page in
// some cases. By invoking the method, we pass it to the message queue
// and it is run after the other focus-stealing events are called.
// EK 12/7/2010
this.BeginInvoke(new MethodInvoker(delegate() { SetFocusToControl(control, field); }));
((RenderableField)field).Tag = "tabbed";
return;
}
else
{
GoToNextControl(currentPage, currentView, control);
}
}
}
}
}
}
示例3: ChangeBackgroundData
public void ChangeBackgroundData(Page page)
{
int color;
if (page != null)
{
this.bgTable = page.GetMetadata().GetPageBackgroundData(page);
DataRow[] rows = bgTable.Select("BackgroundId = " + page.BackgroundId);
if (rows.Length > 0)
{
color = Convert.ToInt32(rows[0]["Color"]);
if (rows[0]["Image"] != System.DBNull.Value)
{
try
{
byte[] imageBytes = ((byte[])rows[0]["Image"]);
using (MemoryStream memStream = new MemoryStream(imageBytes.Length))
{
memStream.Seek(0, SeekOrigin.Begin);
memStream.Write(imageBytes, 0, imageBytes.Length);
memStream.Seek(0, SeekOrigin.Begin);
this.currentBackgroundImage = Image.FromStream(((Stream)memStream));
}
}
catch
{
this.currentBackgroundImage = null;
}
}
else
{
this.currentBackgroundImage = null;
}
this.currentBackgroundImageLayout = Convert.ToString(rows[0]["ImageLayout"]);
if (color == 0)
{
this.currentBackgroundColor = SystemColors.Window;
}
else
{
this.currentBackgroundColor = Color.FromArgb(color);
}
}
else
{
this.currentBackgroundImage = null;
this.currentBackgroundImageLayout = "None";
this.currentBackgroundColor = SystemColors.Window;
}
}
else
{
this.currentBackgroundImage = null;
this.currentBackgroundImageLayout = "None";
this.currentBackgroundColor = SystemColors.Window;
}
}
示例4: GoToNextControl
/// <summary>
/// Sets the focus of the next control depending upon the tab index
/// </summary>
/// <param name="currentPage">The current page</param>
/// <param name="currentView">The current panel</param>
/// <param name="currentControl">The current control that is losing focus</param>
public void GoToNextControl(Page currentPage, View currentView, Control currentControl)
{
#region Input Validation
if (currentPage == null)
{
throw new ArgumentNullException("Current Page");
}
if (currentPanel == null)
{
throw new ArgumentNullException("Current Panel");
}
if (currentControl == null)
{
throw new ArgumentException("Control");
}
#endregion //Input Validation
Epi.Windows.Enter.PresentationLogic.ControlFactory factory = Epi.Windows.Enter.PresentationLogic.ControlFactory.Instance;
Field currentField = factory.GetAssociatedField(currentControl);
if (currentField == null)
{
return;
}
double currentTabIndex = ((RenderableField)currentField).TabIndex;
double nextTabIndex = currentPage.GetMetadata().GetNextTabIndex(currentPage, currentView, currentTabIndex);
double maxTabIndex = currentPage.GetMetadata().GetMaxTabIndex(currentPage.Id, currentView.Id, false);
foreach (Control control in currentPanel.Controls)
{
if (control is TextBox || control is RichTextBox || control is CheckBox || control is ComboBox || control is Button || control is MaskedTextBox || control is GroupBox || control is DateTimePicker)
{
Field field = factory.GetAssociatedField(control);
if (((RenderableField)field).TabIndex == nextTabIndex || ((RenderableField)field).TabIndex == currentTabIndex & control != currentControl & ((RenderableField)field).Tag == "")
{
if (!control.Visible || !control.Enabled) //if hidden by check code command or disabled due to read only property being set
{
if (control.TabIndex != maxTabIndex)
{
GoToNextControl(currentPage, currentView, control);
}
}
((RenderableField)field).Tag ="tabbed";
this.EnableTabToNextControl = false;
if (control.Focused && this.IsEventEnabled)
{
control_Enter(control, new EventArgs());
}
else if((control is GroupBox) == false)
{
control.Focus();
}
if (control is TextBoxBase)
{
((TextBoxBase)control).SelectAll();
}
if ((control is TextBox || control is RichTextBox || control is ComboBox || control is MaskedTextBox || control is DateTimePicker) &&
(field is InputFieldWithSeparatePrompt))
{
if (((InputFieldWithSeparatePrompt)field).IsRequired)
{
control.CausesValidation = true;
}
else
{
control.CausesValidation = false;
}
if (field is DateField)
{
if (((DateField)field).Upper.Length + ((DateField)field).Lower.Length > 0)
{
control.CausesValidation = true;
}
}
}
else if(control is GroupBox )
{
control.Controls[0].Focus();
}
this.EnableTabToNextControl = false;
return;
}
}
//.........这里部分代码省略.........