Telerik Forums
UI for WinForms Forum
3 answers
1.0K+ views

It is VERY important to us that PDF documents print to scale.I have read through the posts here and am still having the problem.

I am printing to a printer that has 0.16 in margins all around. The page size is 8.5 x 11. The drawing border is 8 x 10.5 (which would allow margins up to 0.25")

There are 2 images attached. Each shows an architect scale against the print out. One for Adobe, one for RadPrintDocument.
The Adobe prints to scale (the 120" wall at 1/2" scale shows 10 (10 feet).  The RadPrintDocument is short as it is automatically scaling the PDF file down.
Also attached is the PDF file I am using for this example.  Correction: PDF not attached as not allowed to attach to forum posts.

How can I stop that scaling please and always print to 100% scale please?

The code we are using:

RadPdfViewer rViewer = new RadPdfViewer();
rViewer.DocumentLoaded += RViewer_DocumentLoaded;
rViewer.LoadDocument(@fileLocation + fileName);
rViewer.LoadElementTree();
Application.DoEvents();

 

 private static void RViewer_DocumentLoaded(object sender, EventArgs e)
      {
         RadPrintDocument document = new RadPrintDocument();

         document.Landscape = true;
         document.DefaultPageSettings.PrinterSettings.Copies = 1;
         document.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
         document.AssociatedObject = (sender as RadPdfViewerElement);
        
         
         document.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
         document.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
         document.OriginAtMargins = true;
         document.HeaderHeight = 0;
         document.FooterHeight = 0;
         document.Print();
      }

Thank you!!!

 

 

 

Hristo
Telerik team
 answered on 27 Mar 2019
1 answer
161 views

OS: Windows 7

Scale Settings: 135% (1.35 in DPI Scale)

Spotted problems:

1) radSplitContainer, collapsible - when collapse/restore first panel it restores 1.35 larger than it was.

2) CommandBarElement.SaveLayout/RestoreLayout - restores elements in a wrong position. Elements that aren't aligned with left or top border will be moved right and bottom correspondingly. I guess it saves position adjusted to DPI Scale, but restores as not adjusted 

Both can be easily reproduced with QuickStart example (e.g. split container). Repeats on the current prod version and on the current xxx.308 beta. 

Hristo
Telerik team
 answered on 27 Mar 2019
3 answers
284 views

Hello!

I have the following RadTreeView and I would like to know if it's possible to remove duplicate sub-nodes. Here is how my tree looks like.

[MAIN NODE 1]        |        (text = Main Node 1)        |        Name = Node1

    [SubNode1]

    [SubNode1]

    [SubNode2]

[MAIN NODE 2]        |        (text = Main Node 2)        |        Name = Node2
    [SubNode1]
    [SubNode1]
    [SubNode2]

 

How would I loop through all the main nodes and remove all the duplicate child nodes?

I created my main node dynamically through code and do not store their .Name property so I cannot just use RadTreeView.Nodes(MainNode)

Is there something like..

For Each MainNode In RadTreeView1.MainNodes

Loop through and delete child nodes if there is a duplicate

Daica
Top achievements
Rank 1
 answered on 26 Mar 2019
1 answer
928 views

Please take a look at this example : 

Change the appearance of the buttons in GridViewCommandColumn

I want to create buttons with `Delete` text of every buttons.

But when i create a CommandColumn in GridView text of every button is empty.

Where can we set Button's Text?

 

Thanks in advance

Hristo
Telerik team
 answered on 26 Mar 2019
0 answers
105 views

After binding the data, what do I do when I automatically empty the text in the raddropdownlist control as soon as I type the wrong option?

I used the following code to customize the raddropdownlist control, but it didn't work

Public Class clsHYCombo
    Inherits Telerik.WinControls.UI.RadDropDownList

    Public Property RestrictContentToListItems As Boolean = True

    Protected Overrides Sub OnValidating(e As System.ComponentModel.CancelEventArgs)
        If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
            Dim index As Integer = Me.FindString(Me.Text)
            If index > -1 Then
                Me.SelectedIndex = index
            Else
                e.Cancel = True
                Me.Text = ""
                'Beep()
            End If
        End If
        MyBase.OnValidating(e)
    End Sub

    'Protected Overrides Sub OnKeyPress(ByVal e As KeyPressEventArgs)
    '    MyBase.OnKeyPress(e)
    '    If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
    '        Dim index As Integer = Me.FindString(Me.Text)
    '        If index > -1 Then
    '            Me.SelectedIndex = index
    '        Else
    '            Me.Text = ""
    '            'Beep()
    '        End If
    '    End If
    'End Sub

    'Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
    '    MyBase.OnTextChanged(e)
    '    If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
    '        Dim index As Integer = Me.FindString(Me.Text)
    '        If index > -1 Then
    '            Me.SelectedIndex = index
    '        Else
    '            Me.Text = ""
    '            'Beep()
    '        End If
    '    End If
    'End Sub

End Class

Ricardo
Top achievements
Rank 1
 asked on 26 Mar 2019
2 answers
121 views

