Telerik Forums
UI for WinForms Forum
1 answer
250 views

Hello

I am using the RichTextEditor control to allow users to create a document (which may include embedded images). The RTF text is then stored in a database, and a Windows Service is supposed to print the document at a later date.The Windows Service does not allow any dialog or form to be shown, so neither a normal print dialog, nor converting to PDF and printing with a PDF Viewer can be used to print.

My current approach has been to convert the RTF to a PDF with RtfFormatProvider and PdfFormatProvider, save it to a file, and print it using the Print verb. However, no matter what options are given to the Print process, it still tries to start the Adobe PDF Viewer to print.

Does Telerik offer a way to print RTF documents without any UI? Or perhaps stock WinForms has a way that I am overlooking. 

I am using version Q3 2014 (2014.3.1104)

Thank you for any assistance.

Stefan
Telerik team
 answered on 21 Sep 2015
3 answers
358 views
Hi, I am trying to apply custom sorting to a grouping column designed programatically that is binding to the grid as string.

The problem is that I cannot get event fired because for example I do not allow user to sort the columns, It is made programatically  and it is fixed by design.

How can I apply a custom sorting method to a grid designed programatically for a grouping column and that it is fixed ??

example:

Column         Column
======         ======
4                    1
2;33               2
1;35               4
11                  5
2                    11
1                    13
13                  1;35
5                    2;33

I have been trying to apply this example but I can not get it works, for example events do not fire.
http://www.telerik.com/help/winforms/gridview-sorting-custom-sorting.html

Any help would be appreciated.

//
// radGrid
//
this.radGrid.MasterTemplate.AllowSearchRow = true;
this.radGrid.MasterTemplate.AutoExpandGroups = true;
this.radGrid.MasterTemplate.EnableFiltering = true;
this.radGrid.MasterTemplate.MultiSelect = true;
this.radGrid.MasterTemplate.ShowFilteringRow = false;
this.radGrid.MasterTemplate.ShowHeaderCellButtons = true;
this.radGrid.MasterTemplate.HorizontalScrollState = Telerik.WinControls.UI.ScrollState.AlwaysShow;
this.radGrid.Name = "radGrid";
this.radGrid.ReadOnly = true;
this.radGrid.ShowHeaderCellButtons = true;
this.radGrid.Size = new System.Drawing.Size(1028, 262);
this.radGrid.TabIndex = 5;
this.radGrid.Text = "Test Results Browser Grid";
this.radGrid.SelectionChanged += new System.EventHandler(this.radGrid_SelectionChanged);
this.radGrid.CellClick += new Telerik.WinControls.UI.GridViewCellEventHandler(this.radGrid_CellClick);
this.radGrid.ContextMenuOpening += new Telerik.WinControls.UI.ContextMenuOpeningEventHandler(this.radGrid_ContextMenuOpening);
this.radGrid.FilterExpressionChanged += new Telerik.WinControls.UI.GridViewFilterExpressionChangedEventHandler(this.radGrid_FilterExpressionChanged);
this.radGrid.FilterChanged += new Telerik.WinControls.UI.GridViewCollectionChangedEventHandler(this.radGrid_FilterChanged);
this.radGrid.Click += new System.EventHandler(this.radGrid_Click);
 
private void ConfigureRadGridGrouping()
{                     
  GroupDescriptor groupByBall = new GroupDescriptor();
  groupByBall.GroupNames.Add("Balls", ListSortDirection.Ascending);
 
  this.radGrid.EnableCustomGrouping = false;
  this.radGrid.GroupDescriptors.BeginUpdate();
  this.radGrid.GroupDescriptors.Add(groupByBall);
  this.radGrid.GroupDescriptors.EndUpdate();
}
 
