private void DoFull() { grid1.Redim(20, 4); grid1.FixedRows = 1; grid1[0, 0] = new MyHeader("1"); grid1[0, 0].ColumnSpan = 3; grid1[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); grid1[0, 3] = new MyHeader("2"); grid1[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); for (int r = 1; r < grid1.RowsCount; r++) { if (r % 2 == 0) { grid1[r, 0] = new SourceGrid.Cells.Cell("nospan" + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell("span" + r.ToString(), typeof(string)); grid1[r, 1].ColumnSpan = 2; } else { grid1[r, 0] = new SourceGrid.Cells.Cell("span" + r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.Cell("nospan" + r.ToString(), typeof(string)); } grid1[r, 3] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span" + r.ToString(), false); } grid1.AutoSizeCells(); }
public void DoFill(List<PriceCate> list) { PriceCateGrid.Redim(0, 0); PriceCateGrid.FixedRows = 1; PriceCateGrid.FixedColumns = 1; PriceCateGrid.EnableSort = true; PriceCateGrid.Redim(list.Count + 1, 7); PriceCateGrid.Rows[0].Height = 25; PriceCateGrid[0, 0] = new MyHeader("描述"); PriceCateGrid[0, 0].Column.Width = 200; PriceCateGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 1] = new MyHeader("价格1"); PriceCateGrid[0, 1].Column.Width = 150; PriceCateGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 2] = new MyHeader("价格2"); PriceCateGrid[0, 2].Column.Width = 150; PriceCateGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 3] = new MyHeader("价格3"); PriceCateGrid[0, 3].Column.Width = 150; PriceCateGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 4] = new MyHeader("价格4"); PriceCateGrid[0, 4].Column.Width = 150; PriceCateGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 5] = new MyHeader("价格5"); PriceCateGrid[0, 5].Column.Width = 150; PriceCateGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 6] = new MyHeader("状态"); PriceCateGrid[0, 6].Column.Width = 80; PriceCateGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (PriceCate item in list) { PriceCateGrid.Rows[r].Tag = item.Id; PriceCateGrid.Rows[r].Height = 25; PriceCateGrid[r, 0] = new SourceGrid.Cells.Cell(item.CateName); PriceCateGrid[r, 0].AddController(clickEvent); string p1 = item.UsePrice1 ? item.Price1Name + ": " + item.Price1Val : ""; PriceCateGrid[r, 1] = new SourceGrid.Cells.Cell(p1); PriceCateGrid[r, 1].AddController(clickEvent); string p2 = item.UsePrice2 ? item.Price2Name + ": " + item.Price2Val : ""; PriceCateGrid[r, 2] = new SourceGrid.Cells.Cell(p2); PriceCateGrid[r, 2].AddController(clickEvent); string p3 = item.UsePrice3 ? item.Price3Name + ": " + item.Price3Val : ""; PriceCateGrid[r, 3] = new SourceGrid.Cells.Cell(p3); PriceCateGrid[r, 3].AddController(clickEvent); string p4 = item.UsePrice4 ? item.Price4Name + ": " + item.Price4Val : ""; PriceCateGrid[r, 4] = new SourceGrid.Cells.Cell(p4); PriceCateGrid[r, 4].AddController(clickEvent); string p5 = item.UsePrice5 ? item.Price5Name + ": " + item.Price5Val : ""; PriceCateGrid[r, 5] = new SourceGrid.Cells.Cell(p5); PriceCateGrid[r, 5].AddController(clickEvent); string status = item.Status == "A" ? "启用" : "未启用"; PriceCateGrid[r, 6] = new SourceGrid.Cells.Button(status); PriceCateGrid[r, 6].AddController(clickEvent); r++; } PriceCateGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
protected void Grid_Risk_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) //如果是表头 { foreach (TableCell MyHeader in e.Row.Cells) //对每一单元格 { if (MyHeader.HasControls()) { if (((LinkButton)MyHeader.Controls[0]).CommandArgument == Grid_Risk.SortExpression) { //是否为排序列 if (Grid_Risk.SortDirection == SortDirection.Ascending) //依排序方向加入方向箭头 { MyHeader.Controls.Add(new LiteralControl("▲")); } else { MyHeader.Controls.Add(new LiteralControl("▼")); } } } } } }
public static void Main() { try { // <Snippet1> // MyHeader class is derived from the SoapHeader class. MyHeader customHeader = new MyHeader(); customHeader.MyValue = "Header value for MyValue"; // Set the EncodedMustUnderstand property to true. customHeader.EncodedMustUnderstand = "1"; WebService_SoapHeader_EncodedMustUnderstand myWebService = new WebService_SoapHeader_EncodedMustUnderstand(); myWebService.MyHeaderValue = customHeader; string results = myWebService.MyWebMethod1(); Console.WriteLine(results); try { results = myWebService.MyWebMethod2(); } catch (Exception myException) { Console.WriteLine("Exception raised in MyWebMethod2."); Console.WriteLine("Message: " + myException.Message); } // </Snippet1> } catch (Exception e) { Console.WriteLine("Exception caught!"); Console.WriteLine("Source: " + e.Source); Console.WriteLine("Message: " + e.Message); } }
public void DoFill(List<FinDetails> list) { FinGrid.Redim(0, 0); FinGrid.EnableSort = true; FinGrid.Redim(list.Count + 2, 6); FinGrid.Rows[0].Height = 25; FinGrid[0, 0] = new MyHeader("序号"); FinGrid[0, 0].Column.Width = 50; FinGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); FinGrid[0, 1] = new MyHeader("时间"); FinGrid[0, 1].Column.Width = 80; FinGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); FinGrid[0, 2] = new MyHeader("描述"); FinGrid[0, 2].Column.Width = 250; FinGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); FinGrid[0, 3] = new MyHeader("金额"); FinGrid[0, 3].Column.Width = 100; FinGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); FinGrid[0, 4] = new MyHeader("收支类型"); FinGrid[0, 4].Column.Width = 70; FinGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); FinGrid[0, 5] = new MyHeader("备注"); FinGrid[0, 5].Column.Width = 200; SourceGrid.Cells.Views.Cell view; int r = 1; double TotalAmount = 0; foreach (FinDetails detail in list) { TotalAmount = TotalAmount + detail.TotalAmount; FinGrid.Rows[r].Tag = detail.FinId; FinGrid.Rows[r].Height = 22; FinGrid[r, 0] = new SourceGrid.Cells.Cell(r.ToString()); FinGrid[r, 1] = new SourceGrid.Cells.Cell(detail.FinDate); FinGrid[r, 2] = new SourceGrid.Cells.Cell(detail.Description); FinGrid[r, 3] = new SourceGrid.Cells.Cell(detail.TotalAmount.ToString("#,##0.00")); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(detail.TotalAmount); FinGrid[r, 3].View = view; FinGrid[r, 4] = new SourceGrid.Cells.Cell(detail.EventType); FinGrid[r, 5] = new SourceGrid.Cells.Cell(detail.Remark); r++; } for (int i = 0; i < 6; i++) { FinGrid[r, i] = new SourceGrid.Cells.Cell(""); } FinGrid[r, 2] = new SourceGrid.Cells.Cell("合计"); FinGrid[r, 3] = new SourceGrid.Cells.Cell(TotalAmount.ToString("#,##0.00")); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(TotalAmount); FinGrid[r, 3].View = view; FinGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public static void Main() { MyWebService ws = new MyWebService(); try { MyHeader customHeader = new MyHeader(); customHeader.MyValue = "Header Value for MyValue"; customHeader.Actor = "http://www.contoso.com/MySoapHeaderHandler"; ws.myHeader = customHeader; int results = ws.MyWebMethod(3, 5); } catch (Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); } }
public static void Main() { MyWebService ws = new MyWebService(); try { MyHeader customHeader = new MyHeader(); customHeader.MyValue = "Header Value for MyValue"; customHeader.MustUnderstand = true; ws.myHeader = customHeader; int results = ws.MyWebMethod(3, 5); } catch (Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); } }
public void DoFill(List<Supplier> list) { SupplierGrid.Redim(0, 0); SupplierGrid.FixedRows = 1; SupplierGrid.FixedColumns = 1; SupplierGrid.EnableSort = true; SupplierGrid.Redim(list.Count + 1, 5); SupplierGrid.Rows[0].Height = 25; SupplierGrid[0, 0] = new MyHeader("公司"); SupplierGrid[0, 0].Column.Width = 250; SupplierGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 1] = new MyHeader("联系人"); SupplierGrid[0, 1].Column.Width = 200; SupplierGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 2] = new MyHeader("备注"); SupplierGrid[0, 2].Column.Width = 300; SupplierGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 3] = new MyHeader("地址"); SupplierGrid[0, 3].Column.Width = 200; SupplierGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 4] = new MyHeader(""); SupplierGrid[0, 4].Column.Width = 100; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (Supplier item in list) { SupplierGrid.Rows[r].Tag = item.Id; SupplierGrid.Rows[r].Height = 35; SupplierGrid[r, 0] = new SourceGrid.Cells.Cell(item.Name); SupplierGrid[r, 0].AddController(clickEvent); SupplierGrid[r, 1] = new SourceGrid.Cells.Cell(item.Contact); SupplierGrid[r, 1].AddController(clickEvent); SupplierGrid[r, 2] = new SourceGrid.Cells.Cell(item.Remark); SupplierGrid[r, 2].AddController(clickEvent); SupplierGrid[r, 3] = new SourceGrid.Cells.Cell(item.Address); SupplierGrid[r, 3].AddController(clickEvent); SupplierGrid[r, 4] = new SourceGrid.Cells.Link("产品列表"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(CellButton_Click); SupplierGrid[r, 4].Controller.AddController(buttonClickEvent); r++; } SupplierGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Page_Load(object sender, EventArgs e) { FormSession.FillSession("", null); try { Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) + 2) + "; URL=../Login.aspx"); } catch (Exception ex) { } if (FormSession.Language == "Ar") { MainDiv.Attributes.Add("dir", "rtl"); } else { MainDiv.Attributes.Add("dir", "ltr"); } int Index = InfoTab.FindPageIndex(FormSession.PageIndex); InfoTab.ShowTabs(Index, Session["Language"].ToString(), (HtmlTableCell)MyHeader.FindControl("MenuHeader")); lblHeading.Text = Titel; }
public void DoFillTracking(List<OrderTracking> list) { TrackGrid.Redim(0, 0); TrackGrid.FixedRows = 1; TrackGrid.EnableSort = true; TrackGrid.Redim(list.Count + 1, 4); TrackGrid.Rows[0].Height = 25; TrackGrid[0, 0] = new MyHeader("跟踪日期"); TrackGrid[0, 0].Column.Width = 100; TrackGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 1] = new MyHeader("描述"); TrackGrid[0, 1].Column.Width = 650; TrackGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 2] = new MyHeader("状态"); TrackGrid[0, 2].Column.Width = 150; TrackGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 3] = new MyHeader("跟踪人"); TrackGrid[0, 3].Column.Width = 100; SourceGrid.Cells.Controllers.CustomEvents trackEvents = new SourceGrid.Cells.Controllers.CustomEvents(); trackEvents.DoubleClick += new EventHandler(trackEvent_Click); int r = 1; foreach (OrderTracking tracking in list) { TrackGrid.Rows[r].Tag = tracking.Id; TrackGrid.Rows[r].Height = 25; TrackGrid[r, 0] = new SourceGrid.Cells.Cell(tracking.TrackingDate); TrackGrid[r, 0].AddController(trackEvents); TrackGrid[r, 1] = new SourceGrid.Cells.Cell(tracking.Description); TrackGrid[r, 1].AddController(trackEvents); TrackGrid[r, 2] = new SourceGrid.Cells.Cell(tracking.Status); TrackGrid[r, 2].AddController(trackEvents); TrackGrid[r, 3] = new SourceGrid.Cells.Cell(tracking.Tracker); TrackGrid[r, 3].AddController(trackEvents); r++; } TrackGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public void DoFill(List<Order> list) { OrderGrid.Redim(0, 0); OrderGrid.FixedRows = 1; OrderGrid.FixedColumns = 1; OrderGrid.EnableSort = true; OrderGrid.Redim(list.Count + 1, 8); OrderGrid.Rows[0].Height = 25; OrderGrid[0, 0] = new MyHeader(""); OrderGrid[0, 0].Column.Width = 50; OrderGrid[0, 1] = new MyHeader("开始日期"); OrderGrid[0, 1].Column.Width = 100; OrderGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 2] = new MyHeader("结束日期"); OrderGrid[0, 2].Column.Width = 100; OrderGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 3] = new MyHeader("订单编号"); OrderGrid[0, 3].Column.Width = 100; OrderGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 4] = new MyHeader("订单描述"); OrderGrid[0, 4].Column.Width = 300; OrderGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 5] = new MyHeader("业务员"); OrderGrid[0, 5].Column.Width = 100; OrderGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 6] = new MyHeader("订单状态"); OrderGrid[0, 6].Column.Width = 150; OrderGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 7] = new MyHeader("备注"); OrderGrid[0, 7].Column.Width = 200; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); clickEvent.Click += new EventHandler(clickEvent_Click); int r = 1; foreach (Order order in list) { OrderGrid.Rows[r].Tag = order.Id; OrderGrid.Rows[r].Height = 25; if (string.IsNullOrEmpty(order.EndDate)) { OrderGrid[r, 0] = new SourceGrid.Cells.Button("跟进"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(CellButton_Click); OrderGrid[r, 0].Controller.AddController(buttonClickEvent); } else { OrderGrid[r, 0] = null; } OrderGrid[r, 1] = new SourceGrid.Cells.Cell(order.BeginDate); OrderGrid[r, 1].AddController(clickEvent); OrderGrid[r, 2] = new SourceGrid.Cells.Cell(order.EndDate); OrderGrid[r, 2].AddController(clickEvent); OrderGrid[r, 3] = new SourceGrid.Cells.Cell(order.OrderNo); OrderGrid[r, 3].AddController(clickEvent); OrderGrid[r, 4] = new SourceGrid.Cells.Cell(order.Description); OrderGrid[r, 4].AddController(clickEvent); OrderGrid[r, 5] = new SourceGrid.Cells.Cell(order.SalesMan); OrderGrid[r, 6] = new SourceGrid.Cells.Cell(order.Status); OrderGrid[r, 7] = new SourceGrid.Cells.Cell(order.Remark); r++; } OrderGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.Redim(20, 10); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r=r+2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r+1, 0] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(r), typeof(DateTime)); grid1[r+1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; } grid1.AutoSizeCells(); }
public void DoFill(List<Product> list) { MyItemGrid.Redim(0, 0); MyItemGrid.FixedRows = 1; MyItemGrid.FixedColumns = 1; MyItemGrid.EnableSort = true; MyItemGrid.Redim(list.Count + 1, 6); MyItemGrid.Rows[0].Height = 25; MyItemGrid[0, 0] = new MyHeader("图片"); MyItemGrid[0, 0].Column.Width = 80; MyItemGrid[0, 1] = new MyHeader("名称标题"); MyItemGrid[0, 1].Column.Width = MyItemGrid.Width - 460; MyItemGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 2] = new MyHeader("型号"); MyItemGrid[0, 2].Column.Width = 100; MyItemGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 3] = new MyHeader("价格"); MyItemGrid[0, 3].Column.Width = 100; MyItemGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 4] = new MyHeader("最小订量"); MyItemGrid[0, 4].Column.Width = 100; MyItemGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 5] = new MyHeader("状态"); MyItemGrid[0, 5].Column.Width = 80; MyItemGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (Product item in list) { MyItemGrid.Rows[r].Tag = item.Id; MyItemGrid.Rows[r].Height = 80; Image image = AliHelper.Properties.Resources.no_image; if (item.Image != null) { ThreadPool.QueueUserWorkItem(new WaitCallback(LoadingProductImage), new object[] { item, r, SelectedCategory.Id }); } MyItemGrid[r, 0] = new SourceGrid.Cells.Image(image); MyItemGrid[r, 0].AddController(clickEvent); MyItemGrid[r, 1] = new SourceGrid.Cells.Cell(item.Name); MyItemGrid[r, 1].AddController(clickEvent); MyItemGrid[r, 2] = new SourceGrid.Cells.Cell(item.Model); MyItemGrid[r, 2].AddController(clickEvent); MyItemGrid[r, 3] = new SourceGrid.Cells.Cell(item.Price.ToString("#,##0.00")); MyItemGrid[r, 3].AddController(clickEvent); MyItemGrid[r, 4] = new SourceGrid.Cells.Cell(item.Minimum +"PCS"); MyItemGrid[r, 4].AddController(clickEvent); string status = item.Status == "A" ? "有效" : "无效"; MyItemGrid[r, 5] = new SourceGrid.Cells.Cell(status); MyItemGrid[r, 5].AddController(clickEvent); r++; } MyItemGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void DoFull() { grid1.Redim(20, 12); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); grid1[1, 10] = new MyHeader("11"); grid1[1, 11] = new MyHeader("12"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r = r + 2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r + 1, 0] = new SourceGrid.Cells.Cell(); grid1[r + 1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; grid1[r, 10] = new SourceGrid.Cells.Cell("Text Span", typeof(string)); grid1[r, 10].ColumnSpan = 2; grid1[r, 10].RowSpan = 2; } grid1.ClipboardMode = SourceGrid.ClipboardMode.All; grid1.AutoSizeCells(); }
private void DoFull() { grid1.Redim(20, 12); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); grid1[1, 10] = new MyHeader("11"); grid1[1, 11] = new MyHeader("12"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r=r+2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r+1, 0] = new SourceGrid.Cells.Cell(); grid1[r+1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; grid1[r, 10] = new SourceGrid.Cells.Cell("Text Span", typeof(string)); grid1[r, 10].ColumnSpan = 2; grid1[r, 10].RowSpan = 2; } grid1.ClipboardMode = SourceGrid.ClipboardMode.All; grid1.AutoSizeCells(); }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.Redim(20, 10); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r = r + 2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r + 1, 0] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(r), typeof(DateTime)); grid1[r + 1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; } grid1.AutoSizeCells(); }
private void DoFull1(System.Data.DataTable dt) { ComboxItem[] items = getItems(); if (dt.Rows.Count > 0) { grid1.Redim(1, items.Length); grid1.Redim(dt.Rows.Count + 1 + 1, items.Length); } else { grid1.Redim(1, items.Length); } grid1.FixedRows = 1; grid1.FixedColumns = 1; grid1.Selection.EnableMultiSelection = true; for (int i = 0; i < items.Length; i++) grid1[0, i] = new MyHeader(items[i].Text); for (int i = 0; i < dt.Rows.Count; i++) { int cnt = int.Parse(dt.Rows[i]["cnt"].ToString()); int cnt_sub = int.Parse(dt.Rows[i]["cnt_sub"].ToString()); grid1[i + 1, GetIndexByName("序号")] = new SourceGrid.Cells.Cell(dt.Rows[i]["序号"].ToString(), typeof(int)); grid1[i + 1, GetIndexByName("iOriSum")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriSum"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iSum")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iSum"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iOriTotal")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriTotal"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iTotal")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iTotal"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("cbMemo")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cbMemo"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("pbid")] = new SourceGrid.Cells.Cell(dt.Rows[i]["pbid"].ToString(), typeof(int)); grid1[i + 1, GetIndexByName("id")] = new SourceGrid.Cells.Cell(dt.Rows[i]["id"].ToString(), typeof(int)); // grid1[i+1, ++col] = new SourceGrid.Cells.Cell(dt.Rows[i]["cPOID"].ToString(), typeof(string)); if (i == 0 || (i > 0 && !dt.Rows[i]["cPBVCode"].ToString().Equals(dt.Rows[i - 1]["cPBVCode"].ToString()))) { grid1[i + 1, GetIndexByName("cPBVCode")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cPBVCode"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("dPBVDate")] = new SourceGrid.Cells.Cell(dt.Rows[i]["dPBVDate"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("PayDate")] = new SourceGrid.Cells.Cell(dt.Rows[i]["PayDate"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cPOID")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cPOID"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cmaketime")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cmaketime"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cVenName")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cVenName"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cexch_name")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cexch_name"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("nflat")] = new SourceGrid.Cells.Cell(dt.Rows[i]["nflat"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iOriSum_Total")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriSum_Total"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iSum_Total")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iSum_Total"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iOriTotal_Total")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriTotal_Total"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iTotal_Total")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iTotal_Total"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iTotal_Total")].View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; grid1[i + 1, GetIndexByName("PayTerm")] = new SourceGrid.Cells.Cell(dt.Rows[i]["PayTerm"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cmaker")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cmaker"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("iOriPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriPayBalance"].ToString(), typeof(decimal)); grid1[i + 1, GetIndexByName("iPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iPayBalance"].ToString(), typeof(decimal)); if (cnt > 1) { grid1[i + 1, GetIndexByName("cPBVCode")].RowSpan = cnt; grid1[i + 1, GetIndexByName("dPBVDate")].RowSpan = cnt; grid1[i + 1, GetIndexByName("PayDate")].RowSpan = cnt; grid1[i + 1, GetIndexByName("cPOID")].RowSpan = cnt; grid1[i + 1, GetIndexByName("cmaketime")].RowSpan = cnt; grid1[i + 1, GetIndexByName("cVenName")].RowSpan = cnt; grid1[i + 1, GetIndexByName("cexch_name")].RowSpan = cnt; grid1[i + 1, GetIndexByName("nflat")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iOriSum_Total")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iSum_Total")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iOriTotal_Total")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iTotal_Total")].RowSpan = cnt; grid1[i + 1, GetIndexByName("PayTerm")].RowSpan = cnt; grid1[i + 1, GetIndexByName("cmaker")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iOriPayBalance")].RowSpan = cnt; grid1[i + 1, GetIndexByName("iPayBalance")].RowSpan = cnt; } } if (i == 0 || (i > 0 && ((!dt.Rows[i]["cPBVCode"].ToString().Equals(dt.Rows[i - 1]["cPBVCode"].ToString())) || (dt.Rows[i]["cPBVCode"].ToString().Equals(dt.Rows[i - 1]["cPBVCode"].ToString()) && !dt.Rows[i]["ivouchrowno"].ToString().Equals(dt.Rows[i - 1]["ivouchrowno"].ToString()))))) { grid1[i + 1, GetIndexByName("cInvCode")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cInvCode"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cInvName")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cInvName"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cInvStd")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cInvStd"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cInvAddCode")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cInvAddCode"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("cComUnitName")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cComUnitName"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("iQuantity")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iQuantity"].ToString(), typeof(decimal)); //grid1[i + 1, GetIndexByName("iOriPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iOriPayBalance"].ToString(), typeof(decimal)); //grid1[i + 1, GetIndexByName("iPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[i]["iPayBalance"].ToString(), typeof(decimal)); //grid1[i + 1, GetIndexByName("cbMemo")] = new SourceGrid.Cells.Cell(dt.Rows[i]["cbMemo"].ToString(), typeof(string)); grid1[i + 1, GetIndexByName("ivouchrowno")] = new SourceGrid.Cells.Cell(dt.Rows[i]["ivouchrowno"].ToString(), typeof(string)); if (cnt_sub > 1) { grid1[i + 1, GetIndexByName("cInvCode")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("cInvName")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("cInvStd")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("cInvAddCode")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("cComUnitName")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("iQuantity")].RowSpan = cnt_sub; //grid1[i + 1, GetIndexByName("iOriPayBalance")].RowSpan = cnt_sub; //grid1[i + 1, GetIndexByName("iPayBalance")].RowSpan = cnt_sub; //grid1[i + 1, GetIndexByName("cbMemo")].RowSpan = cnt_sub; grid1[i + 1, GetIndexByName("ivouchrowno")].RowSpan = cnt_sub; } } } if (dt.Rows.Count > 0) { for (int i = 0; i < grid1.Columns.Count;i++ ) grid1[grid1.Rows.Count - 1, i] = new SourceGrid.Cells.Cell("", typeof(string));//最后合计行初始化 grid1[grid1.Rows.Count - 1, GetIndexByName("序号")] = new SourceGrid.Cells.Cell("合计", typeof(string)); grid1[grid1.Rows.Count - 1, GetIndexByName("iOriSum")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iOriSum_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iSum")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iSum_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iOriSum_Total")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iOriSum_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iSum_Total")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iSum_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iOriTotal")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iOriTotal_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iTotal")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iTotal_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iOriTotal_Total")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iOriTotal_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iTotal_Total")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iTotal_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iOriPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iOriPayBalance_all"].ToString(), typeof(decimal)); grid1[grid1.Rows.Count - 1, GetIndexByName("iPayBalance")] = new SourceGrid.Cells.Cell(dt.Rows[0]["iPayBalance_all"].ToString(), typeof(decimal)); } grid1.Columns[GetIndexByName("pbid")].Visible = false;//采购订单子表ID不可见 grid1.Columns[GetIndexByName("id")].Visible = false; grid1.Columns[GetIndexByName("ivouchrowno")].Visible = false;//采购订单行号 //grid1.AutoStretchColumnsToFitWidth = true; //grid1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;// doesnot work grid1.Columns.AutoSize(true); grid1.Columns.StretchToFit(); }
public void DoFill(List<Finance> list) { int rowCount = 3; foreach (Finance finance in list) { rowCount = rowCount + finance.Details.Count; } FinGrid.Redim(0, 0); FinGrid.FixedRows = 2; FinGrid.FixedColumns = 3; FinGrid.EnableSort = true; FinGrid.Redim(rowCount, 15); FinGrid[0, 0] = new MyHeader("日期"); FinGrid[0, 0].RowSpan = 2; FinGrid[0, 0].Column.Width = 100; FinGrid[0, 1] = new MyHeader("收支类型"); FinGrid[0, 1].RowSpan = 2; FinGrid[0, 1].Column.Width = 70; FinGrid[0, 2] = new MyHeader("款项描述"); FinGrid[0, 2].RowSpan = 2; FinGrid[0, 2].Column.Width = 250; FinGrid[0, 3] = new MyHeader("金额"); FinGrid[0, 3].RowSpan = 2; FinGrid[0, 3].Column.Width = 100; FinGrid[0, 4] = new MyHeader("汇率"); FinGrid[0, 4].RowSpan = 2; FinGrid[0, 4].Column.Width = 100; FinGrid[0, 5] = new MyHeader("总金额"); FinGrid[0, 5].RowSpan = 2; FinGrid[0, 5].Column.Width = 150; FinGrid[0, 6] = new MyHeader("流水号"); FinGrid[0, 6].RowSpan = 2; FinGrid[0, 6].Column.Width = 100; FinGrid[0, 7] = new MyHeader("收付款单位"); FinGrid[0, 7].RowSpan = 2; FinGrid[0, 7].Column.Width = 100; FinGrid[0, 8] = new MyHeader("经手人/相关人"); FinGrid[0, 8].RowSpan = 2; FinGrid[0, 8].Column.Width = 100; FinGrid[0, 9] = new MyHeader("备注"); FinGrid[0, 9].RowSpan = 2; FinGrid[0, 9].Column.Width = 150; FinGrid[0, 10] = new MyHeader("明细"); FinGrid[0, 10].ColumnSpan = 5; FinGrid[1, 10] = new MyHeader("描述"); FinGrid[1, 10].Column.Width = 200; FinGrid[1, 11] = new MyHeader("所属业务"); FinGrid[1, 11].Column.Width = 100; FinGrid[1, 12] = new MyHeader("金额"); FinGrid[1, 12].Column.Width = 150; FinGrid[1, 13] = new MyHeader("总金额"); FinGrid[1, 13].Column.Width = 150; FinGrid[1, 14] = new MyHeader("备注"); FinGrid[1, 14].Column.Width = 300; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(clickEvent_Click); SourceGrid.Cells.Views.Cell view; int r = 2; double SumTotalAmount = 0.0; double DetailSumTotalAmount = 0.0; foreach (Finance finance in list) { int detailCount = finance.Details.Count(); FinGrid.Rows[r].Height = 22; FinGrid[r, 0] = new SourceGrid.Cells.Cell(finance.FinDate); FinGrid[r, 0].AddController(clickEvent); FinGrid[r, 1] = new SourceGrid.Cells.Cell(finance.EventType); FinGrid[r, 1].AddController(clickEvent); FinGrid[r, 2] = new SourceGrid.Cells.Cell(finance.Description); FinGrid[r, 2].AddController(clickEvent); string amount = "(" + finance.Currency + ")" + finance.Amount.ToString("#,##0.00"); FinGrid[r, 3] = new SourceGrid.Cells.Cell(amount); FinGrid[r, 3].AddController(clickEvent); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 3].View = view; string rate = finance.Rate.ToString("#,##0.0000"); FinGrid[r, 4] = new SourceGrid.Cells.Cell(rate); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; FinGrid[r, 4].View = view; string totalAmount= "¥" + finance.TotalAmount.ToString("#,##0.00"); SumTotalAmount = SumTotalAmount + finance.TotalAmount; FinGrid[r, 5] = new SourceGrid.Cells.Cell(totalAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 5].View = view; FinGrid[r, 6] = new SourceGrid.Cells.Cell(finance.ReferenceNo); FinGrid[r, 7] = new SourceGrid.Cells.Cell(finance.ReceivePaymentor); FinGrid[r, 8] = new SourceGrid.Cells.Cell(finance.Association); FinGrid[r, 9] = new SourceGrid.Cells.Cell(finance.Remark); FinGrid[r, 0].RowSpan = detailCount; FinGrid[r, 1].RowSpan = detailCount; FinGrid[r, 2].RowSpan = detailCount; FinGrid[r, 3].RowSpan = detailCount; FinGrid[r, 4].RowSpan = detailCount; FinGrid[r, 5].RowSpan = detailCount; FinGrid[r, 6].RowSpan = detailCount; FinGrid[r, 7].RowSpan = detailCount; FinGrid[r, 8].RowSpan = detailCount; FinGrid[r, 9].RowSpan = detailCount; foreach (FinDetails detail in finance.Details) { FinGrid.Rows[r].Tag = finance.FinId; FinGrid.Rows[r].Height = 22; FinGrid[r, 10] = new SourceGrid.Cells.Cell(detail.Description); FinGrid[r, 11] = new SourceGrid.Cells.Cell(detail.OrderNo); string detailAmount = "(" + finance.Currency + ")" + detail.Amount.ToString("#,##0.00"); FinGrid[r, 12] = new SourceGrid.Cells.Cell(detailAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 12].View = view; string detailTotalAmount = "¥" + detail.TotalAmount.ToString("#,##0.00"); DetailSumTotalAmount = DetailSumTotalAmount + detail.TotalAmount; FinGrid[r, 13] = new SourceGrid.Cells.Cell(detailTotalAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 13].View = view; FinGrid[r, 14] = new SourceGrid.Cells.Cell(detail.Remark); r++; } } for (int i = 0; i < 15; i++) { FinGrid[r, i] = new SourceGrid.Cells.Cell(""); } FinGrid.Rows[r].Height = 22; FinGrid[r, 2] = new SourceGrid.Cells.Cell("合计"); FinGrid[r, 5] = new SourceGrid.Cells.Cell("¥" + SumTotalAmount.ToString("#,##0.00")); FinGrid[r, 13] = new SourceGrid.Cells.Cell("¥" + DetailSumTotalAmount.ToString("#,##0.00")); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(SumTotalAmount); FinGrid[r, 5].View = FinGrid[r, 13].View = view; FinGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public void DoFill(List<Order> list) { OrderGrid.Redim(0, 0); OrderGrid.FixedRows = 1; OrderGrid.EnableSort = true; int RowNum = IsFinOrderView ? list.Count + 2 : list.Count + 1; OrderGrid.Redim(RowNum, 7); OrderGrid.Rows[0].Height = 25; OrderGrid[0, 0] = new MyHeader("开始日期"); OrderGrid[0, 0].Column.Width = 100; OrderGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 1] = new MyHeader("结束日期"); OrderGrid[0, 1].Column.Width = 100; OrderGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 2] = new MyHeader("订单编号"); OrderGrid[0, 2].Column.Width = 100; OrderGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 3] = new MyHeader("订单描述"); OrderGrid[0, 3].Column.Width = 300; OrderGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 4] = new MyHeader("业务员"); OrderGrid[0, 4].Column.Width = 100; OrderGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 5] = new MyHeader("订单状态"); OrderGrid[0, 5].Column.Width = 150; OrderGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); if (!IsFinOrderView) { OrderGrid[0, 6] = new MyHeader("备注"); OrderGrid[0, 6].Column.Width = 200; } else { OrderGrid[0, 6] = new MyHeader("业务总金额"); OrderGrid[0, 6].Column.Width = 150; OrderGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); } SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(clickEvent_Click); int r = 1; double TotalAmount = 0; foreach (Order order in list) { OrderGrid.Rows[r].Tag = order.Id; OrderGrid.Rows[r].Height = 25; OrderGrid[r, 0] = new SourceGrid.Cells.Cell(order.BeginDate); OrderGrid[r, 0].AddController(clickEvent); OrderGrid[r, 1] = new SourceGrid.Cells.Cell(order.EndDate); OrderGrid[r, 1].AddController(clickEvent); OrderGrid[r, 2] = new SourceGrid.Cells.Cell(order.OrderNo); OrderGrid[r, 2].AddController(clickEvent); OrderGrid[r, 3] = new SourceGrid.Cells.Cell(order.Description); OrderGrid[r, 3].AddController(clickEvent); OrderGrid[r, 4] = new SourceGrid.Cells.Cell(order.SalesMan); OrderGrid[r, 5] = new SourceGrid.Cells.Cell(order.Status); if (!IsFinOrderView) { OrderGrid[r, 6] = new SourceGrid.Cells.Cell(order.Remark); } else { TotalAmount = TotalAmount + order.TotalAmount; string totalAmount = "¥" + order.TotalAmount.ToString("#,##0.00"); OrderGrid[r, 6] = new SourceGrid.Cells.Cell(totalAmount); SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(order.TotalAmount); OrderGrid[r, 6].View = view; } r++; } if (IsFinOrderView) { for (int i = 0; i < 6; i++) { OrderGrid[r, i] = new SourceGrid.Cells.Cell(""); } OrderGrid[r, 3] = new SourceGrid.Cells.Cell("合计"); OrderGrid[r, 6] = new SourceGrid.Cells.Cell("¥" + TotalAmount.ToString("#,##0.00")); SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(TotalAmount); OrderGrid[r, 6].View = view; } OrderGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public void DoFill(int GroupId, List<AliProduct> list) { ProductGrid.Redim(0, 0); ProductGrid.FixedRows = 1; ProductGrid.EnableSort = true; ProductGrid.Redim(list.Count + 1, 8); ProductGrid.Rows[0].Height = 25; ProductGrid[0, 0] = new MyHeader("图片"); ProductGrid[0, 0].Column.Width = 50; ProductGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 1] = new MyHeader("产品名称"); ProductGrid[0, 1].Column.Width = 350; ProductGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 2] = new MyHeader("型号"); ProductGrid[0, 2].Column.Width = 120; ProductGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 3] = new MyHeader("橱窗产品"); ProductGrid[0, 3].Column.Width = 80; ProductGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 4] = new MyHeader("关键词"); ProductGrid[0, 4].Column.Width = 150; ProductGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 5] = new MyHeader("产品状态"); ProductGrid[0, 5].Column.Width = 70; ProductGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 6] = new MyHeader("所属成员"); ProductGrid[0, 6].Column.Width = 100; ProductGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 7] = new MyHeader("更新时间"); ProductGrid[0, 7].Column.Width = 100; ProductGrid[0, 7].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); int r = 1; foreach (AliProduct item in list) { string imageFile = FileUtils.GetProductImagesFolder() + Path.DirectorySeparatorChar + item.Id + ".jpg"; Image image = ImageUtils.ResizeImage(imageFile, 50, 50); ProductGrid.Rows[r].Tag = item.Id; ProductGrid.Rows[r].Height = 50; ProductGrid[r, 0] = new SourceGrid.Cells.Image(image); ProductGrid[r, 0].AddController(clickEvent); ProductGrid[r, 1] = new SourceGrid.Cells.Cell(item.Subject); ProductGrid[r, 1].AddController(clickEvent); ProductGrid[r, 2] = new SourceGrid.Cells.Cell(item.RedModel); ProductGrid[r, 2].AddController(clickEvent); ProductGrid[r, 3] = new SourceGrid.Cells.Cell(item.IsWindowProduct?"是":""); ProductGrid[r, 3].AddController(clickEvent); ProductGrid[r, 4] = new SourceGrid.Cells.Cell(item.Keywords.Replace(",","\r\n")); ProductGrid[r, 4].AddController(clickEvent); ProductGrid[r, 5] = new SourceGrid.Cells.Cell(item.Status); ProductGrid[r, 5].AddController(clickEvent); ProductGrid[r, 6] = new SourceGrid.Cells.Cell(item.OwnerMemberName); ProductGrid[r, 6].AddController(clickEvent); ProductGrid[r, 7] = new SourceGrid.Cells.Cell(item.GmtModified); ProductGrid[r, 7].AddController(clickEvent); if (!File.Exists(imageFile)) { ThreadPool.QueueUserWorkItem(new WaitCallback(LoadingProductImage), new object[] { item, r, GroupId }); } r++; } ProductGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }