コード例 #1
0
        private bool AlterParams()
        {
            bool aresult = ParamsForm.ShowParams(FReport);

            if (aresult)
            {
                UpdateReport();
            }
            return(aresult);
        }
コード例 #2
0
ファイル: rpparamsform.cs プロジェクト: chtheis/reportman.net
        /// <summary>
        /// Use this procedure to show the parameters window to the user
        /// </summary>
        /// <param name="rp">The Report containing the parameters</param>
        /// <param name="caption">Caption for the report parameters window</param>
        /// <returns>Returns true if the user accept parameter changes</returns>
        public static bool ShowParams(Report rp, string caption)
        {
            bool doshow = false;

            foreach (Param p in rp.Params)
            {
                if (p.UserVisible)
                {
                    doshow = true;
                    break;
                }
            }
            if (!doshow)
            {
                return(true);
            }
            foreach (Param p in rp.Params)
            {
                p.UpdateLookupValues();
            }

            int  MAX_HEIGHT = Screen.PrimaryScreen.Bounds.Height - 100;
            bool aresult    = false;

            using (ParamsForm fparams = new ParamsForm())
            {
                fparams.Text = caption;
                if (fparams.Text.Length < 1)
                {
                    fparams.Text = Translator.TranslateStr(238);
                }
                fparams.PControl = new ParamsControl();
                fparams.PControl.SetReport(rp);
                fparams.PControl.Parent = fparams.panelparent;
                fparams.Width           = fparams.PControl.Width;
                int nheight = fparams.PControl.Height + fparams.pbottom.Height;
                if (nheight > MAX_HEIGHT)
                {
                    nheight = MAX_HEIGHT;
                }
                fparams.Height        = nheight;
                fparams.PControl.Dock = DockStyle.Fill;
                aresult = fparams.ShowDialog() == DialogResult.OK;
            }
            return(aresult);
        }