预览窗体模板

namespace NLISClient.SSTForm
{
/// <summary>
///
<para>程序名称:SST模板预览窗体</para>
/// <list type="table">

/// <listheader>
///
<term>作者</term><term>日期</term><term>版本</term><term>更改说明</term>

/// <item>
///
<term></term><term>2014-03-3</term><term>V1.0</term><term>创建</term>

/// </item>
/// </listheader>
/// </list>

/// </summary>
public partial class RewardStandardPreForm :
EjectEditBaseForm
{

WCFRewardAndPayService.RewardAndPayServiceClient client = new
WCFRewardAndPayService.RewardAndPayServiceClient();

WCFRewardStandardService.RewardStandardServiceClient clientR = new
WCFRewardStandardService.RewardStandardServiceClient();

WCFPayStandardService.PayStandardServiceClient clientP = new
WCFPayStandardService.PayStandardServiceClient();

DataTable dtItemA = null;//定价表(父)
DataTable dtItemR =
null;//索酬表(子)
DataTable dtItemP = null;//索赔表(子)
int rowP = 0;

int rows = 0;//行数
string LevelRow = "";//每一行的所占行数
string strWhere =
"";

public RewardStandardPreForm(string ID)
{

InitializeComponent();
strWhere = "
RewardAndPayPositionID=" + ID;
}

private void RewardStandardPreForm_Load(object sender, EventArgs
e)
{
GetData();
if (dtItemA.Rows.Count
== 0)
panel.Visible = false;

panel.Refresh();
if (dtItemA.Rows.Count > 0)

{
JSRows();
init();
}

panel.HorizontalScroll.Visible = false;
}

public void GetData()
{

Dictionary<string, string> dicA = new Dictionary<string,
string>();
dicA = client.Search(1, Int32.MaxValue,
"RewardAndPayStatus=1 and" + strWhere);
DataTable _dicA =
NLISClient.UIBase.Helper.TableHelper.DeserializationTable(dicA["table"]);

DataView dv = _dicA.DefaultView;
dv.Sort =
"PositionDepartmentID desc,RewardAndPayPositionID desc";
dtItemA
= dv.ToTable();

Dictionary<string, string> dicR = new Dictionary<string,
string>();
dicR = clientR.Search(1, Int32.MaxValue,
"RewardStandardStatus=1");
dtItemR =
NLISClient.UIBase.Helper.TableHelper.DeserializationTable(dicR["table"]);

Dictionary<string, string> dicP = new Dictionary<string,
string>();
dicP = clientP.Search(1, Int32.MaxValue,
"PayStandardStatus=1");
dtItemP =
NLISClient.UIBase.Helper.TableHelper.DeserializationTable(dicP["table"]);

}

private void init()
{
if
(dtItemA.Rows.Count > 0)
{
DataTable table
= dtItemR;
this.panel.Controls.Clear();

panel.BorderStyle = BorderStyle.None;
panel.CellBorderStyle =
TableLayoutPanelCellBorderStyle.Single;
panel.Refresh();

this.panel.RowCount = rows;

this.panel.RowStyles.Clear();
for (int i = 0; i <
panel.RowCount; i++)
{
string[]
levelRow = LevelRow.Split(‘;‘);

this.panel.RowStyles.Add(new RowStyle(SizeType.Absolute, 23.1F *
Convert.ToInt16(levelRow[i])));
}
int
CurrentRow = -1;
for (int i = 0; i < dtItemA.Rows.Count;
i++)
{
DataRow[] level1 =
dtItemR.Select("RewardStandardRewardPriceID=" +
dtItemA.Rows[i]["RewardAndPayID"]);
DataRow[] level2 =
dtItemP.Select("PayStandardPayPriceID=" +
dtItemA.Rows[i]["RewardAndPayID"]);

CurrentRow++;

Label label_X = new Label();

label_X.Text = (CurrentRow + 1).ToString();//序号列
label_X.Tag =
dtItemA.Rows[i]["RewardAndPayID"].ToString();

label_X.TextAlign = ContentAlignment.MiddleCenter;

label_X.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right)));

label_X.AutoSize = true;

label_X.TextAlign = ContentAlignment.MiddleCenter;

panel.Controls.Add(label_X, 0, CurrentRow);

Label label = new Label();

label.Text = dtItemA.Rows[i]["RewardAndPayItem"].ToString();//服务项目;
label.Tag
= dtItemA.Rows[i]["RewardAndPayID"].ToString();

label.TextAlign = ContentAlignment.MiddleCenter;

label.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right)));