private void AsignTitlesToRadGridBrowser()
{
   /// Telerik
 
   foreach (var column in this.radGrid.Columns)
   {
    column.HeaderText = string.Empty;
    column.IsVisible = false;
    column.VisibleInColumnChooser = false;
   }
 
   this.radGrid.Columns["Reference"].HeaderText = "Reference";
   this.radGrid.Columns["Reference"].IsVisible = true;
   this.radGrid.Columns["Reference"].VisibleInColumnChooser = true;
   this.radGrid.Columns["Reference"].AllowGroup = true;
 
   this.radGrid.Columns["Title"].HeaderText = "Title";
   this.radGrid.Columns["Title"].IsVisible = true;
   this.radGrid.Columns["Title"].VisibleInColumnChooser = true;
   this.radGrid.Columns["Title"].AllowGroup = true;
    
   this.radGrid.Columns["Balls"].HeaderText = "Balls";
   this.radGrid.Columns["Balls"].IsVisible = true;
   this.radGrid.Columns["Balls"].VisibleInColumnChooser = true;
   this.radGrid.Columns["Balls"].AllowGroup = true;
}  
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 21 Sep 2015
5 answers
862 views
Is there any way to add page number and repeat column header on every page when exporting gridview to pdf?
Thanks
Stefan
Telerik team
 answered on 21 Sep 2015
6 answers
407 views
Hi,

I am trying to create three TileGroupElements and add them to the range of the Panorama. After I am adding the tiles to each group, but the groups nor the tiles are showing on the screen. Please let me know any ways I could do this through code.
Stefan
Telerik team
 answered on 21 Sep 2015
2 answers
289 views

Hello,

Is there a way to change the default appointment times to use military time instead of regular time?  So instead of the appointment time showing 1:00 - 2:00 it would show 13:00 - 14:00.

Kind regards,

David

David
Top achievements
Rank 1
 answered on 18 Sep 2015
2 answers
75 views

Hello,

I have a PDF that contains fields that I have added with Acrobat. If I put values in those fields and display the PDF with the Viewer, neither the fields nor their values have any kind of representation on the display. How do I get these to show up?

To clarify, the rest of the PDF renders fine. It's simply the fields and their values that aren't showing up at all.

Thanks!

Michael
Top achievements
Rank 1
 answered on 18 Sep 2015
3 answers
163 views

I have a problem for this scenario

 Some External hardware device for passing message to the grid

GridViewRowInfo rowinfo = radGridView1.Rows.AddNew();

rowinfo.Cells[0] = 12  // which is the id

rowinfo.Cells[1] = "Some Values"

 

someTableAdatper.Update(someDataSet)

 

Since ID is unique generate, is there way to get that ID+1 auto generate or I have to found out the # of row and + 1 to it?

 

 

 

 

 

 

 

 

 

Dimitar
Telerik team
 answered on 18 Sep 2015
7 answers
807 views
Hi,
I have two questions

Hyperlink Like Column:
    Basically I have to display a list of columns where some columns will be used as hyperlink to take it to their details.How to get a column as hyperlink in window gridview which will take it to new form.

All I want to be able to add a column like the normal data grid view control where the user can click the text which appears like a hyperlink and have some action occur.
 
Change the Font:
I have a workaround solution if cannot create hyperlink like column.Change the color of the cellelement to Blue and underline.And on cell element click we can take it to new form.How to change the font of the cell element in runtime.I can see font.underline is readonly.?

Please help

Stefan
Telerik team
 answered on 18 Sep 2015
2 answers
175 views

I've got a lot of images I need to load in from a directory into a project where I display a full-screened radrotator on a secondary monitor. I want to be able to show a slideshow of pictures, but I need them to properly fit the screen, and I'd like ones that are strange sizes to be horizontally and vertically centered. All of this seems to be working with my code so far except the centering part...

Here is my code:

 

Imports System.Windows.Forms
Imports Telerik.WinControls.UI
Imports System.IO
Imports System.Security.Cryptography
 
Public Class formSlideshow
 
    Private Sub ShapedForm1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Me.FormBorderStyle = FormBorderStyle.None
        Me.Bounds = GetSecondaryScreen().Bounds
        Dim screensize As New Drawing.Size(Me.Width, Me.Height)
        RadRotator1.Size = screensize
        RadRotator1.Interval = (CInt(Val(formSettings.Interval)) * 1000)
 
        If LoadImages() = True Then RadRotator1.Start()
    End Sub
 
    '--Get size and location of secondary monitor
    Public Function GetSecondaryScreen() As System.Windows.Forms.Screen
        For Each windowscreen As System.Windows.Forms.Screen In System.Windows.Forms.Screen.AllScreens
            If Not windowscreen Is System.Windows.Forms.Screen.PrimaryScreen Then
                Return windowscreen
            End If
        Next
        Return Screen.PrimaryScreen
    End Function
 
    '--Load images into radRotator
    Public Function LoadImages() As Boolean
        Try
            Dim imageslist As New List(Of String)
 
            '--Get employees personal images
            For Each employeeimage As String In Directory.GetFiles(formSettings.EmployeeDir)
                If Path.GetExtension(employeeimage) = ".jpeg" Or Path.GetExtension(employeeimage) = ".png" Or Path.GetExtension(employeeimage) = ".jpg" Then
                    imageslist.Add(employeeimage)
                End If
            Next
 
            '--Get default images
            For Each defaultimage As String In Directory.GetFiles(formSettings.DefaultDir)
                If Path.GetExtension(defaultimage) = ".jpeg" Or Path.GetExtension(defaultimage) = ".png" Or Path.GetExtension(defaultimage) = ".jpg" Then
                    imageslist.Add(defaultimage)
                End If
            Next
 
            '--Randomize order of images
            imageslist.Sort(New Randomizer(Of String)())
 
            '--Add images to radRotator item list
            For Each imagefile As String In imageslist
                Dim newimage As Image = Image.FromFile(imagefile)
                Dim rotatoritem As New RadImageItem()
                rotatoritem.Image = ScaleImage(newimage, 768, 1366)
                RadRotator1.Items.Add(rotatoritem)
            Next
 
            Return True
 
        Catch ex As Exception
            Return False
        End Try
 
        Return False
    End Function
 
    '--Shrink images to fit screen, proportionately
    Public Function ScaleImage(ByVal OldImage As Image, ByVal TargetHeight As Integer, ByVal TargetWidth As Integer) As System.Drawing.Image
 
        Try
            Dim NewHeight As Integer = TargetHeight
            Dim NewWidth As Integer = NewHeight / OldImage.Height * OldImage.Width
 
            If NewWidth > TargetWidth Then
                NewWidth = TargetWidth
                NewHeight = NewWidth / OldImage.Width * OldImage.Height
            End If
 
            Return New Bitmap(OldImage, NewWidth, NewHeight)
 
        Catch ex As Exception
            Return Nothing
        End Try
 
        Return Nothing
    End Function
End Class
 
 
Public Class Randomizer(Of T)
    Implements IComparer(Of T)
 
    '--Insures different instances are sorted in different orders
    Private Shared Salter As New Random() '--Only as random as your seed
    Private Salt As Integer
    Public Sub New()
        Salt = Salter.Next(Integer.MinValue, Integer.MaxValue)
    End Sub
 
    Private Shared sha As New SHA1CryptoServiceProvider()
    Private Function HashNSalt(ByVal x As Integer) As Integer
        Dim b() As Byte = sha.ComputeHash(BitConverter.GetBytes(x))
        Dim r As Integer = 0
        For i As Integer = 0 To b.Length - 1 Step 4
            r = r Xor BitConverter.ToInt32(b, i)
        Next
 
        Return r Xor Salt
    End Function
 
    Public Function Compare(x As T, y As T) As Integer _
        Implements IComparer(Of T).Compare
 
        Return HashNSalt(x.GetHashCode()).CompareTo(HashNSalt(y.GetHashCode()))
    End Function
End Class

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 18 Sep 2015
2 answers
87 views
How can i Hide the sub total and grand total from the grid
Vivek
Top achievements
Rank 1
 answered on 18 Sep 2015
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)
Form
Chart (obsolete as of Q1 2013)
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
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
NavigationView
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
SplashScreen
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?