답변됨 Its Urgent : Print Issue In SilverLight 4.

  • 20 ianuarie 2011 06:55
     
     

    Hi,

    I am new to Silverlight and i need this help urgently.

    I use SilverLight 4, in my application we will use the customized hirarichy tree control dynamically generated using usercontrols. While at the run time hirarichy tree will be generated dynamically and showed on screen.When I print the screen using the silverlight 4 entire page will not be printed, only part of the screen is to be print.

    Note:

    1-> Dynamically created hirarichy tree structure will be in the form of expand and collapse type.

    2-> The hirarichy structure will expand out of the screen size it will not fit in screen size.

    3-> The entire hirarich will be placed with in SilverLight "scrollviewer" control.

    For print I will use silverlight 4 "System.Windows.Printing" namespace and to print by using "PrintDocument" to handle print event handler.

    Kindly help me...

    Regards,

    Suresh.S

     

Toate mesajele

  • 20 ianuarie 2011 08:39
     
     Răspuns

    Hello Suresh,

    I suspect you're in the wrong place for this question.  This is a Visio forum.

    Have you tried http://forums.silverlight.net/forums/ ?

    Best regards

    John

     


    John Goldsmith (Visio MVP) http://visualsignals.typepad.co.uk/vislog/ http://ww.visualsignals.co.uk/
  • 20 ianuarie 2011 13:49
     
     Răspuns

    So many people end up using the wrong forum, not just for Silverlight but also for Visual Studio, have those that maintain these forums looked at why this might be?

     


    Regards, Paul Herber, Sandrila Ltd. Electronics for Visio http://www.sandrila.co.uk/visio-electronics/ Electrical for Visio http://www.sandrila.co.uk/visio-electrical/ Electronics Packages for Visio http://www.sandrila.co.uk/visio-electronics-packages/
  • 23 martie 2012 15:37
     
     Răspuns propus

    public class SilverlightManager
    {
          
            public static PrintDocument PrintDoc(UIElement element)
            {
                var document = new PrintDocument();
                document.PrintPage += (s, args) =>
                                          {
                                              args.PageVisual = element;
                                          };
                return document;
            }

            public static Image PrintScreen(UIElement element)
            {   
                WriteableBitmap writeableBitmap = new WriteableBitmap(element, null);
                writeableBitmap.Invalidate();
                Image img = new Image();
                img.Source = writeableBitmap;
                return img;
            }
    }


    // MainPage.xaml.cs
    private void btPrintScreen_Click(object sender, RoutedEventArgs e)
    {
        var image = SilverlightManager.PrintScreen(this);
        var document = SilverlightManager.PrintDoc(image);
        document.Print("PrintScreen_"+DateTime.Now.ToString(("dd_MM_yyyy")));
    }

    • Propus ca răspuns de ST34999 23 martie 2012 15:37
    •