Telerik Forums
UI for WinForms Forum
2 answers
196 views

I had no trouble creating a printable panel control using the documentation provided.  However if I add header and footer height and text to the radprintdocument in the control, the panel is printed overtop of the header.  How can I change so this doesn't happen?  (code for print preview of printable panel pnlCashReceiptsSummary and of custom control below)

 

 Code I'm using for print preview:

Dim doc As New RadPrintDocument()
doc.DefaultPageSettings.Landscape = True

doc.HeaderHeight = 100
doc.HeaderFont = New Font("Arial", 14, FontStyle.Bold)
doc.RightHeader = "AAAA"
doc.LeftHeader = "[Date Printed]"
doc.FooterHeight = 100
doc.FooterFont = New Font("Arial", 12)
doc.LeftFooter = GlobalVariables.CurrentDealer.Dealer_Fxd.DealerCode

 pnlCashReceiptsSummary.PrintPreview(doc)

 

My Control :  

 Imports Telerik.WinControls.UI
Imports System.Drawing.Printing

Public Class PrintablePanel
Inherits RadPanel
Implements IPrintable


Public Function BeginPrint(sender As RadPrintDocument, args As PrintEventArgs) As Integer Implements IPrintable.BeginPrint

Return 1
End Function

Public Function EndPrint(sender As RadPrintDocument, args As PrintEventArgs) As Boolean Implements IPrintable.EndPrint
Return True
End Function

Public Function GetSettingsDialog(document As RadPrintDocument) As Form Implements IPrintable.GetSettingsDialog
Return New PrintSettingsDialog(document)
End Function

Public Function PrintPage(pageNumber As Integer, sender As RadPrintDocument, args As PrintPageEventArgs) As Boolean Implements IPrintable.PrintPage
Dim bmp As New Bitmap(Me.Width, Me.Height)
Me.DrawToBitmap(bmp, New Rectangle(Point.Empty, Me.Size))
args.Graphics.DrawImage(bmp, Point.Empty)
Return False
End Function

