public override void OnLayout(IGUIContext ctx, RectangleF bounds)
        {
            base.OnLayout(ctx, bounds);

            if (!Panel1Collapsed && !Panel2Collapsed)
            {
                Splitter1.OnLayout(ctx, this.Bounds);
            }
            if (!Panel3Collapsed && !Panel2Collapsed)
            {
                Splitter2.OnLayout(ctx, this.Bounds);
            }


            /***
             * if (Panel1Collapsed && Panel2Collapsed && !Panel3Collapsed)
             *      Panel3.OnLayout (ctx, bounds);
             *
             * if (Panel1Collapsed && !Panel2Collapsed && Panel3Collapsed)
             *      Panel2.OnLayout (ctx, bounds);
             *
             * if (!Panel1Collapsed && Panel2Collapsed && Panel3Collapsed)
             *      Panel1.OnLayout (ctx, bounds);
             *
             * if (!Panel1Collapsed && !Panel3Collapsed)
             *      Panel2.OnLayout (ctx, bounds);
             ***/


            if (Panel1.IsVisibleEnabled)
            {
                Panel1.OnLayout(ctx, new RectangleF(Left, Top, Splitter1.Left - Left, Height));
            }
            if (Panel2.IsVisibleEnabled)
            {
                Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Splitter2.Left - Splitter1.Right, Height));
            }
            if (Panel3.IsVisibleEnabled)
            {
                Panel3.OnLayout(ctx, new RectangleF(Splitter2.Right, Top, Right - Splitter2.Right, Height));
            }
        }
示例#2
0
        public override void OnLayout(IGUIContext ctx, RectangleF bounds)
        {
            base.OnLayout(ctx, bounds);

            bool visible1 = Panel1.Visible && Panel2.Visible && !Panel1Collapsed && !Panel2Collapsed;
            bool visible2 = Panel2.Visible && Panel3.Visible && !Panel2Collapsed && !Panel3Collapsed;

            if (!visible1 && !visible2)
            {
                visible1 = true;
            }

            Splitter1.Visible = visible1;
            Splitter2.Visible = visible2;

            if (Splitter1.Visible)
            {
                Splitter1.OnLayout(ctx, bounds);
            }
            if (Splitter2.Visible)
            {
                Splitter2.OnLayout(ctx, bounds);
            }

            if (Orientation == SplitOrientation.Vertical)
            {
                if (Panel1.Visible)
                {
                    if (Panel2.Visible)
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Splitter1.Left - Left, Height));
                    }
                    else if (Panel3.Visible)
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Splitter1.Left - Left, Height));
                    }
                    else
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
                if (Panel2.Visible)
                {
                    if (Panel1.Visible)
                    {
                        if (Panel3.Visible)
                        {
                            Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Splitter2.Left - Splitter1.Right, Height));
                        }
                        else
                        {
                            Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Right - Splitter1.Right, Height));
                        }
                    }
                    else if (Panel3.Visible)
                    {
                        Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Splitter2.Left - Left, Height));
                    }
                    else
                    {
                        Panel2.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
                if (Panel3.Visible)
                {
                    if (Panel1.Visible)
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Top, Right - Splitter1.Right, Height));
                    }
                    else if (Panel2.Visible)
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Top, Right - Splitter2.Right, Height));
                    }
                    else
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
            }
            else                        // *** Orientation = Horizontal
            {
                if (Panel1.Visible)
                {
                    if (Panel2.Visible)
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Width, Splitter1.Top - Top));
                    }
                    else if (Panel3.Visible)
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Width, Splitter1.Top - Top));
                    }
                    else
                    {
                        Panel1.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
                if (Panel2.Visible)
                {
                    if (Panel1.Visible)
                    {
                        if (Panel3.Visible)
                        {
                            Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Width, Splitter2.Top - Splitter1.Bottom));
                        }
                        else
                        {
                            Panel2.OnLayout(ctx, new RectangleF(Splitter1.Right, Top, Width, Bottom - Splitter1.Bottom));
                        }
                    }
                    else if (Panel3.Visible)
                    {
                        Panel2.OnLayout(ctx, new RectangleF(Left, Top, Width, Splitter2.Top - Top));
                    }
                    else
                    {
                        Panel2.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
                if (Panel3.Visible)
                {
                    if (Panel2.Visible)
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Splitter2.Bottom, Width, Bottom - Splitter2.Bottom));
                    }
                    else if (Panel1.Visible)
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Splitter1.Bottom, Width, Bottom - Splitter1.Bottom));
                    }
                    else
                    {
                        Panel3.OnLayout(ctx, new RectangleF(Left, Top, Width, Height));
                    }
                }
            }
        }
