Telerik Forums
UI for WinForms Forum
7 answers
1.1K+ views
I am working on a Windows Forms Application that automatically loads a PDF file and then scrolls through the pages.  I am using 2 timers, one to scroll the page, and the other to check for a new version of the PDF file.  When I find a new version of the PDF file, I unload the current file and then load the new file.  All of this appears to work.  The problem is that the document does not appear unless I click on the form.  I can see the scroll bar moving.

Here is the subroutine that loads the document:

    Private Sub LoadPDFFile()

        If File.Exists(My.Settings.PDFFileName) Then
            mCurrrentFileInfo = My.Computer.FileSystem.GetFileInfo(My.Settings.PDFFileName)

            If PdfViewer.IsLoaded Then
                PdfViewer.UnloadDocument()
            End If

            PdfViewer.LoadDocument(My.Settings.PDFFileName)
            PdfViewer.PdfViewerElement.GoToPage(1)
        End If

    End Sub


OS: Windows 8
.Net 4.5
PDFViewer Version: 2014.2.715.40
michael schroeder
Top achievements
Rank 1
 answered on 26 Sep 2014
5 answers
516 views
I am experimenting with an application that will give me CPU Usage, Memory Usage, and I want to expand it from there. Right now it goes to two Text Boxes. I combined it into the first text box 

How do I display each value in two GridView Columns?

Here is what I have now;

using System;
using System.Diagnostics;
using System.Data;
using System.Windows.Forms;
 
namespace MemOV
{
    public partial class FrmMain : Form
    {
        private PerformanceCounter cpuCounter;
        private PerformanceCounter ramCounter;
 
        public FrmMain()
        {
            InitializeComponent();
            InitializeCpuCounter();
            InitializeRamCounter();
            updateTimer.Start();
        }
 
        private void UpdateTimerTick(object sender, EventArgs e)
        {
            this.textBox1.Text = "CPU Usage: " + Convert.ToInt32(cpuCounter.NextValue()).ToString() + "%" + "  | " + "Memory Usage: " + Convert.ToInt32(ramCounter.NextValue()).ToString() + "Mb";
            this.textBox2.Text = Convert.ToInt32(ramCounter.NextValue()).ToString() + "Mb";
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 
        private void InitializeCpuCounter()
        {
            cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
        }
 
        private void InitializeRamCounter()
        {
            ramCounter = new PerformanceCounter("Memory", "Available MBytes", true);
        }
    }
}


Dimitar
Telerik team
 answered on 26 Sep 2014
3 answers
65 views
Hello,

I develop stock manager application for my company

I've a error message  converter can't convert

With VS2013 DataGridView, it's work but not with RadGridView

My code :

Private Sub MasterTemplate_CellClick(sender As Object, e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellClick
        If e.ColumnIndex = 0 Then
            Dim oCell As GridViewCellInfo = DirectCast(RadGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex), GridViewCellInfo)
            If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
                Dim oImage As Image = Image.FromFile(OpenFileDialog1.FileName)
                oCell.Value = resizeImage(oImage, 48, 48)
            Else
                Dim oResult As DialogResult = MessageBox.Show("Voulez-vous supprimer l'icône associée à ce produit ?", "Icône du produit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                If oResult = Windows.Forms.DialogResult.Yes Then oCell.Value = Nothing
            End If
        End If
End Sub

Private Function resizeImage(ByVal oImage As Image, iWidth As Integer, iHeight As Integer) As Image
        Dim oSource As Bitmap = New Bitmap(oImage)
        Dim dScale As Double = oSource.Height / oSource.Width
        Dim oDest As New Bitmap(iWidth, iHeight)
        Dim gDest As Graphics = Graphics.FromImage(oDest)
        With gDest
            .InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
            .SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
            .CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
            .DrawImage(oSource, 0, 0, oDest.Width, oDest.Height)
            Return oDest
        End With
End Function





Dimitar
Telerik team
 answered on 26 Sep 2014
1 answer
94 views
Hi,

I use telerik Version 2011.1.411.2 (Runtime 2.0.50727).

I added a new colum in my database schema (for information double d_Value),
and I want that the data that is already memorized in database take value "1.0" not "0.0".

Can you explain how can I do ?

In advance, Thanks,
Richard.
Doroteya
Telerik team
 answered on 26 Sep 2014
5 answers
115 views
Hello to all!

I've a GridViewMaskBoxColumn, where float are displayed using the exponental notation.  When I try to change a cells value, I can put the wished values, but when I leave the editor, the application crashs (even if I put only a '0')

The crash happens immediately after leaving the 'CellEndEdit'.

What went wrong in my source?

Thanks for your help!




   
   System.NullReferenceException wurde nicht behandelt.
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Source=Telerik.WinControls.UI
  StackTrace:
       bei Telerik.WinControls.UI.RegexMaskTextBoxProvider.KeyDown(Object sender, KeyEventArgs e)
       bei Telerik.WinControls.UI.RadMaskedEditBoxElement.TextBoxItem_KeyDown(Object sender, KeyEventArgs e)
       bei System.Windows.Forms.KeyEventHandler.Invoke(Object sender, KeyEventArgs e)
       bei Telerik.WinControls.RadItem.OnKeyDown(KeyEventArgs e)
       bei Telerik.WinControls.UI.RadTextBoxItem.TextBoxControl_KeyDown(Object sender, KeyEventArgs e)
       bei System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
       bei System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
       bei System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
       bei System.Windows.Forms.Control.WmKeyChar(Message& m)
       bei System.Windows.Forms.Control.WndProc(Message& m)
       bei System.Windows.Forms.TextBoxBase.WndProc(Message& m)
       bei System.Windows.Forms.TextBox.WndProc(Message& m)
       bei Telerik.WinControls.UI.HostedTextBoxBase.WndProc(Message& message)
       bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       bei System.Windows.Forms.Application.Run(Form mainForm)
       bei Maxsyma.PLCExplorer.Program.Main() in e:\...\SourceCode\Regex\Program.cs:Zeile 40.
  InnerException:



Here is my code:

private void InitializeGrid()
{
..
    newColumn = new GridViewMaskBoxColumn();    // for float
    newColumn.Name = "Gleitpunkt";
    newColumn.TextAlignment = ContentAlignment.MiddleRight;
    newColumn.Width = 60;
    newColumn.HeaderText = "Gleitpunkt";
    newColumn.FormatString = "{0:0.000000e0}";
    this.radGridViewCapture.Columns.Add(newColumn);
..
}

private void CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    if (this.radGridViewCapture.ActiveEditor is RadMaskedEditBoxEditor)
    {
        RadMaskedEditBoxEditor spinEditor = this.radGridViewCapture.ActiveEditor as RadMaskedEditBoxEditor;
        spinEditor.EditorElement.Alignment = ContentAlignment.MiddleCenter;
        spinEditor.EditorElement.StretchVertically = false;
        this.radGridViewCapture.CurrentCell.Alignment = ContentAlignment.MiddleCenter;
    }
}

private void CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    if (this.radGridViewCapture.ActiveEditor is RadMaskedEditBoxEditor)
    {
        RadMaskedEditBoxEditor spinEditor = this.radGridViewCapture.ActiveEditor as RadMaskedEditBoxEditor;
        if (e.Column.Name == ColumnName.Names[ColumnName.ResultGleitpunkt])
        {
            spinEditor.MaskTextBox.MaskType = MaskType.Regex;
            spinEditor.MaskTextBox.Mask = "[-+]?([0-9]*[,.])?[0-9]+([eE][-+]?[0-9]+)?"; // e.g. 123.4e+5
        }
    }
}

