Telerik Forums
UI for WinForms Forum
2 answers
252 views

 Hi,

Picture exported in wrong size to picture.image when creating RadChartView in AchiverReports10. Picture is cropped when adding Legend Title. Could you help me please in this question?

 Private Sub GroupFooter1_Format(sender As Object, e As EventArgs) Handles GroupFooter1.Format
      Dim rchv As New RadChartView
      rchv.Name = "rchv"
      rchv.ShowTitle = True
      rchv.Title = "Test"
      rchv.ChartElement.TitleElement.Font = New Font("Arial", 16)
      rchv.ShowToolTip = True
      rchv.ShowLegend = False
      rchv.Area.View.Palette = KnownPalette.Metro

      AddHandler rchv.LabelFormatting, AddressOf rcvQualityPie_LabelFormatting
      
      rchv.Series.Clear()
      rchv.AreaType = ChartAreaType.Pie
      rchv.ChartElement.AutoSize = True
      rchv.ShowSmartLabels = True
      rchv.ShowLegend = False

      Dim series As New PieSeries()

      For Each row As DataRow In _dtRejctResons.Rows
         series.DataPoints.Add(New Telerik.Charting.PieDataPoint(row("OsuusPerc"), row("RaakkiSelite")))
      Next

      series.DrawLinesToLabels = True
      series.SyncLinesToLabelsColor = True
      series.ShowLabels = True

      rchv.Series.Add(series)

      Dim sFileName As String = "exprtedChart1.png"
      Dim sFilePath As String

      sFilePath = System.IO.Path.GetTempPath & sFileName

      If File.Exists(sFilePath) = True Then
         File.Delete(sFilePath)
      End If
      rchv.ExportToImage(sFilePath, rchv.Size, System.Drawing.Imaging.ImageFormat.Png)
      Picture.Image = Image.FromFile(sFilePath)

End Sub

Private Sub rcvQualityPie_LabelFormatting(sender As Object, e As ChartViewLabelFormattingEventArgs)
      Dim pieElement As PiePointElement = DirectCast(e.LabelElement.Parent, PiePointElement)
      Dim dataPoint As PieDataPoint = DirectCast(pieElement.DataPoint, PieDataPoint)
      e.LabelElement.BackColor = Color.White
      e.LabelElement.BorderColor = Color.White
      e.LabelElement.Text = String.Format("{0}, " & "{1} %", dataPoint.LegendTitle, Math.Round(dataPoint.Percent, 0))
      e.LabelElement.Padding = New System.Windows.Forms.Padding(6, 0, -100, 0)

   End Sub

Kseniia
Top achievements
Rank 1
 answered on 01 Feb 2017
4 answers
222 views

I want to be able to show a link, but have the display text be something different.

This is what I want to see <a href="http://www.googe.com">Google</html>

What's the correct way to do that? Preferably without having to override some on row creating event.

Pavel
Top achievements
Rank 1
 answered on 31 Jan 2017
2 answers
291 views

Hello everybody,

I am learning C# in the software specialist course. I want to get datas from RadGridView and export to Excel file. I managed that get datas from RadGridView like this:

private bool Save_As_Excel_Format()
{
    if (Personal.Id <= 0) return true;
 
    foreach (var gridViewRowInfo in GetAllRows(rgv.MasterTemplate))
    {
        var dataRow = (GridViewDataRowInfo) gridViewRowInfo;
 
        foreach (GridViewCellInfo cell in dataRow.Cells)
        {
            MessageBox.Show(cell.Value.ToString());
        }
}
    return true;
}
 
public List<GridViewRowInfo> GetAllRows(GridViewTemplate template)
{
    var allRows = new List<GridViewRowInfo>();
    allRows.AddRange(template.Rows);
    foreach (var childTemplate in template.Templates)
    {
        var childRows = this.GetAllRows(childTemplate);
        allRows.AddRange(childRows);
    }
    return allRows;
}

 

But I do not know how I export to Excel with using NPOI library.

 

SarperSozen
Top achievements
Rank 1
 answered on 31 Jan 2017
0 answers
88 views

Hello,

I have one question.

When I make custom filter example name is Standard, and saved it and change some column,on user control grid.