Hello everyone,

  When I use the GridView control, if a column is decimal, it can only display two decimals, and the third one rounds; but this is not what I want, I want it to display

three or four decimals, and I don't know how to solve it.

hong
Top achievements
Rank 1
 answered on 25 Mar 2019
0 answers
99 views

Hello everyone,

     When I use the RadMenu control Add New Item, after opening a Form1 through the menu item, the interface Form1 is displayed on the display every time

 behind the main interface. This is not what I want; I want it to be displayed in front of the main interface.I hope everyone can help me, thank you.

hong
Top achievements
Rank 1
 asked on 25 Mar 2019
1 answer
116 views

we have the following property:

private Size _picSize = new Size(1272, 787);

public Size PicSize
{
     get => _picSize;
     set => value;

}

if in the radpropertygrid for this property to remove the height and semicolon, press <enter>, an error occurs:

System.ArgumentException: Не удается разобрать текст "1000". Ожидаемый формат текста: "Width,Height".
в System.Drawing.SizeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
в Telerik.WinControls.UI.PropertyGridItem.ConvertValue(Object value, Object& convertedValue)
в Telerik.WinControls.UI.PropertyGridItem.set_Value(Object value)
в Telerik.WinControls.UI.PropertyGridTableElement.EndEditCore(Boolean commitChanges)
в Telerik.WinControls.UI.PropertyGridTextBoxEditor.OnLostFocus()

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 22 Mar 2019
2 answers
328 views

Hi,

I have been trying to make the icon view more of a tile view however when I try and do the back colour it does a gradient fill instead. See attachment

Form Code

    this.radListView2.ViewType = ListViewType.IconsView;
    this.radListView2.ItemSize = new Size(300, 120);
    this.radListView2.ItemSpacing = 10;
    this.radListView2.AllowEdit = false;
    this.radListView2.EnableFiltering = true;
    this.radListView2.HotTracking = false;
 
    this.radListView2.RootElement.BackColor = Color.Transparent;
    this.radListView2.BackColor = Color.Transparent;
    this.radListView2.ListViewElement.DrawFill = false;
    this.radListView2.ListViewElement.ViewElement.BackColor = Color.Transparent;
 
    this.radListView2.RootElement.EnableElementShadow = false;
}
 
private void radListView2_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e)
{
    if (e.VisualItem is IconListViewVisualItem)
    {
        e.VisualItem = new PeopleListIcon();
    }
}

 

PeopleListIcon Code

using System;
using HRSystem.HRDataCentre;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Text;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using System.Linq;
using Telerik.WinControls.Layouts;
 