private void CellEndEdit(object sender, GridViewCellEventArgs e)
{
    if (e.Column.Name == "Gleitpunkt")
    {
        float myNewValue = float.Parse(e.Row.Cells[e.ColumnIndex].Value.ToString());
        
        // myNewValue is e.g. 0 or  123  or  123.4e-88 and is correct so far
    }
}            




George
Telerik team
 answered on 25 Sep 2014
3 answers
179 views
I  have  Telerik winforms Q3 2011 SP1 version. I want to print a gridview but I didn't find RadPrintDocument. Is there any way gridview printing.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 25 Sep 2014
2 answers
442 views
I need to disable the radbutton just before the click event is fired, and finally resume its enabled state after the click event.
I tried to create a property like this in my CustomRadButton:
/// <summary>
        /// On click event
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClick(EventArgs e)
        {
            if (this.multiClickAccepted)
                base.OnClick(e);
            else
            {
                //if the multiclick is disabled (as default) disable the button before raise any event
                this.temporaryEnabled = this.Enabled;
                base.Enabled = false;
                base.OnClick(e);
                base.Enabled = (bool)this.temporaryEnabled;
                this.temporaryEnabled = null;
                //after the reactivation look for any binding to restore the correct button state
                if (this.DataBindings != null)
                {
                    foreach (System.Windows.Forms.Binding b in this.DataBindings)
                    {
                        if (b.PropertyName.Equals("Enabled"))
                            b.ReadValue();
                    }
                }
            }
        }

But in debug I found out that the base.OnClick(e); event is asynchronous.

Can you suggest something to solve my problem?

Thanks
Dimitar
Telerik team
 answered on 25 Sep 2014
3 answers
105 views
I'm using the Entity Framework with a Data Source and I would like to be able to drag and drop a field and have it be edited with a RadTextBox. When I go to customize, I see 15 Telerik controls in the list, but not RadTextBox, why not and what can I do to make the Telerik controls the default when using visual data sources. I click on the field, then Customize... and I have "Data UI Customization" selected with data type "String".

Thanks.

-John Baima

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Sep 2014
1 answer
422 views
Hi all,
I've got a column containing Minutes as an integer.  I'm trying to sum this and format it as a Time Span like hh:mm (no seconds or days).
I'm not too familiar with the AggregateExpression strings.
Is there a way to cast that aggregate into a timespan, either during or after the sum from within the expression?

I've got a group summary and a grand total that this needs to appear on.

 
summaryItem.Name = "TimeWorked"
summaryItem.AggregateExpression = "SUM(MinutesWorked)"
summaryItem.FormatString = "{0:hh}:{0:mm} = {0}"

TimeWorked column - string value formatted by database in hh:mm format
MinutesWorked column - integer value  - need Timespan.FromMinutes(...)
FormatString - the ' = {0}' at the end is for checking the value of the sum.

Currently, for example:     hh:mm = 2239
Hoping for:                        37:19 = 2239

Or is tackling this in the expression not possible? 
Or maybe as it loads into the column?
I've tried/am trying events also but hoping the 3 lines of code is do-able...

Thanks

Dimitar
Telerik team
 answered on 24 Sep 2014
1 answer
145 views
Is it possible to have a single line rich text box without showing scrollbars?

I ideally want to use it for the user to enter a hyperlink and click on it to go to that web page.

Thanks

Andez
Dimitar
Telerik team
 answered on 24 Sep 2014
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?