Telerik Forums
UI for WinForms Forum
1 answer
110 views
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.Windows.Controls;

using Telerik.WinForms.Controls.SyntaxEditor.Taggers;
using Telerik.WinForms.SyntaxEditor.Core.Tagging;
using Telerik.WinControls.UI;
using Telerik.WinForms.Controls.SyntaxEditor.UI;
using System.IO;

namespace WindowsFormsApp12
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public class PythonTagger : WordTaggerBase
        {
            private static readonly string[] Keywords = new string[]
    {
        "False", "None", "True", "and", "as", "assert","break", "class",
        "continue", "def", "del", "elif", "else", "except", "for", "from",
        "global", "if", "import", "in", "is", "lambda", "nonlocal", "not",
        "or", "pass", "raise", "finally", "return", "try", "while", "with", "yield"
    };

            private static readonly string[] Comments = new string[]
    {
        "#"
    };

            private static readonly string[] Operators = new string[]
    {
        "+", "-",  "*", "/"
    };

            public static readonly ClassificationType FruitsClassificationType = new ClassificationType("Fruits");

            private static readonly string[] Fruits = new string[]
    {
        "apple", "banana",  "cherry"
    };

            private static readonly Dictionary<string, ClassificationType> WordsToClassificationType = new Dictionary<string, ClassificationType>();

            static PythonTagger()
            {
                WordsToClassificationType = new Dictionary<string, ClassificationType>();

                foreach (var keyword in Keywords)
                {
                    WordsToClassificationType.Add(keyword, ClassificationTypes.Keyword);
                }

                foreach (var preprocessor in Operators)
                {
                    WordsToClassificationType.Add(preprocessor, ClassificationTypes.Operator);
                }

                foreach (var comment in Comments)
                {
                    WordsToClassificationType.Add(comment, ClassificationTypes.Comment);
                }

                foreach (var comment in Fruits)
                {
                    WordsToClassificationType.Add(comment, FruitsClassificationType);
                }
            }

            public PythonTagger(RadSyntaxEditorElement editor)
                : base(editor)
            {
            }

            protected override Dictionary<string, ClassificationType> GetWordsToClassificationTypes()
            {
                return PythonTagger.WordsToClassificationType;
            }

            protected override bool TryGetClassificationType(string word, out ClassificationType classificationType)
            {
                int number;

                if (int.TryParse(word, out number))
                {
                    classificationType = ClassificationTypes.NumberLiteral;
                    return true;
                }

                return base.TryGetClassificationType(word, out classificationType);
            }
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            PythonTagger pythonTagger = new PythonTagger(this.radSyntaxEditor1.SyntaxEditorElement);
            if (!this.radSyntaxEditor1.TaggersRegistry.IsTaggerRegistered(pythonTagger))
            {
                this.radSyntaxEditor1.TaggersRegistry.RegisterTagger(pythonTagger);
            }

            this.radSyntaxEditor1.TextFormatDefinitions.AddLast(ClassificationTypes.NumberLiteral, new TextFormatDefinition(new SolidBrush(Color.Red)));
            this.radSyntaxEditor1.TextFormatDefinitions.AddLast(ClassificationTypes.Operator, new TextFormatDefinition(new SolidBrush(Color.YellowGreen)));
            this.radSyntaxEditor1.TextFormatDefinitions.AddLast(PythonTagger.FruitsClassificationType, new TextFormatDefinition(new SolidBrush(Color.LightCoral)));


            StreamReader  reader = new StreamReader(@"C:\Python27amd64\Lib\msilib\text.py");
            {
                radSyntaxEditor1.Document = new     Telerik.WinForms.SyntaxEditor.Core.Text.TextDocument(reader);
            }


        }

        private void radMenuItem2_Click(object sender, EventArgs e)
        {
            StreamReader reader = new StreamReader(@"C:\Python27amd64\Lib\ctypes\util.py");
            {
                radSyntaxEditor1.Document = new Telerik.WinForms.SyntaxEditor.Core.Text.TextDocument(reader);
            }

        }

        private void radSyntaxEditor1_Click(object sender, EventArgs e)
        {

        }
    }
}
Nadya | Tech Support Engineer
Telerik team
 answered on 01 Nov 2023