label.AutoSize = true;
label.TextAlign =
ContentAlignment.MiddleCenter;
panel.Controls.Add(label,
1, CurrentRow);

Label label_R = new Label();

label_R.Text = dtItemA.Rows[i]["RewardMoney"].ToString();//索酬定价;
label_R.Tag
= dtItemA.Rows[i]["RewardAndPayID"].ToString();

label_R.TextAlign = ContentAlignment.MiddleCenter;

label_R.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right)));

label_R.AutoSize = true;

label_R.TextAlign = ContentAlignment.MiddleCenter;

panel.Controls.Add(label_R, 2, CurrentRow);

#region 添加表格 索酬标准
if (level1.Length > 0)

{
DataGridView dgv_R = new
DataGridView();
dgv_R.AutoGenerateColumns =
false;
dgv_R.Height = 20 * level1.Length;

dgv_R.ScrollBars = ScrollBars.None;

dgv_R.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
AnchorStyles.Right;
dgv_R.AllowUserToResizeColumns =
false;
dgv_R.AllowUserToResizeRows = false;

dgv_R.AllowUserToAddRows = false;

dgv_R.AllowUserToDeleteRows = false;

dgv_R.BackgroundColor = Color.White;

dgv_R.ColumnHeadersVisible = false;

dgv_R.RowsDefaultCellStyle.SelectionBackColor = Color.AliceBlue;

dgv_R.RowsDefaultCellStyle.SelectionForeColor = Color.Black;

dgv_R.RowHeadersVisible = false;

dgv_R.BorderStyle = BorderStyle.None;

DataGridViewTextBoxColumn dc1 = new
DataGridViewTextBoxColumn();//标准
dc1.Name = dgv_R.Name +
"_RewardStandardItem";
dc1.ReadOnly = true;

dc1.Width = 200;

dgv_R.Columns.Add(dc1);

DataGridViewTextBoxColumn dc2 = new
DataGridViewTextBoxColumn();//百分比
dc2.Name = dgv_R.Name +
"_RewardStandardPercent";
//dc2.Width = 126;

dc2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

dgv_R.Columns.Add(dc2);

dgv_R.Columns[dgv_R.Name +
"_RewardStandardItem"].DataPropertyName = "RewardStandardItem";

dgv_R.Columns[dgv_R.Name + "_RewardStandardPercent"].DataPropertyName
= "_RewardStandardPercent";
DataTable dt_R =
dtItemR.Clone();
for (int j = 0; j <
level1.Length; j++)
{

dt_R.Rows.Add(level1[j].ItemArray);
}

dgv_R.DataSource = dt_R;

panel.Controls.Add(dgv_R, 3, CurrentRow);

dgv_R.Margin = new Padding(0, 0, 0, 0);
}