After update something in my form custom filter reload not stay on Standard custom filter.

How to make when I update something on my form stay allways on selected filter in my case Standard?

Denius
Top achievements
Rank 1
 asked on 31 Jan 2017
1 answer
268 views

Hi,

I am using telerik library version 'UI for WinForms Q2 2014' and need to implement a selection change event for one of the GridViewComboBoxColumn type column. As per http://docs.telerik.com/devtools/wpf/controls/radgridview/columns/how-to/howto-selectionchanged-comboboxcolumn I have to use the AddHandler method for which Telerik.Windows namespace has to be used, However for the version I am currently having doesn't contain any of these Telerik.Windows libraries. What is the best thing to do for me now to implement my feature.

 

Thanks in advance.

Chandra.

Ralitsa
Telerik team
 answered on 31 Jan 2017
3 answers
219 views
So, here goes.

I have a user requirement. The basically need 1 textbox, it doesnt matter if it is a masked textbox or a datetimepicker or whatever.
This textbox needs to allow only hh:mm and when it gains focus it needs to select the whole of the contents.

When the user navigates to this textbox initially, it should be blank (it can be __:__ if masked) and should allow a user to type:

0125

without needing to press any other keys (01 is the hours and 25 is the minutes). The control should be smart enough to display 01:25 but not require the user to press the arrow keys to move from hours to minutes.

I have tried this using the maskededitbox and found that it doesnt work as intended and I cant clear the text if I set the mask to ##:## which is annoying. I then used the datetimepicker and selected time, but it has hh:mm:ss and to get from hours to minutes you have to use the arrow key.

Any help you can give would be greatly appreciated.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 31 Jan 2017
8 answers
115 views

I'm writing a custom editor which have to contains 2 drowdown controls: the second dropdown must be filled on values loaded from DB based on value selected in first dropdown. I need to let user add new values for both dropdowns.

I tried two ways but with no success.

First way: I created a custom editor containing 2 DrowDownListEditorElements and I tried to override EndEdit() method of each object to create new items if needed, but it seems that each EndEdit was never invoked and I cannot intercept  when user pass from one dropdown to other, or when exit from the editor.

 