namespace HRSystem.New_Element
{
    public class PeopleListIcon : IconListViewVisualItem
    {
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(IconListViewVisualItem);
            }
        }
 
        LightVisualElement RoleName = new LightVisualElement();
        LightVisualElement RoleType = new LightVisualElement();
 
        LightVisualElement PersonName = new LightVisualElement();
 
        LightVisualElement Duration = new LightVisualElement();
        LightVisualElement Active = new LightVisualElement();
 
        private StackLayoutElement verticalContainer = new StackLayoutElement();
        private StackLayoutElement roomHeaderContainer = new StackLayoutElement();
        private StackLayoutElement roomFooterContainer = new StackLayoutElement();
 
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
 
            verticalContainer.Orientation = System.Windows.Forms.Orientation.Vertical;
            verticalContainer.NotifyParentOnMouseInput = true;
            verticalContainer.ShouldHandleMouseInput = false;
            verticalContainer.StretchHorizontally = true;
            verticalContainer.StretchVertically = true;
 
            roomHeaderContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
            roomHeaderContainer.NotifyParentOnMouseInput = true;
            roomHeaderContainer.ShouldHandleMouseInput = false;
            roomHeaderContainer.Children.Add(RoleName);
            roomHeaderContainer.Children.Add(RoleType);
            roomHeaderContainer.StretchHorizontally = true;
 
            RoleName.NotifyParentOnMouseInput = true;
            RoleName.ShouldHandleMouseInput = false;
            RoleName.StretchHorizontally = true;
            RoleName.CustomFont = "Roboto";
            RoleName.CustomFontSize = 9;
            RoleName.CustomFontStyle = FontStyle.Bold;
            RoleName.Margin = new System.Windows.Forms.Padding(5, 10, 0, 0);
            RoleName.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
 
            RoleType.NotifyParentOnMouseInput = true;
            RoleType.ShouldHandleMouseInput = false;
            RoleType.StretchHorizontally = false;
            RoleType.CustomFont = "Roboto";
            RoleType.CustomFontSize = 9;
            RoleType.CustomFontStyle = FontStyle.Regular;
            RoleType.Margin = new System.Windows.Forms.Padding(0, 5, 5, 0);
 
            roomFooterContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
            roomFooterContainer.NotifyParentOnMouseInput = true;
            roomFooterContainer.ShouldHandleMouseInput = false;
            roomFooterContainer.StretchHorizontally = true;
            roomFooterContainer.DrawFill = true;
            roomFooterContainer.BackColor = Color.White;
            roomFooterContainer.GradientStyle = GradientStyles.Solid;
            roomFooterContainer.MinSize = new System.Drawing.Size(0, 30);
 
            PersonName.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            PersonName.StretchHorizontally = false;
            PersonName.Layout.LeftPart.Padding = new System.Windows.Forms.Padding(24, 0, 8, 0);
 
            PersonName.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
            PersonName.NotifyParentOnMouseInput = true;
            PersonName.ShouldHandleMouseInput = false;
            PersonName.CustomFont = "Roboto";
            PersonName.CustomFontSize = 12;
            PersonName.CustomFontStyle = FontStyle.Regular;
 
             
            Duration.NotifyParentOnMouseInput = true;
            Duration.ShouldHandleMouseInput = false;
 
            Duration.StretchVertically = true;
            Active.StretchVertically = true;
            roomFooterContainer.Children.Add(Duration);
            roomFooterContainer.Children.Add(Active);
 
            Active.NotifyParentOnMouseInput = true;
            Active.ShouldHandleMouseInput = false;
            Active.StretchHorizontally = false;
            Active.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            Active.CustomFont = "Roboto";
            Active.CustomFontSize = 9;
            Active.CustomFontStyle = FontStyle.Regular;
 
            Duration.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
            Duration.CustomFont = "Roboto";
            Duration.CustomFontSize = 9;
            Duration.CustomFontStyle = FontStyle.Regular;
            Duration.Margin = new System.Windows.Forms.Padding(5, 0, 0, 0);
            Duration.StretchHorizontally = false;
 
            verticalContainer.Children.Add(roomHeaderContainer);
            verticalContainer.Children.Add(PersonName);
            verticalContainer.Children.Add(roomFooterContainer);
 
            this.Children.Add(this.verticalContainer);
        }
        protected override void SynchronizeProperties()
        {
            base.SynchronizeProperties();
            this.DrawText = false;
            this.BackColor = Color.White;
            this.DrawFill = true;
            this.DrawBorder = false;
            RoleName.Margin = new System.Windows.Forms.Padding(8, 8, 0, 0);
            RoleType.ImageLayout = System.Windows.Forms.ImageLayout.None;
            PersonName.Margin = new System.Windows.Forms.Padding(24, 0, 0, 0);
 
            PersonName.Layout.LeftPart.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0);
            PersonName.StretchHorizontally = true;
            PersonName.ImageAlignment = ContentAlignment.MiddleLeft;
            PersonName.TextAlignment = ContentAlignment.MiddleLeft;
 
            Duration.Layout.LeftPart.Margin = new System.Windows.Forms.Padding(0, -3, 0, 0);
            Duration.ForeColor = Color.FromArgb(200, 0, 0, 0);
            Active.ForeColor = Color.FromArgb(200, 0, 0, 0);
            Active.Layout.LeftPart.Margin = new System.Windows.Forms.Padding(0, -3, 0, 0);
 
            People Person = this.Data.DataBoundItem as People;
 
            if (Person != null)
            {
                RoleName.Text = Person.Roles.Any() ? Person.Roles.FirstOrDefault().RoleTitle : "No Role";
                RoleType.Text = Person.Roles.Any() ? Person.Roles.FirstOrDefault().Type.Description : "";
 
                PersonName.Text = Person.Forename + " " + Person.Surname;
                int age = Person.Roles.Any() ? Function.GetAge(Person.Roles.FirstOrDefault().StartDate) : 0;
                Duration.Text = age + " years";
 
                RoleName.ForeColor = Color.FromArgb(190, 0, 0, 0);
                RoleType.ForeColor = Color.Black;
                PersonName.ForeColor = Color.Black;
 
                if (RoleType.Text == "Staff" || RoleType.Text == "Volunteer")
                {
                    this.BackColor = Color.FromArgb(247, 247, 247);
                }
                else
                {
                    this.BackColor = Color.FromArgb(170, 13, 13);
                }
            }
            else
            {
                PersonName.Text = "Free Room";
                Duration.Text = "0 days";
                this.BackColor = Color.DarkRed;
                RoleName.ForeColor = Color.White;
                RoleType.ForeColor = Color.White;
                PersonName.ForeColor = Color.White;
            }
        }
    }
}
Mark
Top achievements
Rank 1
 answered on 22 Mar 2019
1 answer
165 views

Hello,

I've posted a thread about save/restore row 2 months ago. It worked great until I grouped a column.

When a column is grouping, the row index that I save/restore is the index in the grouping zone where the row located. When I load this row index to the gridview, every grouping zone will take over this row index. For example if I save a selected row, when I reload its index, all rows which has this index in every grouping zone will be selected.

 

If you would like to test, check out the demo in my old post (Hristo's answer):

https://www.telerik.com/forums/restore-selected-tab-in-hierarchy-child-page-view-after-data-refresh

 

Thank you by advance for your help.

Regards,

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 22 Mar 2019
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
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
ShapedForm
SyntaxEditor
Wizard
CollapsiblePanel
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?