示例#3
0
    protected bool LoadDoc(int docversID)
    {
        try
        {
            SQL_utils sql           = new SQL_utils("backend");
            string    fileext       = sql.StringScalar_from_SQLstring("Select fileext from tbldocvers where docversID=" + docversID.ToString());
            string    file          = Server.MapPath(String.Format("~/webdocs/DocVersID_{0}{1}", docversID, fileext));
            string    relative_file = String.Format("~/webdocs/DocVersID_{0}{1}", docversID, fileext);

            bool fileexists = File.Exists(file);

            dxSpreadsheet.Visible = false;
            dxricheditDoc.Visible = false;
            dxImage.Visible       = false;
            gvZip.Visible         = false;

            if (fileexists)
            {
                if (fileext.ToLower() == ".doc")
                {
                    dxricheditDoc.Open(file, DevExpress.XtraRichEdit.DocumentFormat.Doc);
                    dxricheditDoc.Visible = true;
                }
                else if (fileext.ToLower() == ".txt")
                {
                    dxricheditDoc.Open(file, DevExpress.XtraRichEdit.DocumentFormat.PlainText);
                    dxricheditDoc.Visible = true;
                }
                else if (fileext.ToLower() == ".docx")
                {
                    dxricheditDoc.Open(file, DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
                    dxricheditDoc.Visible = true;
                }
                else if (fileext.ToLower() == ".jpg")
                {
                    dxImage.ImageUrl = relative_file;
                    dxImage.Visible  = true;
                    //Response.ContentType = "image/jpeg";
                    //Response.WriteFile(file);
                    //Response.End();
                }
                else if (fileext.ToLower() == ".png")
                {
                    dxImage.ImageUrl = relative_file;
                    dxImage.Visible  = true;
                    //Response.ContentType = "image/png";
                    //Response.WriteFile(file);
                    //Response.End();
                }
                else if (fileext.ToLower() == ".pdf")
                {
                    Splitter1.GetPaneByName("ContentUrlPane").ContentUrl = relative_file;
                }
                else if (fileext.ToLower() == ".xlsx")
                {
                    dxSpreadsheet.Open(file, DevExpress.Spreadsheet.DocumentFormat.Xlsx);
                    dxSpreadsheet.Visible = true;
                }
                else if (fileext.ToLower() == ".xls")
                {
                    dxSpreadsheet.Open(file, DevExpress.Spreadsheet.DocumentFormat.Xls);
                    dxSpreadsheet.Visible = true;
                }
                else if (fileext.ToLower() == ".csv")
                {
                    dxSpreadsheet.Open(file, DevExpress.Spreadsheet.DocumentFormat.Csv);
                    dxSpreadsheet.Visible = true;
                }
                else if (fileext.ToLower() == ".pptx")
                {
                    Response.ContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
                    Response.WriteFile(file);
                    Response.End();
                }
                else if (fileext.ToLower() == ".zip")
                {
                    DataTable  dt = new DataTable();
                    DataColumn c0 = new DataColumn("index", typeof(int));
                    DataColumn c1 = new DataColumn("type", typeof(string));
                    DataColumn c2 = new DataColumn("name", typeof(string));
                    DataColumn c3 = new DataColumn("uncompressed_size", typeof(int));
                    dt.Columns.Add(c0);
                    dt.Columns.Add(c1);
                    dt.Columns.Add(c2);
                    dt.Columns.Add(c3);

                    string items = "";
                    using (ZipArchive zip = ZipArchive.Read(file))
                    {
                        int counter = 0;
                        foreach (ZipItem item in zip)
                        {
                            counter++;
                            DataRow row = dt.NewRow();
                            row["index"]             = counter;
                            row["type"]              = item.Attributes;
                            row["name"]              = item.Name;
                            row["uncompressed_size"] = item.UncompressedSize;
                            string itm = String.Format("{0} {1} {2}", item.Attributes, item.Name, item.UncompressedSize);
                            Debug.WriteLine(itm);
                            items += itm + "<br/>";

                            dt.Rows.Add(row);
                        }
                    }

                    Session["zip_contents"] = dt;
                    gvZip.DataSource        = (DataTable)Session["zip_contents"];
                    gvZip.DataBind();
                    gvZip.Visible = true;
                }
            }

            //else
            //{
            //	richeditDoc.Open(file);
            //}
            sql.Close();
            return(fileexists);
        }
        catch (Exception ex)
        {
            return(false);
        }
    }