Public Sub Print(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
doc.Print()
End Sub

Public Sub PrintPreview(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
Dim dialog As New RadPrintPreviewDialog(doc)
dialog.ThemeName = Me.ThemeName
dialog.ShowDialog()
End Sub

Private Function CreatePrintDocument() As RadPrintDocument
Dim doc As New RadPrintDocument()
doc.AssociatedObject = Me
Return doc
End Function
End Class

 

William
Top achievements
Rank 1
 answered on 18 Jun 2015
5 answers
188 views
I've created a simple test application to test the RadPanorama.
My questions:
  1. Is there a way to say "This is the selected tile and this is the visual feedback for it"?
  2. How do I know which is the parent group of a tile?
  3. When rearranging the tiles via Drag&Drop there are always "gaps" in the layout. Is there a way to automatically "close" those gaps?

My found glitsches (see image):
  1. When using a RoundRectShape(12) and setting the Image of a tile, the image is drawn outside of the tile. I've also tested this with BackgroundImage instead of Image.
  2. When resizing the control, the scrollbar is going behind the tiles and there is no way to click the scrollbar.

For the sake of completeness, my source code:
//rama is the RadPanoramaControl
 
public class CustomItem
    {
        public string Group { get; set; }
        public Color Back { get; set; }
        public string Name { get; set; }
        public int Index { get; set; }
 
        public Image Picture { get; set; }
    }
 
public partial class Form1 : Form
    {
        private const int COUNT = 30;
        private List<CustomItem> ItemList = new List<CustomItem>();
 
        public Form1()
        {
            InitializeComponent();
 
            fillList();
        }
 
        private void fillList()
        {
            for (int i = 0; i < COUNT; i++)
            {
                using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\JellyFish.jpg"))
                {
                    Image thumb = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    ItemList.Add(new CustomItem
                    {
                        Group = "Group 1",
                        Back = Color.BlanchedAlmond,
                        Name = "1-Item " + i,
                        Index = i,
                        Picture = thumb
                    });
                }
            }
 
            for (int i = 0; i < COUNT * 2; i++)
            {
                using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"))
                {
                    Image thumb = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    ItemList.Add(new CustomItem
                    {
                        Group = "Group 2",
                        Back = Color.LightSkyBlue,
                        Name = "2-Item " + i,
                        Index = i,
                        Picture = thumb
                    });
                }
            }
 
            for (int i = 0; i < COUNT; i++)
            {
                ItemList.Add(new CustomItem
                {
                    Group = "Group 3 has the looooooooooongest Name I've ever seen" + Environment.NewLine + " and even a second line",
                    Back = Color.LimeGreen,
                    Name = "3-Item " + i,
                    Index = i
                });
            }
 
            for (int i = 0; i < COUNT; i++)
            {
                using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"))
                {
                    Image thumb = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    ItemList.Add(new CustomItem
                    {
                        Group = "Group 4",
                        Back = Color.LimeGreen,
                        Name = "4-Item " + i,
                        Index = i,
                        Picture = thumb
                    });
                }
            }
        }
 
        private void fillControl()
        {
            var groups = (from x in ItemList
                          select x.Group).Distinct();
 
            foreach (var groupKey in groups)
            {
                int rowcount = groupKey == "Group 4" ? 5 : 3;
 
                rama.Groups.Add(new TileGroupElement { Name = groupKey, Text = groupKey, RowsCount = rowcount });
            }
 
            foreach (var curViewItem in ItemList)
            {
                if (curViewItem.Index % 2 == 0)
                {
                    Image thumb1;
                    Image thumb2;
                    using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"))
                    {
                        thumb1 = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    }
                    using (Image image = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"))
                    {
                        thumb2 = image.GetThumbnailImage(120, 120, () => false, IntPtr.Zero);
                    }
 
                    var liveTile = new RadLiveTileElement
                        {
                            //Text = curViewItem.Name,
                            BackColor = curViewItem.Back,
                            NumberOfColors = 1,
                            ColSpan = 1,
                            ForeColor = Color.CadetBlue,
                            Shape= new RoundRectShape(12)
                            //Image = curViewItem.Picture,
                            //ImageLayout = ImageLayout.Zoom,
                            //TextImageRelation = TextImageRelation.ImageAboveText
                        };
 
                    liveTile.Items.Add(new LightVisualElement
                                           {
                                               Text = "Movie Idea: Pirates of the Carribean",
                                               Image = thumb1,
                                               ImageLayout = ImageLayout.Zoom
                                           });
                    liveTile.Items.Add(new LightVisualElement
                                           {
                                               //Text = "Movie Idea: Inception",
                                               Image = thumb2,
                                               ImageLayout = ImageLayout.Zoom
                                           });
                    liveTile.Items.Add(new LightVisualElement
                                           {
                                               Text = "Movie Idea: The Expendables"
                                           });
                    liveTile.Items.Add(new LightVisualElement
                                           {
                                               Text = "Movie Idea: Harry Potter and the Deathly Hallows"
                                           });
 
                    liveTile.AnimationFrames = 60; //sets the number of frames in a transition
                    liveTile.AnimationInterval = 20; //sets the interval between each frame in the transition in miliseconds
                    liveTile.ContentChangeInterval = 6000; //sets the interval between each content change
                    liveTile.TransitionType = ContentTransitionType.SlideLeft; //sets the type of the transition animation
 
                    ((TileGroupElement)rama.Groups[curViewItem.Group]).Items.Add(liveTile);
                }
                else
                {
                    ((TileGroupElement)rama.Groups[curViewItem.Group]).Items.Add(new RadTileElement
                    {
                        Text = curViewItem.Name,
                        BackColor = curViewItem.Back,
                        NumberOfColors = 1,
                        ColSpan = curViewItem.Index % 3 == 0 ? 2 : 1,
                        //BackgroundImage = curViewItem.Picture,
                        //BackgroundImageLayout=ImageLayout.Zoom,
                        Image = curViewItem.Picture,
                        ImageLayout = ImageLayout.Zoom,
                        TextImageRelation = TextImageRelation.ImageAboveText,
                        Shape = new RoundRectShape(12)
                    });
                }
            }
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            rama.ShowGroups = true;
            rama.AllowDragDrop = true;
            rama.ScrollBarAlignment = HorizontalScrollAlignment.Bottom;

            fillControl();
        }
    }

Hristo
Telerik team
 answered on 18 Jun 2015
1 answer
87 views

I have a grid that I'm binding to a dataset. The dataset has the datarelations defined on it prior to assigning it to the grid (meaning I am not defining any relations on the grid itself). The data is displayed as I want it, with all of the details information being displayed in grids on tabs with each parent row. What I need to be able to do now is format the grids containing the detail information. How can I access those? I normally format my grids simply by using grid.columns.<whatever> and setting the properties right after I bind to my dataset. If possible I'd like to just add my detail formatting in the step as well.

 

Thanks.

Hristo
Telerik team
 answered on 18 Jun 2015
1 answer
182 views

Hello,

I have user control (AutoSize = True) with RichTextEditor inside. 

I want to force RichTextEditor to show all content all the time.

First when user enter text, it should not show VerticalScroll when user put to many lines. The control should re-size automatically (only Height should change).

Secondly, when I import content to RichTextEditor, it should automatically calculate size of document and make whole content visible.

Is that possible?

Hristo
Telerik team
 answered on 18 Jun 2015
1 answer
241 views

Hi,

I am new telerik components and hoping someone may be able to point me in right direction. I am attempting to add a label and datetime picker control side by side in my ribbon bar group. I have managed to get the label and datetime picker to appear on the same row (for lack of a better term) in the group, but they just overlap each other.

I found a similar thread called "Label in Ribbon Bar", which sets positioning of the controls in a panel...then the panel is added to the group as RadHostItem. I tried the suggested code, but it doesn't appear to work, as the ribbon group ended up empty...not displaying any controls. Then I tried without the panel. The label and datetime picker reappeared, but were still overlapped.

I have included a code snippet below. Any insight or help is appreciated.

 RadLabel label = new RadLabel();
 label.Location = new Point(5, 5);
 label.Text = "test";
 RadHostItem item1 = new RadHostItem(label); RadDateTimePicker picker = new RadDateTimePicker();
 picker.Location = new Point(32, 5);
 picker.MinimumSize = new Size(100, 0);
 RadHostItem item2 = new RadHostItem(picker);
 ribbonGroupSettings.Items.AddRange(new RadHostItem[] { item1, item2 }); ribbonGroupSettings.MinSize = new Size(ribbonGroupSettings.Size.Width + label.Width + 100 + padding, 0);  

Thanks.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 18 Jun 2015
3 answers
136 views
Hi,

How can I set a vertical scroll bar in all day appointment area? I try to add a large number of all day events (for example 20). In some cases some events are not visible in all day area. Please take a look in attached screen shot.

Thanks in advance.

 
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 17 Jun 2015
2 answers
378 views

Hi, 

I am using RadMaskedEditBox with EMail MaskType on my project. I want to know if its text is a valid email or not on the code side but i couldn't find a way to do it. How can i get the bool value of valid email address of RadMaskedEditBox?

Mustafa
Top achievements
Rank 1
 answered on 16 Jun 2015
1 answer
335 views

Hi and thank you in advance for your help,

I have a custom object, User, which contains a list of custom objects, List<Topic>. Each Topic has two strings. Currently I have my ItemsSource bound to an observable collection of Users, and it displays the ID and Name correctly. However, I want it also to display each user's list of Topic Names. For instance, user jwilson has a list of topics with names World News, Canadian News,.. etc. So for each row, there would be the name, ID, and the list of Topic Names in an expandable. 

Would I have to use hierarchical gridview for this? Or is there a simpler way?

Thanks for your help,

 Julian

 

Hristo
Telerik team
 answered on 16 Jun 2015
3 answers
152 views

Hi guys!

      I have a data-bound RadTreeview control bound to my "ChartOfAccount" table. I have an Idea to drag a node from 1st Parent node to 2nd Parent.

i.e : An Account Fuel Expenses from the Node Utilities Expenses to Administrator Expenses. for this purpose I am getting the COA_ID of the Fuel Expenses by event  Treeview_DrageStarted(....) like : Treeview1.SelectedValue (where SelectedValue is the Coa_ID column). After that Now I have started draging this node from Utilities Expenses to administrator Expenses, therefore I will need the Parent node SELECTEDVALUE which will help me to make a condition for UPDATE QUERY.

 

please someone understand this problem because I am weak in english, and suggest me the solution that How to get the Parent Node SELECTEDVALUE.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 16 Jun 2015
1 answer
161 views

I have a dataentry that I want to set values for certain textboxes when a user adds a new item/entry. I can access the controls but nothing shows up in the text box at runtime.

1.private void rs40AddNewItem_Click(object sender, EventArgs e)
2.        {
3.            Mix _mix = new Mix();
4.            (radDataEntry1.PanelContainer.Controls["radPanel4"].Controls[0] as RadTextBox).Text = "TEST";
5.        }

I am not sure if this is the right approach.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 16 Jun 2015
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?