Example #1
0
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////
            /// <summary>
            ///     Method: load the viewer and file info.
            /// </summary>
            /// <param name="file">  The file.</param>
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////
            public override void Load(FileInfo file)
            {
                // FastBox(file);

                try
                {
                    var viewer = new ViewerPanel();
                    viewer.ShowLineNumbers = false;
                    // viewer.ReadOnly        = true;
                    viewer.Dock = DockStyle.Fill;
                    viewer.LoadFile(file.FullName);
                    Controls.Add(viewer);
                }
                catch (Exception)
                {
                }
            }
        /// <summary>
        /// 初始化数据绑定
        /// </summary>
        private void BindingInit()
        {
            //绑定窗体Top
            Binding bind_top = new Binding
            {
                Source = Bas.skin,
                Mode   = BindingMode.TwoWay,
                Path   = new PropertyPath("DesktopWnd_Top")
            };

            SetBinding(TopProperty, bind_top);

            //绑定窗体Left
            Binding bind_left = new Binding
            {
                Source = Bas.skin,
                Mode   = BindingMode.TwoWay,
                Path   = new PropertyPath("DesktopWnd_Left")
            };

            SetBinding(LeftProperty, bind_left);

            //绑定窗体透明度
            Binding bind_opacity = new Binding
            {
                Source = Bas.skin,
                Mode   = BindingMode.TwoWay,
                Path   = new PropertyPath("DesktopWnd_Opacity")
            };

            SetBinding(OpacityProperty, bind_opacity);

            //绑定背景
            Binding bind_background = new Binding
            {
                Source = Bas.skin,
                Mode   = BindingMode.TwoWay,
                Path   = new PropertyPath("DesktopWnd_Bg")
            };

            ViewerPanel.SetBinding(BackgroundProperty, bind_background);
        }