Second way: I created a custom editor containing a user control containing two RadDropDownList controls and I used the Leave event of each dropDown to obtain excepted behaviour, but all I obtained is that EndEdit() of editor was first called before other event of child/nested controls.(for example if user press TAB when focused on second dropdown, editor EndEdit is fired before the drowdown Leave event handler, so new values aren't created yet and Editor value has not been set.

What's the correct way to manage events in complex grid cell custom editors?

Thnaks.

 

 

Alessio Bulleri
Top achievements
Rank 1
 answered on 30 Jan 2017
3 answers
263 views

Dear Telerik,

I am using winworms PivotGrid and PivotFeildList.

In the PivotFieldlist I want to have more aggregate functions like upper quartile and lower quartile.

Plese let me know if it is possible to make a custom function.

Thanks,

Nishan.

Hristo
Telerik team
 answered on 26 Jan 2017
1 answer
170 views

I am running into a memory issue when trying to perform a mail merge. I need to do two things:
1. Generate individual PDF files to be stored on a file share
2. generate a single PDF so it could be sent to a printer as a single job.

I am noticing, that after my large PDF file is generated, the memory usage remains very large. When I re-run the process, it starts climbing up, but then falls back down to an acceptable level during the generation of single document, only to climb back up during the final single PDF. I am pasting my code below. For some odd reason my random data isn't actually making it into the files, but since that's not my problem at this moment, I am not concerned about it.

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Telerik.WinForms.Documents.FormatProviders.OpenXml.Docx;
using Telerik.WinForms.Documents.FormatProviders.Pdf;
using Telerik.WinForms.Documents.Model;
 
namespace MailMergeMemoryBenchmark
{
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        List<DummyItem> dataSource;
        public RadForm1()
        {
            //get the rest of the string at http://pastebin.com/i6PZiJ1c
            byte[] template = Convert.FromBase64String(@"UEsDBBQ...[TRUNCATED]");
            dataSource = new List<DummyItem>();
            for (int i = 0; i < 1000; i++)
            {
                dataSource.Add(DummyItem.GetRandom());
            }
            InitializeComponent();
            var provider = new DocxFormatProvider();
            radRichTextEditor1.Document = provider.Import(template);
            radRichTextEditor1.ScaleFactor = new Telerik.WinForms.Documents.Model.SizeF(.4f, .4f);
            radRichTextEditor1.ChangeAllFieldsDisplayMode(FieldDisplayMode.Code);
            radRichTextEditor1.Document.ShowMergeFieldsHighlight = true;
            radRichTextEditor1.Document.MailMergeDataSource.ItemsSource = dataSource;
        }
 
        private async void btnPerformMailMerge_Click(object sender, EventArgs e)
        {
            btnPerformMailMerge.Enabled = false;
            var progress = new Progress<string>(value => UpdateProgress(value));
            await Go(progress);
            btnPerformMailMerge.Enabled = true;
        }
 
        private void UpdateProgress(string value)
        {
            radLabel1.Text = value + Environment.NewLine;
        }
 
        private Task<bool> Go(IProgress<string> progress)
        {
            return Task.Run(() =>
            {
                var pdfProvider = new PdfFormatProvider();
 
                PdfExportSettings pdfExportSettings = new PdfExportSettings()
                {
                    ContentsCompressionMode = PdfContentsCompressionMode.Automatic,
                    ContentsDeflaterCompressionLevel = 9,
                    FloatingUIContainersExportMode = PdfInlineUIContainersExportMode.Image,
                    ImagesCompressionMode = PdfImagesCompressionMode.Automatic,
                    ImagesDeflaterCompressionLevel = 9,
                    InlineUIContainersExportMode = PdfInlineUIContainersExportMode.Image,
                };
                pdfProvider.ExportSettings = pdfExportSettings;
                byte[] letterBytes;
                radRichTextEditor1.Document.MailMergeDataSource.MoveToFirst();
                int i = 0;
                do
                {
                    using (var document = radRichTextEditor1.Document.MailMergeCurrentRecord())
                    {
                        letterBytes = pdfProvider.Export(document);
                        File.WriteAllBytes($"{i}-{DateTime.Now.Ticks}.pdf", letterBytes);
                    }
                    letterBytes = null;
                    progress.Report($"Merged {i + 1} out of {dataSource.Count()}");
                    i++;
                } while (radRichTextEditor1.Document.MailMergeDataSource.MoveToNext());
                progress.Report($"Starting large PDF creation");
                using (var document = radRichTextEditor1.MailMerge(true))
                {
                    letterBytes = pdfProvider.Export(document);
                    File.WriteAllBytes($"ALL RECORDS-{DateTime.Now.Ticks}.pdf", letterBytes);
                }
                progress.Report($"Done with large PDF creation");
                letterBytes = null;
                pdfProvider = null;
                pdfExportSettings = null;
                GC.Collect();
                return true;
            });
        }
 
 
    }
 
    internal class DummyItem
    {
        public string ContactName;
        public string CompanyName;
        public string Address;
        public static DummyItem GetRandom()
        {
            return new DummyItem()
            {
                ContactName = RandomStringGenerator.RandomString(20, 40),
                CompanyName = RandomStringGenerator.RandomString(20, 40),
                Address = RandomStringGenerator.RandomString(100, 200)
            };
        }
    }
 
    internal static class RandomStringGenerator
    {
        private const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ";
        private static Random random = new Random();
        public static string RandomString(int minLength, int maxLength)
        {
            var length = random.Next(minLength, maxLength);
            return new string(Enumerable.Repeat(chars, length)
              .Select(s => s[random.Next(s.Length)]).ToArray());
        }
    }
}
Hristo
Telerik team
 answered on 26 Jan 2017
3 answers
104 views

I'm working with radrichtexteditor and I'm trying to insert section breaks, the problems is that I need the next section to star on the same page, I don't have this option, as I only have NextPage,EvenPage and OddPage. Please let me know if there's a way to accomplish this.

My versions
UI for WinForms is 2015.2.728
radrichtexteditor is v4.0.30319

Thank you.

 

Hristo
Telerik team
 answered on 26 Jan 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?