else
{
DataGridView
dgv_R = new DataGridView();
dgv_R.AutoGenerateColumns
= false;
dgv_R.Height = 20 * level1.Length;

dgv_R.ScrollBars = ScrollBars.None;

dgv_R.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
AnchorStyles.Right;
dgv_R.AllowUserToResizeColumns =
false;
dgv_R.AllowUserToResizeRows = false;

dgv_R.AllowUserToAddRows = false;

dgv_R.AllowUserToDeleteRows = false;

dgv_R.BackgroundColor = Color.White;

dgv_R.ColumnHeadersVisible = false;

dgv_R.RowsDefaultCellStyle.SelectionBackColor = Color.AliceBlue;

dgv_R.RowsDefaultCellStyle.SelectionForeColor = Color.Black;

dgv_R.RowHeadersVisible = false;

dgv_R.BorderStyle = BorderStyle.None;

DataGridViewTextBoxColumn dc1 = new
DataGridViewTextBoxColumn();//标准
dc1.Name = dgv_R.Name +
"_RewardStandardItem";
dc1.ReadOnly = true;

dc1.Width = 200;

dgv_R.Columns.Add(dc1);

DataGridViewTextBoxColumn dc2 = new
DataGridViewTextBoxColumn();//百分比
dc2.Name = dgv_R.Name +
"_RewardStandardPercent";
//dc2.Width = 126;

dc2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

dgv_R.Columns.Add(dc2);

dgv_R.Columns[dgv_R.Name +
"_RewardStandardItem"].DataPropertyName = "RewardStandardItem";

dgv_R.Columns[dgv_R.Name + "_RewardStandardPercent"].DataPropertyName
= "_RewardStandardPercent";
DataTable dt_R =
dtItemR.Clone();
dt_R.Rows.Add(dt_R.NewRow());

dgv_R.DataSource = dt_R;

panel.Controls.Add(dgv_R, 3, CurrentRow);

dgv_R.Margin = new Padding(0, 0, 0, 0);
}

#endregion

Label label_P = new Label();

label_P.Text = dtItemA.Rows[i]["PayMoney"].ToString();//索赔定价;
label_P.Tag =
dtItemA.Rows[i]["RewardAndPayID"].ToString();

label_P.TextAlign = ContentAlignment.MiddleCenter;

label_P.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right)));

label_P.AutoSize = true;

label_P.TextAlign = ContentAlignment.MiddleCenter;

panel.Controls.Add(label_P, 4, CurrentRow);

#region 添加表格 索赔标准
if (level2.Length > 0)

{
DataGridView dgv_P = new
DataGridView();
dgv_P.AutoGenerateColumns =
false;
dgv_P.Height = 20 * level1.Length;

dgv_P.ScrollBars = ScrollBars.None;

dgv_P.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
AnchorStyles.Right;
dgv_P.AllowUserToResizeColumns =
false;
dgv_P.AllowUserToResizeRows = false;

dgv_P.AllowUserToAddRows = false;

dgv_P.AllowUserToDeleteRows = false;

dgv_P.BackgroundColor = Color.White;

dgv_P.ColumnHeadersVisible = false;

dgv_P.RowsDefaultCellStyle.SelectionBackColor = Color.AliceBlue;

dgv_P.RowsDefaultCellStyle.SelectionForeColor = Color.Black;

dgv_P.RowHeadersVisible = false;

dgv_P.BorderStyle = BorderStyle.None;

DataGridViewTextBoxColumn dc1_P = new
DataGridViewTextBoxColumn();//项目
dc1_P.Name = dgv_P.Name +
"_PayStandardItem";
dc1_P.ReadOnly = true;

dc1_P.Width = 201;

dgv_P.Columns.Add(dc1_P);

DataGridViewTextBoxColumn dc2_P = new
DataGridViewTextBoxColumn();//预算
dc2_P.Name = dgv_P.Name +
"_PayStandardPercent";
//dc2.Width = 126;

dc2_P.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

dgv_P.Columns.Add(dc2_P);

dgv_P.Columns[dgv_P.Name +
"_PayStandardItem"].DataPropertyName = "PayStandardItem";

dgv_P.Columns[dgv_P.Name + "_PayStandardPercent"].DataPropertyName =
"_PayStandardPercent";
DataTable dt =
dtItemP.Clone();
for (int j = 0; j <
level2.Length; j++)
{

dt.Rows.Add(level2[j].ItemArray);
}

dgv_P.DataSource = dt;

panel.Controls.Add(dgv_P, 5, CurrentRow);

dgv_P.Margin = new Padding(0, 0, 0, 0);
}

