Telerik Forums
UI for WinForms Forum
1 answer
296 views

Hi Telerik Forum,
I'd like to put a bookmark (or another marker) on severals fragment doc (inserted programmatically into the radrichtexteditor) in order to easily select them / delete them / replace the whole text/table inside them. I tried to use textrange object in order to do it but without success.
I don't know what's the best approach to do theses actions above.

Some precision about my app :
* my paragraphs text comes from database in html format, so i use htmlprovider to insert them into my final document
* user can modify paragraph with different buttons in order to change the defaults paragraphs generated before

Thx for your help :)

Here's my sample code :

Shared Sub GenerateDocument(rte As RadRichTextEditor)
    Dim document = New RadDocument()
    rte.Document = document
 
    Dim htmlProvider = New HtmlFormatProvider()
    Dim parHtml1 = "<span>Start of Paragrah1</span><br/><table style='border:1px solid black'><tr><td>Desc.</td><td>Value</td></tr><tr><td>Variable1</td><td>10.23</td></tr></table>Some text after the table<br/><span>End of Paragrah1</span><br/>"
    Dim parHtml2 = "<span>Start of Paragrah2</span><br/>Some text before creating table<table style='border:1px solid black'><tr><td>Desc.</td><td>Value</td></tr><tr><td>Variable2</td><td>50.18</td></tr></table><br/><span>End of Paragrah2</span><br/>"
 
    'Converting html to raddoc
    Dim docPar1 = htmlProvider.Import(parHtml1)
    Dim docPar2 = htmlProvider.Import(parHtml2)
 
    'Creating fragments
    Dim fragmentPar1 = New DocumentFragment(docPar1)
    Dim fragmentPar2 = New DocumentFragment(docPar2)
 
    Dim documentEditor As New RadDocumentEditor(document)
 
    'Inserting paragraph 1
    rte.Document.CaretPosition.MoveToLastPositionInDocument()
    documentEditor.InsertBookmark("bookmarkPar1")
    documentEditor.InsertFragment(fragmentPar1)
 
    'Inserting paragraph 2
    rte.Document.CaretPosition.MoveToLastPositionInDocument()
    documentEditor.InsertBookmark("bookmarkPar2")
    documentEditor.InsertFragment(fragmentPar2)
 
    'Trying of selecting / delete / replace all content in specified bookmark (that doesn't work)
    SelectAndUpdateContentBookmark("bookmarkPar1", rte, String.Empty) 'only select
    SelectAndUpdateContentBookmark("bookmarkPar2", rte, "New content") 'select and replace with new text
End Sub
 
Shared Sub SelectAndUpdateContentBookmark(ByVal bookmarkName As String, rte As RadRichTextEditor, newContent As String)
    rte.Focus()
 
    Dim bookmarks() As BookmarkRangeStart = rte.Document.GetAllBookmarks().ToArray()
    Dim posstart As New DocumentPosition(rte.Document)
    Dim posend As New DocumentPosition(rte.Document)
    Dim item = bookmarks.Where(Function(x) x.Name = bookmarkName).FirstOrDefault
 
    If item IsNot Nothing Then
        rte.Document.GoToBookmark(item)
        posstart.MoveToInline(TryCast(item.FirstLayoutBox, InlineLayoutBox), 0)
        posend.MoveToInline(TryCast(item.End.FirstLayoutBox, InlineLayoutBox), 0)
        posstart.MoveToNextInline()
        rte.Document.Selection.SetSelectionStart(posstart)
        rte.Document.Selection.AddSelectionEnd(posend)
 
        'Replacing with new content
        If Not String.IsNullOrEmpty(newContent) Then
            rte.Delete(False)
            rte.Insert(newContent)
        End If
    End If
End Sub

Hristo
Telerik team
 answered on 24 Mar 2016
1 answer
117 views

I have a series where I am using the "LabelFormatting" event to color scatter points individually, and I would like to paint the legend item as a gradient to reflect that is not a single color but I cannot tell how to accomplish it. I am also using something I saw in the forums for adding checkboxes to the legend via handling the VisualItemCreating and replacing with my own derived LegendItemElement. After creating the child elements I am looking at the legend item marker and I see a lot of properties for gradients but no way to activate them.

 

I've also tried setting the BackColor and BackColor2 of the series, as well as NumberOfColors = 2 with no effect.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Mar 2016
1 answer
197 views
Dear support staff,
I am currently working on a project with a very large table(millions of records) in a remote database using c# and mysql database.
Without going in to too much details,  I use the datagridview in VS2010 with the (Virtual Mode with Just-In-Time Data Loading)
as illustrated in this article:

https://msdn.microsoft.com/en-us/library/ms171624%28v=vs.110%29.aspx

Does your gridview support the Virtual Mode with Just-In-Time Data Loading or any thing similar to it that retrieve query result in potions?

