Telerik Forums
UI for WinForms Forum
3 answers
335 views
In my Windows forms application I'm using GetLocationFromViewPoint method to get the coordinates when drawing a rectangle on the Pdf file.Again when I'm loading the same Pdf I need to draw the rectangle using the coordinates defined in the earlier case. But when drawing the rectangle the Y coordinate is incorrrectly drawn. The problem here is I'm using the RadFixedPageElement positions for the GetLocationFromViewPoint method and Now I need to get the RadPdfViewerElement coordinates to draw the rectangle in correct position. Is there any way to get this done ? Please help.
Hristo
Telerik team
 answered on 12 Oct 2017
8 answers
852 views
Hi,

I've put a custom checkbox in the header in order to select/unselect all row's checkbox. I use this code:

public class CheckBoxHeaderCell : GridHeaderCellElement 
    { 
        RadCheckBoxElement checkbox; 
 
        public CheckBoxHeaderCell(GridViewColumn column, GridRowElement row) 
            : base(column, row) 
        { 
        } 
 
        protected override void DisposeManagedResources() 
        { 
            checkbox.ToggleStateChanged -= new StateChangedEventHandler(checkbox_ToggleStateChanged); 
            base.DisposeManagedResources(); 
        } 
 
 
        protected override void CreateChildElements() 
        { 
            base.CreateChildElements(); 
            checkbox = new RadCheckBoxElement(); 
            checkbox.ToggleStateChanged += new StateChangedEventHandler(checkbox_ToggleStateChanged); 
            this.Children.Add(checkbox); 
            ApplyThemeToElement(checkbox, "ControlDefault"); 
        } 
 
        protected override SizeF ArrangeOverride(SizeF finalSize) 
        { 
            base.ArrangeOverride(finalSize); 
            if (checkbox != null
            { 
                RectangleF rect = GetClientRectangle(finalSize); 
                checkbox.Arrange(new RectangleF(rect.Right - 20, (rect.Height - 20) / 2, 20, 20)); 
            } 
            return finalSize; 
        } 
 
        private void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args) 
        { 
            this.GridControl.BeginEdit();                   
            for (int i = 0; i < this.GridControl.Rows.Count; i++) 
            { 
                this.GridControl.Rows[i].IsSelected = true
                this.GridControl.Rows[i].IsCurrent = true;                 
                this.GridControl.Rows[i].Cells["Mostrar"].Value = this.checkbox.IsChecked; 
            } 
            this.GridControl.EndEdit(); 
        } 
 
        private void ApplyThemeToElement(RadItem item, string themeName) 
        { 
            DefaultStyleBuilder builder = ThemeResolutionService.GetStyleSheetBuilder((RadControl)item.ElementTree.Control, 
                item.GetThemeEffectiveType().FullName, string.Empty, themeName) as DefaultStyleBuilder; 
 
            if (builder != null
            { 
                item.Style = new XmlStyleSheet(builder.Style).GetStyleSheet(); 
            } 
        } 
    }  

and:

 private void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e) 
        { 
            if (e.Row is GridTableHeaderRowElement && e.Column.HeaderText == "Mostrar"
            { 
                e.CellElement = new SMPDataAnalyzer.TelerikHeaderGrid.CheckBoxHeaderCell(e.Column, e.Row); 
            }  
        } 


This works fine. But the problem is the following:

I have to detect when the row's checkbox value is change to true or false. I use the ValueChanged event :
private void radGridView1_ValueChanged(object sender, EventArgs e) 
        { 
            try 
            { 
                if (this.radGridView1.ActiveEditor is RadCheckBoxEditor) 
                { 
                    if (radGridView1.CurrentRow.Tag != null
                    { 
                        if ((bool)(this.radGridView1.ActiveEditor.Value) && !tendencias.ContainsKey(Convert.ToInt32(radGridView1.CurrentRow.Tag))) 
                        { 
                            if (radGridView1.SelectedRows.Count > 0) 
                            { 
                                medidastendencia = Controller.CargarValoresMedidas 
                                    (long.Parse(radGridView1.CurrentRow.Cells["PuntoId"].Value.ToString()), 
                                    fechaIni, fechaFin, 
                                    long.Parse(radGridView1.SelectedRows[0].Cells["TipoEspectro"].Value.ToString()), 
                                    long.Parse(radGridView1.SelectedRows[0].Cells["Nbanda"].Value.ToString())); 
 
                                if (medidastendencia.Count > 0) 
                                { 
                                    ScatterPlot scatterPlot = new ScatterPlot(); 
                                    scatterPlot.XAxis = xAxis2; 
                                    scatterPlot.YAxis = yAxis2; 
                                    scatterPlot.Tag = Convert.ToInt32(radGridView1.CurrentRow.Tag); 
                                    scatterGraphTendencias.Plots.Add(scatterPlot); 
                                    int i = 0; 
                                    double[] fechas = new double[medidastendencia.Count]; 
                                    double[] values = new double[medidastendencia.Count]; 
                                    foreach (MedidaTendencia mt in medidastendencia) 
                                    { 
                                        fechas[i] = (Double)(DataConverter.Convert(mt.FechaMedida, typeof(Double))); 
                                        values[i] = mt.Valor; 
                                        i++; 
                                    } 
                                    scatterPlot.PlotXY(fechas, values); 
                                    xyCursor2.Plot = scatterPlot; 
                                    xyCursor2.SnapMode = CursorSnapMode.NearestPoint; 
                                    xyCursor2.MoveNext(); 
                                    xyCursor2.MovePrevious(); 
                                    xyCursor2.Visible = true
                                    if (!isTendenciaVisible) 
                                    { 
                                        isTendenciaVisible = true
                                        activeTend(); 
                                    } 
                                    tendencias.Add(Convert.ToInt32(radGridView1.CurrentRow.Tag), values); 
                                } 
                                else 
                                { 
                                    MessageBox.Show(Properties.Resources.ERROR_MEDIDAS_TEND); 
                                } 
                            } 
                        } 
                        else 
                        { 
                            //Se ha puesto a false 
                            if (tendencias.ContainsKey(Convert.ToInt32(radGridView1.CurrentRow.Tag))) 
                            { 
                                int i = 0; 
                                foreach (ScatterPlot plot in scatterGraphTendencias.Plots) 
                                { 
                                    if (plot.Tag.ToString() == radGridView1.CurrentRow.Tag.ToString()) 
                                    { 
                                        if (i > 1) 
                                        { 
                                            xyCursor2.Plot = scatterGraphTendencias.Plots[i - 1]; 
                                            xyCursor2.MoveNext(); 
                                            xyCursor2.MovePrevious(); 
                                        } 
                                        else 
                                        { 
                                            if (scatterGraphTendencias.Plots.Count > 2) 
                                            { 
                                                xyCursor2.Plot = scatterGraphTendencias.Plots[i + 1]; 
                                                xyCursor2.MoveNext(); 
                                                xyCursor2.MovePrevious(); 
                                            } 
                                            else 
                                            { 
                                                xyCursor2.Plot = scatterPlot2; 
                                                xyCursor2.Visible = false
 
                                                desactiveTend(); 
                                            } 
                                        } 
                                        scatterGraphTendencias.Plots.Remove(plot); 
                                        plot.Dispose(); 
                                        break
                                    } 
                                    i++; 
                                } 
                                tendencias.Remove(Convert.ToInt32(radGridView1.CurrentRow.Tag)); 
                            } 
                        } 
                    } 
                } 
            } 
            catch (Exception ex) 
            { 
                string message = ex.Message; 
            } 
        } 


But..., when I use the header checkbox in order to select/unselect all,the ActiveEditor property is null.

¿How do I this?

Thank you,

Fernan,
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Oct 2017
3 answers
629 views
I am a bit confused here.  What I want to do is change the color of the text in the header of a group box.  Here's what I have figured out so far:

Dim

 

 

RE As RadElement = DirectCast(Me.rgbPharmacyInformation.RootElement.Children(0).Children(1).
                                                                    Children(2).Children(1),
RadElement)
The zeroth child of the root element is the RadGroupBoxElement.
The First child of the RadGroupBoxElement is the GroupBoxHeader element.
The second child of the GroupBoxHesder elelemnt is the ImageAndTextLayoutPanel element.
The first child of the ImageAndTextLayoutPanel element is text. 

Looking at the property inspector in VS2010, I see properties for this element and the property I would like to change is the Fioreground color.  But what do I cast the "text" element as (In the above code, the "text" can be successfully cast to a RadElement)?  How can I get to this property?   

Anybody's assistance would be appreciated!  Thank you for your time!

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Oct 2017
1 answer
193 views

Hello there,

I'll try to apply french localization to my project for the richtexteditor telerik control.

I followed this link : http://docs.telerik.com/devtools/winforms/richtexteditor/localization

The RichTextBoxLocalizationProvider isn't full. I looked in the .xml file, and I tried to add some translations (successfully)

There is a global french localization for telerik winforms ? or a richtexteditor french localization ?

 

Thanks,

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Oct 2017
5 answers
193 views

Hi, I try the trial version of component GanttView, but when in my test project assign the dataset to datasource of GantView, VB.Net return a Windows with this message:  "THE APPLICATION IS IN STANBY MODE".

This message is because I use the trial version?

I try to assign the dataset by code and by the binding to database wizard but the result is the same.

Thank you for any response

Hristo
Telerik team
 answered on 12 Oct 2017
2 answers
213 views
Hello,
I need to add "page sizes" combobox on Paging panel (RadGridView), please help me to implement it!
Thanks
Paul
Top achievements
Rank 1
 answered on 12 Oct 2017
1 answer
131 views

I have a small project that uses non-rad controls, that can't be changed to rad controls, and I'd like to use Telerik Themes on those controls. At this point I can't theme anything because of the sheer difference between controls. If I can do it without having to override OnPaint and trying to match Telerik themes, I would be elated.

Using C#, non-WPF (otherwise this would be trivial).

Dimitar
Telerik team
 answered on 11 Oct 2017
1 answer
122 views
Hi!
I´m trying to use the SearchRow of the RadGridView in progress. I active the searchrow using:
THIS-OBJECT:radGridView1:MasterTemplate:AllowSearchRow = TRUE.

But when I try to search it´s get an error:
"You are trying to use a multi-threaded .NET object in a way that is not supported.  The ABL cannot be called on a thread other than the main thread. (15740)"
Somebody find a anwser using progress. I try anything that I see but without success.
Thx for your help.
Dimitar
Telerik team
 answered on 10 Oct 2017
44 answers
3.0K+ views
Hi
I'm using Linq to bind data to a binddatasource which in trun feeds data to a radgridiview.  It works fine when I first bind data to the radgridview.  But if I changed the search criteria and thus the Linq statement, the radgrdiview throws the following exception.

Before I upgrade to 2009Q1 SP1, I need to

                tblitemItemsBindingSource.DataSource = null;  // throw exception if without this statement using 2008Q3
                tblitemItemsBindingSource.DataSource = qItems.OrderBy(i => i.item_Code).ToList();

However, after upgraded to 2009Q1 SP1, the above line is no longer useful.

In my experience, 2009Q1 breaks more things more than it fixes.  I'm very flustrated.

Edwin 

 System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Telerik.WinControls.GridView"
  StackTrace:
       at Telerik.WinControls.UI.BaseGridNavigator.get_CurrentGroup()
       at Telerik.WinControls.UI.BaseGridNavigator.SelectRow(GridViewRowInfo row)
       at Telerik.WinControls.UI.GridTableElement.UpdateCurrentPosition()
       at Telerik.WinControls.UI.GridViewInfo.SetCurrentRow(GridViewRowInfo row, Boolean setPosition, Boolean shift, Boolean control, Boolean rightMouseButton)
       at Telerik.WinControls.UI.GridViewTemplate.SetCurrentRow(GridViewRowInfo rowInfo)
       at Telerik.WinControls.Data.DataAccessComponent.InitDataGrid()
       at Telerik.WinControls.Data.DataAccessComponent.currencyManager_ListChanged(Object sender, ListChangedEventArgs e)
       at System.Windows.Forms.CurrencyManager.OnListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.CurrencyManager.List_ListChanged(Object sender, ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.OnListChanged(ListChangedEventArgs e)
       at System.Windows.Forms.BindingSource.ResetBindings(Boolean metadataChanged)
       at System.Windows.Forms.BindingSource.SetList(IList list, Boolean metaDataChanged, Boolean applySortAndFilter)
       at System.Windows.Forms.BindingSource.ResetList()
       at System.Windows.Forms.BindingSource.set_DataSource(Object value)
       at PopularIT.MOSES.POS.UI.frmSearchItem.fillGrid(Boolean expandRows) in C:\Projects\MOSES.POS\MOSES.POS\UI\frmSearchItem.cs:line 85
       at PopularIT.MOSES.POS.UI.frmSearchItem.txtItemName_KeyDown(Object sender, KeyEventArgs e) in C:\Projects\MOSES.POS\MOSES.POS\UI\frmSearchItem.cs:line 146
       at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
       at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
       at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
       at System.Windows.Forms.Control.WmKeyChar(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
       at System.Windows.Forms.TextBox.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.RunDialog(Form form)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at PopularIT.MOSES.POS.UI.frmSales.btnSearch_Click(Object sender, EventArgs e) in C:\Projects\MOSES.POS\MOSES.POS\UI\frmSales.cs:line 266
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.RunDialog(Form form)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at System.Windows.Forms.Form.ShowDialog()
       at PopularIT.MOSES.POS.UI.frmMain.btnSales_Click(Object sender, EventArgs e) in C:\Projects\MOSES.POS\MOSES.POS\UI\frmMain.cs:line 121
       at PopularIT.MOSES.POS.UI.frmMain.btnSalesNow_Click(Object sender, EventArgs e) in C:\Projects\MOSES.POS\MOSES.POS\UI\frmMain.cs:line 170
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at PopularIT.MOSES.POS.Program.Main() in C:\Projects\MOSES.POS\MOSES.POS\Program.cs:line 82
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
Dimitar
Telerik team
 answered on 10 Oct 2017
1 answer
83 views

Hello,

I have a Radgrid.

What i want to do is, that when a numeric value is negative it should be in forecolor red. This is not the Problem.

But when i group the grid by any of the header other values have forecolor red although the value is not negative and its fieldname is not "erfolg"  or "erfolgprozent".

 

My code is:

 

 If TypeOf e.CellElement.ColumnInfo Is GridViewDataColumn Then
            If DirectCast(e.CellElement.ColumnInfo, GridViewDataColumn).FieldName.ToLower = "erfolg" Or DirectCast(e.CellElement.ColumnInfo, GridViewDataColumn).FieldName.ToLower = "erfolgprozent" Then
                If IsNumeric(e.CellElement.Value) Then
                    If CDbl(e.CellElement.Value) < 0 Then
                        e.CellElement.ForeColor = System.Drawing.Color.Red
                    Else
                        e.CellElement.ForeColor = System.Drawing.Color.Black
                    End If
                End If
            End If
        End If

 

Manuel
Top achievements
Rank 1
 answered on 10 Oct 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)
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?