private Bitmap GetImage(HighlightCondition c) { Bitmap bmp = new Bitmap(16, 16); using (Graphics g = Graphics.FromImage(bmp)) { g.FillRectangle(Brushes.White, 0, 0, 16, 16); using (TextObject sample = new TextObject()) { sample.Bounds = new RectangleF(0, 0, 15, 15); sample.ApplyCondition(c); sample.Font = new Font("Times New Roman", 12, FontStyle.Bold); sample.Text = "A"; sample.HorzAlign = HorzAlign.Center; sample.VertAlign = VertAlign.Center; using (GraphicCache cache = new GraphicCache()) { sample.Draw(new FRPaintEventArgs(g, 1, 1, cache)); } } } return(bmp); }
private int GetImageIndex(HighlightCondition c) { Bitmap bmp = GetImage(c); FImages.Images.Add(bmp, bmp.GetPixel(0, 15)); return(FImages.Images.Count - 1); }
private void btnDelete_Click(object sender, EventArgs e) { while (lvConditions.SelectedItems.Count > 0) { HighlightCondition c = lvConditions.SelectedItems[0].Tag as HighlightCondition; FConditions.Remove(c); lvConditions.Items.Remove(lvConditions.SelectedItems[0]); } }
private void popup_ColorSelected(object sender, EventArgs e) { Color color = (sender as ColorPopup).Color; foreach (ListViewItem li in lvConditions.SelectedItems) { HighlightCondition c = li.Tag as HighlightCondition; c.TextFill = new SolidFill(color); li.ImageIndex = GetImageIndex(c); } RefreshSample(); }
private void SetApply() { foreach (ListViewItem li in lvConditions.SelectedItems) { HighlightCondition c = li.Tag as HighlightCondition; c.ApplyBorder = cbApplyBorder.Checked; c.ApplyFill = cbApplyFill.Checked; c.ApplyTextFill = cbApplyTextFill.Checked; c.ApplyFont = cbApplyFont.Checked; c.Visible = cbVisible.Checked; li.ImageIndex = GetImageIndex(c); } RefreshSample(); }
private void btnDown_Click(object sender, EventArgs e) { if (lvConditions.SelectedItems.Count != 1) { return; } int index = lvConditions.SelectedIndices[0]; if (index < lvConditions.Items.Count - 1) { ListViewItem li = lvConditions.SelectedItems[0]; lvConditions.Items.Remove(li); lvConditions.Items.Insert(index + 1, li); HighlightCondition c = li.Tag as HighlightCondition; FConditions.Remove(c); FConditions.Insert(index + 1, c); } }
private void btnAdd_Click(object sender, EventArgs e) { using (ExpressionEditorForm form = new ExpressionEditorForm(FReport)) { form.ExpressionText = FReport.ScriptLanguage == Language.CSharp ? "Value == 0" : "Value = 0"; if (form.ShowDialog() == DialogResult.OK) { HighlightCondition c = new HighlightCondition(); FConditions.Add(c); c.Expression = form.ExpressionText; ListViewItem li = lvConditions.Items.Add(c.Expression, GetImageIndex(c)); li.Tag = c; lvConditions.SelectedItems.Clear(); li.Selected = true; } } }
private void btnFont_Click(object sender, EventArgs e) { if (CurrentCondition == null) { return; } using (FontDialog dialog = new FontDialog()) { dialog.Font = CurrentCondition.Font; if (dialog.ShowDialog() == DialogResult.OK) { foreach (ListViewItem li in lvConditions.SelectedItems) { HighlightCondition c = li.Tag as HighlightCondition; c.Font = dialog.Font; li.ImageIndex = GetImageIndex(c); } RefreshSample(); } } }
private void btnFill_Click(object sender, EventArgs e) { if (CurrentCondition == null) { return; } using (FillEditorForm editor = new FillEditorForm()) { editor.Fill = CurrentCondition.Fill.Clone(); if (editor.ShowDialog() == DialogResult.OK) { foreach (ListViewItem li in lvConditions.SelectedItems) { HighlightCondition c = li.Tag as HighlightCondition; c.Fill = editor.Fill.Clone(); li.ImageIndex = GetImageIndex(c); } RefreshSample(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Page != null) { string appDirectory = HttpContext.Current.Server.MapPath(string.Empty); // Определяем выбранный отчёт string keyValue = Page.Request.QueryString.Get("reportname"); if (keyValue == null) { keyValue = "SimpleList"; } StiReport report = new StiReport(); string text = string.Empty; bool isRender = false; switch (keyValue) { // Basic Reports case "SimpleList": report = new SimpleList(); text = "The sample demonstrates how to create a simple list report."; isRender = true; break; case "TwoSimpleLists": report = new TwoSimpleLists(); text = "The sample demonstrates how to create two simple list reports."; isRender = true; break; case "HighlightCondition": report = new HighlightCondition(); text = "The sample demonstrates how to use highlight condition to create a report."; isRender = true; break; case "Shapes": report = new Shapes(); text = "The sample demonstrates how to create a report with shapes."; isRender = true; break; case "Images": report = new Images(); text = "The sample demonstrates how to create a report with images."; isRender = true; break; case "Watermark": report = new Watermark(); text = "The sample demonstrates how to create a report with watermark."; isRender = true; break; case "BarCodes": report = new BarCodes(); text = "The sample demonstrates how to create a report with BarCodes."; isRender = true; break; case "Invoice": report = new Invoice(); text = "A simple invoice."; isRender = true; break; case "Indicators": report.Load(appDirectory + "\\Reports\\Indicators.mrt"); text = "This sample shows how to use indicators in the report."; break; // Reports with Columns case "MultiColumnList": report = new MultiColumnList(); text = "The sample demonstrates how to create a report with multiple columns. To create a report with columns set the Columns property of a page in two or more."; isRender = true; break; case "MultiColumnBandsAcrossThenDown": report = new MultiColumnBandsAcrossThenDown(); text = "The sample demonstrates how to create a report with multiple columns on the bands. Multicolumn direction - across then down."; isRender = true; break; case "MultiColumnBandsDownThenAcross": report = new MultiColumnBandsDownThenAcross(); text = "The sample demonstrates how to create a report with multiple columns on the bands. Multicolumn direction - down then across."; isRender = true; break; case "Labels": report = new Labels(); text = "The sample demonstrates how to create a report with labels."; isRender = true; break; // Master-Detail Reports case "MasterDetail": report = new MasterDetail(); text = "The sample demonstrates how to create a Master-Detail report."; isRender = true; break; case "MasterDetailSubdetail": report = new MasterDetailSubdetail(); text = "The sample demonstrates how to create a Master-Detail-Subdetail report."; isRender = true; break; case "MasterDetailWithColumns": report = new MasterDetailWithColumns(); text = "The sample demonstrates how to create a Master-Detail report with columns."; isRender = true; break; case "TwoMastersOnOneDetail": report = new TwoMastersOnOneDetail(); text = "The sample demonstrates how to create a report with two master-detail links. And detail for both links is the same."; isRender = true; break; case "MasterDetailWithZeroHeight": report = new MasterDetailWithZeroHeight(); text = "The sample demonstrates how to create a Master-Detail report in which one of the bands has the zero height."; isRender = true; break; case "MasterDetailOnDataBand": report = new MasterDetailOnDataBand(); text = "The sample demonstrates how to create a Master-Detail report in which one of the bands placed on other."; isRender = true; break; // Reports with Groups case "SimpleGroup": report = new SimpleGroup(); text = "The sample demonstrates how to create a simple group report with one group."; isRender = true; break; case "NestedGroups": report = new NestedGroups(); text = "The sample demonstrates how to create a report using several groups."; isRender = true; break; case "GroupsTopSales": report = new GroupsTopSales(); text = "This sample demonstrates how to sort group by its totals."; isRender = true; break; case "MasterDetailWithGroups": report = new MasterDetailWithGroups(); text = "The sample demonstrates how to create a Master-Detail report with groups."; isRender = true; break; case "MultiColumnGroup": report = new MultiColumnGroup(); text = "The sample demonstrates how to create a simple group report with two columns on page."; isRender = true; break; case "GroupsWithRanges": report = new GroupsWithRanges(); text = "The sample demonstrates how to create groups with ranges in report."; isRender = true; break; case "SimpleGroupWithColumns": report = new SimpleGroupWithColumns(); text = "The sample demonstrates how to create a simple group report with multiple columns on the bands. Multicolumn direction - across then down."; isRender = true; break; case "AllGroupFootersAtEnd": report = new AllGroupFootersAtEnd(); text = "This sample shows all group footers at the bottom of Report."; isRender = true; break; case "InvoiceWithGroups": report = new InvoiceWithGroups(); text = "An invoice with categories."; isRender = true; break; case "SalesInvoice": report = new SalesInvoice(); text = "Sales invoice."; isRender = true; break; // Hierarchical Reports case "Tree": report = new Tree(); text = "The sample demonstrates how to create hierarchical report."; isRender = true; break; case "TreeWithHeadersFooters": report = new TreeWithHeadersFooters(); text = "The sample demonstrates how to create hierarchical wiith headers and footers."; isRender = true; break; case "TreeWithTotals": report = new TreeWithTotals(); text = "The sample demonstrates how to create hierarchical report with totals."; isRender = true; break; case "TreeWithTotalsAllLevels": report = new TreeWithTotalsAllLevels(); text = "The sample demonstrates how to create hierarchical report with totals which include all sub-levels of tree."; isRender = true; break; case "TreeWithLockedComponents": report = new TreeWithLockedComponents(); text = "The sample demonstrates how to create hierarchical report with locked components."; isRender = true; break; // Parameters case "ParametersDetailedCategories": report.Load(appDirectory + "\\Reports\\ParametersDetailedCategories.mrt"); text = "Detailing by selected category of products."; break; case "ParametersDetailedOrders": report.Load(appDirectory + "\\Reports\\ParametersDetailedOrders.mrt"); text = "Detailing of the list of orders by specified number."; break; case "ParametersHighlightCondition": report.Load(appDirectory + "\\Reports\\ParametersHighlightCondition.mrt"); text = "Highlighting data rows by selected conditions."; break; //case "ParametersSelectingCountry": report.Load(appDirectory + "\\Reports\\ParametersSelectingCountry.mrt"); text = "Showing data only by selected countries."; break; //case "ParametersDateRange": report.Load(appDirectory + "\\Reports\\ParametersDateRange.mrt"); text = "Selecting the date range for printing data."; break; case "ParametersInvoice": report.Load(appDirectory + "\\Reports\\ParametersInvoice.mrt"); text = "This sample requests parameters for printing an invoice."; break; // Interactive Reports case "DrillDownListOfProducts": report.Load(appDirectory + "\\Reports\\DrillDownListOfProducts.mrt"); text = "The sample demonstrates how to use drill-down reports."; break; case "DrillDownGroupWithCollapsing": report.Load(appDirectory + "\\Reports\\DrillDownGroupWithCollapsing.mrt"); text = "The sample demonstrates how to use GroupHeaderBand without GroupFooterBand."; break; case "DrillDownSorting": report.Load(appDirectory + "\\Reports\\DrillDownSorting.mrt"); text = "The sample demonstrates how to use interactive sorting."; break; case "DrillDownGroupWithCollapsingWithoutFooter": report.Load(appDirectory + "\\Reports\\DrillDownGroupWithCollapsingWithoutFooter.mrt"); text = "The sample demonstrates how to use GroupHeaderBand without GroupFooterBand."; break; case "DrillDownMasterDetailWithCollapsing": report.Load(appDirectory + "\\Reports\\DrillDownMasterDetailWithCollapsing.mrt"); text = "The sample demonstrates how to use Master-Detail report with collapsing."; break; case "EditableReport": report.Load(appDirectory + "\\Reports\\EditableReport.mrt"); text = "The sample demonstrates how to edit a rendered report in the Preview Window."; break; case "BookmarksHyperlinks": report.Load(appDirectory + "\\Reports\\BookmarksHyperlinks.mrt"); text = "The sample demonstrates how to use bookmarks and hyperlinks."; break; case "Anchors": report.Load(appDirectory + "\\Reports\\Anchors.mrt"); text = "The sample demonstrates how to use anchors."; break; // Charts case "ChartColumnsAndBars": report = new ChartColumnsAndBars(); text = "This sample demonstrates Column and Bar chart types."; isRender = true; break; case "ChartLinesAndSplines": report = new ChartLinesAndSplines(); text = "This sample demonstrates Line and Spline chart types."; isRender = true; break; case "ChartAreas": report = new ChartAreas(); text = "This sample demonstrates Areas chart types."; isRender = true; break; case "ChartPieAndDoughnut": report = new ChartPieAndDoughnut(); text = "This sample demonstrates Pie and Doughnut chart types."; isRender = true; break; case "ChartStyles": report = new ChartStyles(); text = "This sample demonstrates different chart styles."; isRender = true; break; case "ChartOnDataband": report = new ChartOnDataband(); text = "This sample demonstrates how to use a chart with DataBand."; isRender = true; break; // Reports with EmptyBand case "SimpleListWithEmptyLines": report = new SimpleListWithEmptyLines(); text = "The sample demonstrates how to create a simple list report with empty lines on the bottom of a page."; isRender = true; break; case "MasterDetailWithEmptyLines": report = new MasterDetailWithEmptyLines(); text = "The sample demonstrates how to create a Master-Detail report with empty lines on the bottom of a page."; isRender = true; break; case "InvoiceWithEmptyBand": report = new InvoiceWithEmptyBand(); text = "An invoice created using an Empty Band."; isRender = true; break; // Containers case "SideBySideListWithContainers": report = new SideBySideListWithContainers(); text = "The sample demonstrates how to create a report that contains two side by side lists with containers."; isRender = true; break; case "SideBySideGroupWithContainers": report = new SideBySideGroupWithContainers(); text = "The sample demonstrates how to create a report that contains two side by side groups with containers."; isRender = true; break; case "MultiColumnListContainers": report = new MultiColumnListContainers(); text = "The sample demonstrates how to create a report with multiple columns using containers."; isRender = true; break; case "MasterDetailCards": report = new MasterDetailCards(); text = "The sample demonstrates how to create a Master-Detail report which data are grouped as cards."; isRender = true; break; // SubReports //case "SideBySideListWithSubReports": report = new SideBySideListWithSubReports(); text = "The sample demonstrates how to create a report that contains two side by side lists with SubReports."; isRender = true; break; //case "SideBySideGroupWithSubReports": report = new StiSideBySideGroupWithSubReportsReport(); text = "The sample demonstrates how to create a report that contains two side by side groups with SubReports."; break; //case "MasterDetailWithSubReports": report = new StiMasterDetailWithSubReportsReport(); text = "The sample demonstrates how to create a Master-Detail report with SubReports."; break; } //report = new StiReport(); //report.Load(appDirectory + "\\Reports\\shapes.mrt"); LabelText.Text = text; RenderReport(report, isRender); StiWebViewerSL1.Report = report; } }
/// <summary> /// Checkbox checked handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Below_Checked(object sender, RoutedEventArgs e) { highlightCondition = HighlightCondition.BELOW; }
/// <summary> /// Checkbox unchecked handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Above_Checked(object sender, RoutedEventArgs e) { highlightCondition = HighlightCondition.ABOVE; }
/// <summary> /// Highlights all values above a certain threshold as red /// </summary> /// <param name="value"></param> public void HighlightThreshold(int threshold, HighlightCondition highlightCondition = HighlightCondition.ABOVE) { this.highlightCondition = highlightCondition; double max = imageData.GetMaximum(); double min = imageData.GetMinimum(); int width = imageData.GetWidth(); int height = imageData.GetHeight(); float[,,] data = imageData.GetData(); WriteableBitmap highlightedImage = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgr32, null); highlightedImage.Lock(); // Go through each pixel in each image for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { double n = data[imageIndex, y, x]; byte pixelValue = (byte)(((n - min) / (max - min)) * MAXIMUM_INTENSITY); unsafe { // Get a pointer to the back buffer. int pBackBuffer = (int)highlightedImage.BackBuffer; // Find the address of the pixel to draw. pBackBuffer += y * highlightedImage.BackBufferStride; pBackBuffer += x * 4; // Compute the pixel's color. int color_data; if (highlightCondition == HighlightCondition.ABOVE) { if (n > threshold) { color_data = pixelValue << 16; // R color_data |= 0; // G color_data |= 0; // B } else { color_data = pixelValue << 16; // R color_data |= pixelValue << 8; // G color_data |= pixelValue << 0; // B } } else { if (n < threshold) { color_data = pixelValue << 16; // R color_data |= 0; // G color_data |= 0; // B } else { color_data = pixelValue << 16; // R color_data |= pixelValue << 8; // G color_data |= pixelValue << 0; // B } } // Assign the color data to the pixel. *((int *)pBackBuffer) = color_data; } // Specify the area of the bitmap that changed. highlightedImage.AddDirtyRect(new Int32Rect(x, y, 1, 1)); } } // Release the back buffer and make it available for display. highlightedImage.Unlock(); mainWindow.ImageViewer.Source = highlightedImage; }
internal void PopulateWI(bool resort, HighlightFilter highlightings) { this.lvWI.BeginUpdate(); try { BackupSelectedItems(); if (resort) { SortListData(); } this.lvWI.Items.Clear(); List <ColumnHeader> columnsToRemove = new List <ColumnHeader>(); foreach (ColumnHeader column in lvWI.Columns) { //string tag = column.Tag as string; //bool canRemove = tag != "0"; bool canRemove = (column.Name == field_BuildIn || column.Name == field_IntegrationBuild); if (canRemove) { columnsToRemove.Add(column); } } columnsToRemove.ForEach(columnHeader => lvWI.Columns.Remove(columnHeader)); COLUMN_FOUNDIN = -1; COLUMN_INTEGRATIONBUILD = -1; if (this.cachedWorkItems != null) { foreach (FieldDefinition fieldDef in displayFields) { if (defaultFields.Contains(fieldDef.ReferenceName)) { continue; } ColumnHeader columnHeader = this.lvWI.Columns.Add(fieldDef.Name); columnHeader.Tag = "0";//fieldDef.ReferenceName; columnHeader.Name = fieldDef.ReferenceName; if (fieldDef.ReferenceName == field_BuildIn) { COLUMN_FOUNDIN = lvWI.Columns.Count - 1; } else if (fieldDef.ReferenceName == field_IntegrationBuild) { COLUMN_INTEGRATIONBUILD = lvWI.Columns.Count - 1; } } string[] columnsTemp = new string[this.lvWI.Columns.Count]; int idx = 0; foreach (ColumnHeader column in this.lvWI.Columns) { columnsTemp[idx++] = column.Text; } foreach (WorkItem workItem in this.cachedWorkItems) { ListViewItem viewItem = this.lvWI.Items.Add(workItem.Id.ToString()); viewItem.UseItemStyleForSubItems = false; viewItem.Tag = workItem; viewItem.SubItems.Add(workItem.Type.Name); viewItem.SubItems.Add(workItem.Title); viewItem.SubItems.Add(workItem.ChangedDate.ToString()); bool alreadyhightlighted = false; foreach (FieldDefinition fieldDef in displayFields) { string workItemFieldContent = null; if (defaultFields.Contains(fieldDef.ReferenceName) || !workItem.Fields.Contains(fieldDef.ReferenceName)) { if (fieldDef.ReferenceName == field_BuildIn || fieldDef.ReferenceName == field_IntegrationBuild) { workItemFieldContent = string.Empty; } else { continue; } } if (workItemFieldContent == null) { workItemFieldContent = workItem[fieldDef.ReferenceName].ToString(); } ListViewItem.ListViewSubItem subItem = viewItem.SubItems.Add(workItemFieldContent); if (highlightings != null && highlightings.ContainsKey(fieldDef.ReferenceName)) { HighlightCondition condition = highlightings[fieldDef.ReferenceName]; if (Util.StrEqual(subItem.Text, condition.Value, true)) { subItem.ForeColor = condition.ForeColor; if (!alreadyhightlighted) { subItem.BackColor = condition.BackColor; alreadyhightlighted = true; } } } } var teamProject = (string)workItem.Fields[CoreField.TeamProject].Value; viewItem.Group = this.lvWI.Groups[teamProject]; } } } finally { this.lvWI.EndUpdate(); RestoreSelectedItems(); } }