yours Murad
Dimitar
Telerik team
 answered on 24 Mar 2016
1 answer
167 views

I am evaluating RadGridview. I need to create lots of custom editors for my upcoming project. To begin with, I just created a simple texteditor with the following code (I referred you demo code for this) .The issue is, the control losing the first key stroke. Suppose I start to edit a column by typing "John" then the column only showing "ohn". 

Did I miss something ??

 

class MyTextEditor : BaseGridEditor
   {
       public RadFormProductList ListForm { get; set; }
       protected override RadElement CreateEditorElement()
       {
           var editor = new MyTextEditorElement();
           return editor;
       }
       public override object Value
       {
           get
           {
               MyTextEditorElement editor = (MyTextEditorElement)this.EditorElement;
               return editor.Text;
           }
           set
           {
               MyTextEditorElement editor = (MyTextEditorElement)this.EditorElement;
               if (value != null && value != DBNull.Value)
               {
                   editor.Text = value.ToString();
               }
               else
               {
                   editor.Text = "";
               }
           }
       }
      
   }
 
   public class MyTextEditorElement : RadTextBoxElement
   {
       public MyTextEditorElement()
       {
           this.BackColor = Color.White;
           this.ShowBorder = false;
       }
 
       protected override Type ThemeEffectiveType
       {
           get
           {
               return typeof(RadTextBoxEditorElement);
           }
       }
 
   }

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Mar 2016
3 answers
93 views

I have a scatter series, and setting the Shape to Telerik.WinControls.UI.DiamondShape does not work. It gives me no markers at all.

Dimitar
Telerik team
 answered on 24 Mar 2016
2 answers
174 views

With this code I get the following (NOT_OK.png)

01.Private Sub RadGridView1_ViewCellFormatting(sender As Object, e As CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting
02.    If TypeOf e.CellElement Is GridHeaderCellElement Then
03.        With e.CellElement
04.            Dim myFont As New Font(New FontFamily("Calibri"), 10.0F, FontStyle.Bold)
05. 
06.            If InStr(.Text, "IN") > 0 Then
07.                xColor = Color.FromArgb(150, 54, 52)
08.            ElseIf InStr(.Text, "OUT") > 0 Then
09.                xColor = Color.FromArgb(54, 96, 146)
10.            ElseIf .Text = "Fecha" Then
11.                xColor = Color.FromArgb(38, 38, 38)
12.            End If
13. 
14.            .DrawBorder = True
15.            .DrawFill = True
16. 
17.            .Font = myFont
18.            .ForeColor = Color.White
19.            .GradientStyle = GradientStyles.Solid
20.            .BackColor = xColor
21.        End With
22.    Else
23.        Dim xColor As Color = Color.Red
24.        Dim xWidth As Integer = 5
25.        With e.CellElement
26.            '.DrawFill = True
27.            '.NumberOfColors = 1
28.            '.BorderBoxStyle = BorderBoxStyle.FourBorders
29.            Select Case .ColumnIndex
30.                Case 9 '0, 9, 16
31.                    .BorderRightColor = xColor
32.                    .BorderRightWidth = xWidth
33.            End Select
34.        End With
35.    End If
36.End Sub

 

what I need is OK.png

 

Thank you,

 

 

Jorge
Top achievements
Rank 1
 answered on 23 Mar 2016
3 answers
265 views
Hi,

I need an event that fire only after the contents of PDF is displayed. The DocumentLoaded is fired after the .pdf load, but not displayed yet.

Thanks

Paulo
Dimitar
Telerik team
 answered on 23 Mar 2016
1 answer
87 views

In certain cases, the property builder  totally corrupts your windows form and makes the Rad grid unsable, undeletable and un-editable . It happens If you inadvertently click "Open Property Builder" on a RadGridView while your project is running (yes, sometimes you forget it is running and still have the form designer window open), if you try and make some changes to the MasterTemplate and click "Ok" it renames your grid to "MasterTemplate" and makes it unsable, even while your program is running. 

The grid then becomes corrupt and you cant delete it or fix it.

 

Test it by starting a new VB winforms project in VS2015, drag a radgrid onto the form, run the exe in VS and then click on property builder on the rad grid. make a few changes to master template and click ok. 

Your form will now be unrecoverably corrupt.

 

 

 

Hristo
Telerik team
 answered on 22 Mar 2016
3 answers
548 views
Have someone tried to connect the ganttview with a SQLite database?
Hristo
Telerik team
 answered on 22 Mar 2016
3 answers
305 views

Good day!

It is necessary that the Scheduler worked with MySQL database and not MsAccess. And, preferably, to explain the connection and filling in the data via code and not using the Visual Studio.

Best regards, Me!

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 22 Mar 2016
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
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
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
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?