1 answer
121 views

Is it possible to mimic an <hr> tag in the Html markup functionality?  Trying to create dividers in the RadLabel control.  Has anyone implemented something similar?

Thanks!

Dinko | Tech Support Engineer
Telerik team
 answered on 31 Oct 2023
2 answers
141 views
I'm using RadSpreadsheet with the ribbon bar to display a generated Excel workbook.  Users want to save the workbook via the Save ribbon button, but they want a default filename in the save dialog (not "book1.xlsx").  I can't figure out how to get there from current documentation and other forum questions.  Please advise.  Hoping I can access it without overriding the whole framework that already does most of the work for me.
Andy F.
Top achievements
Rank 1
Iron
 answered on 27 Oct 2023
0 answers
94 views

Hi,

When form loads scroll bar missing as well as summary also missing but when i resize the form it appear and work appropriately.
I believe this is some visual glitch. Please provide me some solution for this.
I am attaching gif image which ca explain you my concern.

Check the below attached zip file for more reference.

Amol
Top achievements
Rank 1
 asked on 27 Oct 2023
1 answer
118 views

Hi,

I'm looking into the viability of using the WinForms RadSyntaxEditor for a small project.

I think I've come across a bug when it comes to DPI scaling.

The component itself seems to work fine with DPI scaling except for the search/find functionality. When you search for some text and click to go to the first instance it finds, the actual text is off screen, though it is highlighted correctly (when you scroll down you can see it highlighted).

If I set the CaretPosition manually to a line further in the document, it also displays correctly so it seems to be specifically limited to the  built-in Search/Find panel.

This is easy to replicate by changing Windows display scale to anything other than 100%.

Nadya | Tech Support Engineer
Telerik team
 answered on 26 Oct 2023
1 answer
99 views

we are using the RichTextEditor to display a DOCX file. HOwever, I can not for the life of me figure out to remove/close the document once it has been assigned to the Document property on the RichTextEditor control. I know this is probably simple, but I am just not seeing anything like a CLOSE(), EXIT(), CLEAR() and Setting Document = null crashes.  

 

TIA

Mark

Nadya | Tech Support Engineer
Telerik team
 answered on 25 Oct 2023
1 answer
99 views

Hi,

I try to add checkboxes to page.

I try to this code, but it is not working:

var nve = this.radNavigationView1.NavigationViewElement;
                foreach (var item in nve.Items) {
                    RadCheckBoxElement cb = new RadCheckBoxElement();
                    cb.ToggleStateChanged += cb_ToggleStateChanged;                
                    item.ButtonsPanel.Children.Add(cb);
                }

Thanks in advance!

 

Nadya | Tech Support Engineer
Telerik team
 answered on 25 Oct 2023
1 answer
153 views

I have a Form with 4 group boxes each containing 2 radio buttons - Yes and No - obviously each set mutually exclusive. The IsChecked properties of each are bound to boolean values. All 8 properties are set to false. However, when the form displays, the first Yes button is checked. Even when I unbind them and explicitly set them all to false, the first option is set t true.

s there any way for all buttons to be set to false?

Thanks

Carl

Nadya | Tech Support Engineer
Telerik team
 answered on 25 Oct 2023
8 answers
512 views

Hi,

 

Is it possible to use paging and just retrieve data for each page (i.e if you go to a new page the data for that page will be loaded)?

 

The issue i'm having right now is that the result from the server (currently with WCF) has contain all the records in order for the paging to work, however, I dont want to send all the data at once.

 

Maybe there is a way to manipulate the TotalPages-property to think it has more data in the result?

Giovanni
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 24 Oct 2023
1 answer
84 views
I have a RadWizard control in my project and I set the BackColor property to a custom color. Whenever I make any changes to the code in the cs file of the RadWizard the BackColor property resets to white. Is there some reason this may be occurring or is this a bug?
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Oct 2023
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
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
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
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?