else
{
DataGridView
dgv_P = new DataGridView();
dgv_P.AutoGenerateColumns
= false;
dgv_P.Height = 20 * level1.Length;

dgv_P.ScrollBars = ScrollBars.None;

dgv_P.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom |
AnchorStyles.Right;
dgv_P.AllowUserToResizeColumns =
false;
dgv_P.AllowUserToResizeRows = false;

dgv_P.AllowUserToAddRows = false;

dgv_P.AllowUserToDeleteRows = false;

dgv_P.BackgroundColor = Color.White;

dgv_P.ColumnHeadersVisible = false;

dgv_P.RowsDefaultCellStyle.SelectionBackColor = Color.AliceBlue;

dgv_P.RowsDefaultCellStyle.SelectionForeColor = Color.Black;

dgv_P.RowHeadersVisible = false;

dgv_P.BorderStyle = BorderStyle.None;

DataGridViewTextBoxColumn dc1_P = new
DataGridViewTextBoxColumn();//项目
dc1_P.Name = dgv_P.Name +
"_PayStandardItem";
dc1_P.ReadOnly = true;

dc1_P.Width = 201;

dgv_P.Columns.Add(dc1_P);

DataGridViewTextBoxColumn dc2_P = new
DataGridViewTextBoxColumn();//预算
dc2_P.Name = dgv_P.Name +
"_PayStandardPercent";
//dc2.Width = 126;

dc2_P.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

dgv_P.Columns.Add(dc2_P);

dgv_P.Columns[dgv_P.Name +
"_PayStandardItem"].DataPropertyName = "PayStandardItem";

dgv_P.Columns[dgv_P.Name + "_PayStandardPercent"].DataPropertyName =
"_PayStandardPercent";
DataTable dt =
dtItemP.Clone();
dt.Rows.Add(dt.NewRow());

dgv_P.DataSource = dt;

panel.Controls.Add(dgv_P, 5, CurrentRow);

dgv_P.Margin = new Padding(0, 0, 0, 0);
}

#endregion

}
}
}

private void JSRows()
{
if
(dtItemR.Rows.Count > 0)
{
DataTable table
= dtItemR;

for (int i = 0; i < dtItemA.Rows.Count; i++)

{
DataRow[] level1 =
dtItemR.Select("RewardStandardRewardPriceID=" +
dtItemA.Rows[i]["RewardAndPayID"]);
DataRow[] level2 =
dtItemP.Select("PayStandardPayPriceID=" +
dtItemA.Rows[i]["RewardAndPayID"]);
int row = 0;

if (level1.Length > 0 || level2.Length > 0)

{
row = (level1.Length > level2.Length ?
level1.Length : level2.Length);
}

LevelRow = LevelRow + (row == 0 ? 1 : row) + ";";

rows++;
}

}
}

private void dgv_CellValueChanged(object sender,
DataGridViewCellEventArgs e)
{
DataGridView dgv =
sender as DataGridView;
MessageBox.Show(dgv.Name);

}
}
}

预览窗体模板,布布扣,bubuko.com

时间: 2024-10-12 21:03:56

预览窗体模板的相关文章

C# RDLC报表不出现预览窗体直接输出到打印机

#region 直接打印区域 /// <summary> /// 直接打印到打印机 /// </summary> /// <param name="reportFullFileName"></param> /// <param name="reportTitle"></param> /// <param name="reportDSTable1"></par

dropzonejs中文翻译手册 DropzoneJS是一个提供文件拖拽上传并且提供图片预览的开源类库.

http://wxb.github.io/dropzonejs.com.zh-CN/dropzonezh-CN/ 由于项目需要,完成一个web的图片拖拽上传,也就顺便学习和了解了一下前端的比较新的技术:HTML5的api,作为一名前端的菜鸟,没什么可说的,直接分享自己学习的资料: 关于HTML5 的这些新的特性大家可以到Mozilla的开发者社区MDN https://developer.mozilla.org/zh-CN/ 上查HTML5的资料 还有就是发掘到的比较牛逼的一篇博客:http:/

通过程序预览Office文档

我承认,标题是夸大了,就是为了吸引注意力.这里只有Word文档和Excel文档的预览代码. Word://此部分来源:http://princed.mblogger.cn/posts/11885.aspx//uses ActiveX;procedure TForm1.MenuPreviewClick(Sender: TObject);var    IOO: IOleInPlaceObject ;begin    OleContainer1.DoVerb(ovShow);    if OleCon

根据word模板(contract_templet.tld)生成并下载word合同及根据wordHTML模板(contract_templetHTML.tld)预览合同内容

1.action String templete=ConstantsAppParams.CONTRACT_TEMPLET_DOC;//contract_templet.tldString templeteHtml=ConstantsAppParams.CONTRACT_TEMPLET_HTML;//contract_templetHTML.tld P2pAppInfo pai = (P2pAppInfo) baseLogic.getEntityByPK(P2pAppInfo.class,new

Q:关于Outlook for CRM 中预览记录窗体的设置

问题: 如何在Outlook for CRM中,将实体记录的预览窗口的信息做调整? 解决方案: 在Outlook里,在打开实体后选择View=>Customize Reading Pane,这里可以设置相应节的显示或不显示. 另外,系统管理员也可以设置自己新建的界面内容.

PyCharm 2016.3 公开预览版发布

PyCharm 2016.3 公开预览版发布了,PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Project管理.代码跳转.智能提示.自动完成.单元测试.版本控制.此外,该IDE提供了一些高级功能,以用于支持Django框架下的专业Web开发. PyCharm 2016.3 公开预览版的发布表明 PyCharm 2016.3已进入Beta阶段. 它现在已经是完整的,不会添加任何新功能,专注于修复和改善现有的功能.

C# 打印和打印预览

C#打印和C#打印预览的实现的三大部分:页面设置.打印预览.打印具体用到的类和属性事件都是什么内容呢?那么本文就向你介绍C#打印和C#打印预览的实现具体事宜. 我们谈到C#打印和C#打印预览的实现其中主要就是包括:页面设置.打印预览.打印三大部分.打印的原理是:生成mdi文件,系统碰到mdi的时候会自动以打印的方式处理.所以,不管用什么模板,什么方式:能在PrintPage事件处理中,生成一张要打印内容的图片就OK了!主要的支持类都包括在命名空间System.Drawing.Printing中,

[Aaronyang] 写给自己的WPF4.5 笔记15[AyArc诞生-WPF版本绚丽的环状图,Ay制作,AyWindow强势预览]

 我的文章一定要做到对读者负责,否则就是失败的文章  ---------   www.ayjs.net    aaronyang技术分享 Ay.Framework.WPF-AyWindow强势预览,点击前往 1. AyArcChart效果图:DEMO下载 2. 使用用法: 新建一个WPF项目AyArcChartDemo,并拷贝AyArcChart用户控件xaml,由于我使用的是Arc控件,所以我们还需要引入Expression的部分dll 2.1 绝佳第一次使用 讲解几个ayarc重要的属性 A

基于Metronic的Bootstrap开发框架经验总结(9)--实现Web页面内容的打印预览和保存操作

在前面介绍了很多篇相关的<Bootstrap开发框架>的系列文章,这些内容基本上覆盖到了我这个Bootstrap框架的各个主要方面的内容,总体来说基本达到了一个稳定的状态,随着时间的推移可以会引入一些更好更新的内容进行完善,本篇继续这个系列,主要介绍如何实现Web页面内容的打印预览和保存操作. 1.Web页面打印的问题 在此之前,我一般使用比较好用的LODOP来执行打印的操作,这个在我之前有很多文章都有涉及,这个控件是一个ActiveX的控件,需要下载安装后就可以在页面是进行打印的排版设计,预