Пример #1
0
        //────────────────────────────────────────
        public override string P2b_GetStyleName(
            int nCurIx, CustomcontrolListbox cctLst, Log_Reports pg_Logging
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_LayoutImpl.Name_Library, this, "P2_GetStyleAttrNames",pg_Logging);
            //
            //

            string sResult;

            // 行をセットしたので、取り出されるのも行です。
            // DataRowをセットしましたが、取り出されるのは DataRowViewになるようです。
            DataRowView row = (DataRowView)cctLst.Items[nCurIx];

            // スタイルのNAME値が入っている。
            Value_Humaninput valueH = Utility_Row.GetFieldvalue(
                NamesFld.S_EXPL_SS,
                row.Row,
                false,//該当なしも可
                pg_Logging,
                Info_LayoutImpl.Name_Library+":"+this.GetType().Name+"#P2_:リストボックスのEXPL-SS"
                );
            if (!pg_Logging.Successful)
            {
                // 既エラー。
                sResult = "";
                goto gt_EndMethod;
            }

            if (pg_Logging.Successful)
            {
                // 正常時

                if (null == valueH)
                {
                    sResult = "";
                }
                else
                {
                    sResult = ((Value_Humaninput)valueH).Text;
                }
            }
            else
            {
                sResult = "";
            }

            goto gt_EndMethod;

            //
            //
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(pg_Logging);
            return sResult;
        }
Пример #2
0
        //────────────────────────────────────────
        /// <summary>
        /// 項目の文字列。
        /// </summary>
        /// <param name="e"></param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public virtual string P1_GetItemString(
            int nCurIx,
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "P1_GetItemLabel",log_Reports);
            //
            //
            string sDisplayText;

            // ↓2012-02-02 追加
            if (nCurIx < cctLst.List_SText_Display.Count)
            {
                sDisplayText = cctLst.List_SText_Display[nCurIx];
                if (null != sDisplayText)
                {
                    goto gt_EndMethod;
                }
            }

            //
            // 項目の数だけ呼び出される。
            // 処理はできるだけ軽く。

            //
            // リストボックスには、テーブルをセットしています。
            // 取り出されるものは「行」になります。
            //
            // DataRowをセットしましたが、取り出されるのは DataRowViewになるようです。
            DataRowView dataRowView = (DataRowView)cctLst.Items[nCurIx];
            Table_Humaninput o_Table = cctLst.Table_Humaninput_Datasource;

            if (null == o_Table)
            {
                // データソースがセットされていない場合。
                goto gt_Error_10;
            }
            else if (!log_Reports.Successful)
            {
                goto gt_Error_20;
            }

            //
            // 使われ方として、
            // リストボックスの oValue は、データテーブルであることが多い。
            //
            // その場合、HTMLのような、リストボックスからvalue値を取ると数字が返ってくる、ということがない。
            //

            PipeSeparatedString sPipes = new PipeSeparatedStringImpl();

            sDisplayText = sPipes.Perform(
                cctLst.SItemDisplayFormat,
                dataRowView,
                o_Table,
                log_Reports
                );

            if (!log_Reports.Successful)
            {
                sDisplayText = "(エラー発生中)";
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_10:
            {
                sDisplayText = null;// "(Err10)早すぎロード";//"[" + ccLst .ControlCommon.Expression_Name_Control.E_Execute(null)+ "]リストボックスにデータソース・テーブルが指定されていませんでした)");

                // 項目数だけエラーダイアログボックスが出てくるので、省略。
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            gt_Error_20:
            {
                sDisplayText = "(リストボックスにDataSourceTableが指定されていません)";

                // 項目数だけエラーダイアログボックスが出てくるので、省略。
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            // ↓2012-02-02 追加
            while (cctLst.List_SText_Display.Count <= nCurIx)
            {
                cctLst.List_SText_Display.Add(null);
            }
            cctLst.List_SText_Display[nCurIx] = sDisplayText;

            pg_Method.EndMethod(log_Reports);
            return sDisplayText;
        }
Пример #3
0
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="displayText"></param>
        /// <param name="foreBrushOrNull">指定しない場合はヌル。</param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        public virtual void P4_DrawString(
            object sender,
            DrawItemEventArgs e,
            string sDisplayText,
            Brush foreBrushOrNull,
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "P4_Main",log_Reports);
            //
            //

            ListBox pclst = (ListBox)sender;

            bool bForeBrushCreated = false;
            Brush foreBrush;
            Exception err_Excp;

            if (log_Reports.Successful)
            {
                // 正常時

                //
                // 文字列の描画
                try
                {
                    if (null == foreBrushOrNull)
                    {
                        // スタイルシートで設定しないとき

                        if (e.State == DrawItemState.Selected)
                        {
                            // 選択項目

                            // 背景色が濃い色と想定。
                            foreBrush = Brushes.White;
                        }
                        else if (e.State == DrawItemState.None)
                        {
                            // 非選択項目

                            // 無視
                            foreBrush = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                        else
                        {
                            //無視
                            foreBrush = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                    }
                    else
                    {
                        // スタイルシートで設定するとき

                        if (e.State == DrawItemState.Selected)
                        {
                            // 選択項目

                            // 背景色が濃い色と想定。
                            foreBrush = Brushes.White;
                        }
                        else if (e.State == DrawItemState.None)
                        {
                            // 非選択項目

                            foreBrush = foreBrushOrNull;
                        }
                        else
                        {
                            // 無視
                            foreBrush = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                    }

                    e.Graphics.DrawString(sDisplayText, e.Font, foreBrush, e.Bounds);
                }
                catch (ArgumentException ex)
                {
                    foreBrush = null;
                    err_Excp = ex;
                    goto gt_Error_ArgumentException;
                }

                //
                // 後始末
                if (bForeBrushCreated)
                {
                    foreBrush.Dispose();
                }

                // フォーカスを示す四角形を描画
                e.DrawFocusRectangle();
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_ArgumentException:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sDisplayText, log_Reports);//表示テキスト
                tmpl.SetParameter(2, e.Font.ToString(), log_Reports);//フォント名
                tmpl.SetParameter(3, foreBrush.ToString(), log_Reports);//前景ブラシ名
                tmpl.SetParameter(4, e.Bounds.ToString(), log_Reports);//矩形位置とサイズ
                tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ

                this.Owner_MemoryApplication.CreateErrorReport("Er:535;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Пример #4
0
        //────────────────────────────────────────
        /// <summary>
        /// 
        /// </summary>
        /// <param name="curIx"></param>
        /// <param name="ccLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns>指定しない場合はヌル。</returns>
        public Brush P2_GetForeBrush(//virtual
            int nCurIx,
            CustomcontrolListbox ccLst,
            Log_Reports log_Reports
            )
        {
            //
            // "banana|apple"など、スタイルの名称を予定。
            string sStyleAttrNames = this.P2b_GetStyleName(nCurIx, ccLst, log_Reports);//ok

            Brush brush;

            // ↓2012-02-03 追加
            if (nCurIx < ccLst.List_ForeBrush.Count)
            {
                brush = ccLst.List_ForeBrush[nCurIx];
                if (null != brush)
                {
                    goto gt_EndMethod;
                }
            }

            // スタイルを読み取りたい。
            if (this.Owner_MemoryApplication.MemoryStyles.Dictionary_RecordStyle.ContainsKey(sStyleAttrNames))
            {
                RecordXenonStyle sStyleRec = this.Owner_MemoryApplication.MemoryStyles.Dictionary_RecordStyle[sStyleAttrNames];

                XenonStyle o_Style = new XToMemory_Style().Parse(
                    sStyleRec.Style,
                    log_Reports
                    );

                if (null != o_Style.ForeXenonColor)
                {
                    // 前景色の指定があれば。

                    //
                    // 指定の色のブラシを作成。
                    brush = this.Owner_MemoryApplication.MemoryBrushes.GetByStyle(o_Style);
                }
                else
                {
                    // 前景色の指定がなければ。

                    //
                    // ブラシ変更なし。
                    brush = null;
                }
            }
            else
            {
                // 前景色で。

                //
                // ブラシ変更なし。
                brush = null;
            }

            //
            //
            //
            //
            gt_EndMethod:

            // ↓2012-02-03 追加
            while (ccLst.List_ForeBrush.Count <= nCurIx)
            {
                ccLst.List_ForeBrush.Add(null);
            }
            ccLst.List_ForeBrush[nCurIx] = brush;

            return brush;
        }
Пример #5
0
 //────────────────────────────────────────
 public virtual string P2b_GetStyleName(
     int nCurIx, CustomcontrolListbox ccListbox, Log_Reports log_Reports)
 {
     return "";
 }
Пример #6
0
        //────────────────────────────────────────
        /// <summary>
        /// 項目の文字列。
        /// </summary>
        /// <param name="e"></param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public override string P1_GetItemString(
            int nCurIx,//DrawItemEventArgs e,//e.Index
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);
            log_Method.BeginMethod(Info_MiddleImpl.Name_Library, this, "P1_GetItemLabel",log_Reports);
            //
            //

            string sDisplayText;

            // ↓2012-01-20 追加
            if (nCurIx < cctLst.List_SText_Display.Count)
            {
                sDisplayText = cctLst.List_SText_Display[nCurIx];
                if (null != sDisplayText)
                {
                    goto gt_EndMethod;
                }
            }

            //
            // 項目の数だけ呼び出される。
            // 処理はできるだけ軽く。

            if (null == this.Expression_ItemLabel)
            {
                sDisplayText = "(" + Info_MiddleImpl.Name_Library + "#P1_GetItemString:リストボックスに<a-item-label>が指定されていません)";
                goto gt_EndMethod;
            }

            //
            // dataRowViewが入っている。
            DataRowView dataRowView = (DataRowView)cctLst.Items[nCurIx];
            //
            //
            // ID値を取得し、キー値とする。
            int nKey;
            Int_HumaninputImpl.TryParse(// ※仮。
                dataRowView.Row["ID"],
                out nKey,
                EnumOperationIfErrorvalue.Error,
                -1,
                log_Reports
                );
            if (!log_Reports.Successful)
            {
                // エラー
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

            if (log_Reports.Successful)
            {
                string sKey = nKey.ToString(); // ※仮。

                //
                // value-variable-name="" 属性
                if (null == this.Expression_ValueVariableName)
                {
                    //
                    // エラー。
                    sDisplayText = "(変数名取得失敗)";
                    goto gt_Error_NullValueVariableName;
                }
                else
                {
                    //
                    // 変数名取得。

                    StringBuilder sbHint = new StringBuilder();
                    sbHint.Append(Info_MiddleImpl.Name_Library);
                    sbHint.Append(":");
                    sbHint.Append(this.GetType().Name);
                    Configurationtree_Node parent_Configurationtree_Node = new Configurationtree_NodeImpl(sbHint.ToString(), null);

                    string sVariableName = this.Expression_ValueVariableName.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                    XenonNameImpl o_Name_Variable = new XenonNameImpl(sVariableName, parent_Configurationtree_Node);

                    //ystem.Console.WriteLine(this.GetType().Name + "#P1_GetItemLabel: sVariableName=[" + sVariableName + "] sValue=[" + sValue + "]");

                    //
                    // ループカウンター変数に、キー値を上書き。
                    this.Owner_MemoryApplication.MemoryVariables.SetStringValue(
                        o_Name_Variable,
                        sKey,
                        true,
                        log_Reports
                        );
                }

                //
                // 表示文字列。
                sDisplayText = this.Expression_ItemLabel.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
            }
            else
            {
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

            if (!log_Reports.Successful)
            {
                sDisplayText = "(エラー発生中)";
                goto gt_EndMethod;
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
            gt_Error_NullValueVariableName:
            if (log_Reports.CanCreateReport)
            {
                Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error);
                r.SetTitle("▲エラー926!", log_Method);

                StringBuilder t = new StringBuilder();
                t.Append("<view>の<f-listbox-for-items>に、");
                t.Append(Environment.NewLine);
                t.Append("value-variable-name=””属性がありませんでした。");

                t.Append(Environment.NewLine);
                t.Append("コントロール名=[");
                t.Append(cctLst.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports));
                t.Append("]");

                r.Message = t.ToString();
                log_Reports.EndCreateReport();
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
            gt_EndMethod:

            // ↓2012-01-20 追加
            while (cctLst.List_SText_Display.Count <= nCurIx)
            {
                cctLst.List_SText_Display.Add(null);
            }
            cctLst.List_SText_Display[nCurIx] = sDisplayText;

            log_Method.EndMethod(log_Reports);
            return sDisplayText;
        }
Пример #7
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────

        public override void Execute4_OnOEa(
            object sender, EventArgs e
            )
        {
            Log_Method  pg_Method = new Log_MethodImpl(0);
            Log_Reports log_Reports_ThisMethod = new Log_ReportsImpl(pg_Method);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Execute4_OnOEa", log_Reports_ThisMethod);
            //
            //

            Customcontrol cct = null;

            string sName_Usercontrol;

            if (sender is Customcontrol)
            {
                cct = (Customcontrol)sender;

                sName_Usercontrol = cct.ControlCommon.Expression_Name_Control.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports_ThisMethod);

                log_Reports_ThisMethod.Comment_EventCreationMe = "[" + sName_Usercontrol + "]コントロールでOEaアクションが実行されました。";
            }
            else
            {
                sName_Usercontrol = "";
                log_Reports_ThisMethod.Comment_EventCreationMe = "OEaアクションが実行されました。";
            }


            if (log_Reports_ThisMethod.CanStopwatch)
            {
                string sEventName;
                this.Configurationtree_Event.Dictionary_Attribute.TryGetValue(PmNames.S_NAME, out sEventName, true, log_Reports_ThisMethod);

                pg_Method.Log_Stopwatch.Message = Utility_Format.Format(
                    sName_Usercontrol,
                    sEventName
                    );
                pg_Method.Log_Stopwatch.Begin();
            }

            //
            //
            //
            //


            // ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
            // ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
            // ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
            {
                CustomcontrolListbox ccLst = (CustomcontrolListbox)sender;

                //true ||
                if (this.nIndex_PreSelected != ccLst.SelectedIndex)
                {
                    //essageBox.Show(Info_Forms.LibraryName + ":" + this.GetType().Name + "#Perform_OEa: FC[" + fcNameStr + "]で、イベント(リストボックスの項目選択等)が起こりました。 .SelectedIndex=[" + .SelectedIndex + "] preSelectedIndex=["+this.preSelectedIndex+"]");
                }
                else
                {
                    //
                    // リストボックスの selectedIndex が変わっていないとき。
                    //
                    // ※ dataSourceのテーブルの行が変わったりすると、ここに来ます。
                    //
                    return;

                    //essageBox.Show(Info_Forms.LibraryName + ":" + this.GetType().Name + "#Perform_OEa: FC[" + fcNameStr + "]で、イベント(リストボックスの項目選択等)が起こっていません。選択項目インデックスが同じです。 .SelectedIndex=[" + .SelectedIndex + "] preSelectedIndex=[" + this.preSelectedIndex + "]");
                }

                this.nIndex_PreSelected = ccLst.SelectedIndex;
            }


            //
            // 「登録アクション設定」を元に、「アクション」を作成し、実行順に実行。
            //

            Configurationtree_Event.List_Child.ForEach(delegate(Configurationtree_Node systemFunction_Conf, ref bool bBreak)
            {
                Expression_Node_Function expr_Func = cct.ControlCommon.Owner_MemoryApplication.MemoryForms.ConfigurationtreeToFunction.Translate(
                    systemFunction_Conf,
                    true,
                    log_Reports_ThisMethod
                    );

                if (log_Reports_ThisMethod.Successful)
                {
                    //ystem.Console.WriteLine(Info_Forms.LibraryName + ":" + this.GetType().Name + "#Perform_OEa: 何回呼び出される?(B)");
                    expr_Func.Execute4_OnOEa(sender, e);
                }
            });


            goto gt_EndMethod;
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports_ThisMethod);
            log_Reports_ThisMethod.EndLogging(pg_Method);
        }
Пример #8
0
        //────────────────────────────────────────
        #endregion



        #region アクション
        //────────────────────────────────────────


        /// <summary>
        /// 初回、リストボックスの項目1つずつに1回呼び出されます。
        ///
        /// その後は、再描画が必要な項目だけ呼び出されます。
        /// </summary>
        /// <param nFcName="sender"></param>
        /// <param nFcName="e"></param>
        public void Perform(
            object sender,
            DrawItemEventArgs e,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "Perform", log_Reports);
            //
            //

            // 項目がなければ、中断。
            if (e.Index < 0)
            {
                return;
            }


            // リストボックスの項目1つ分の背景を描画します。
            e.DrawBackground();

            // CSVExE用に改造されたコントロールが使用されているものとします。
            CustomcontrolListbox ccLst = (CustomcontrolListbox)sender;

            //
            // 描画する文字列を作成します。
            string sItemDisplayText = this.P1_GetItemString(e.Index, ccLst, log_Reports);

            if (!log_Reports.Successful)
            {
                // 失敗していれば中断。
                goto gt_EndMethod;
            }

            //
            // 描画色のブラシ。指定しない場合はヌル。
            Brush foreBrushOrNull = this.P2_GetForeBrush(e.Index, ccLst, log_Reports);

            //
            // 妥当性判定
            Expressionv_4ADisplay err_Expressionv_ADisplay = null;

            {
                //
                // <validator>要素数だけ。通常、0 or 1。
                List <Expressionv_3FListboxValidation> ecvList_Validators = ccLst.List_Expressionv_FListboxValidation;
                foreach (Expressionv_3FListboxValidation ecv_ListboxV in ecvList_Validators)
                {
                    //
                    // <display>系の数だけ。通常、1。
                    List <Expressionv_4ADisplay> ecvList_ADisplay = ecv_ListboxV.List_Expressionv_ADisplay;
                    foreach (Expressionv_4ADisplay ecv_ADisplay in ecvList_ADisplay)
                    {
                        err_Expressionv_ADisplay = ecv_ADisplay;

                        string sType;
                        if (ecv_ADisplay.Dictionary_SAttribute.ContainsKey(PmNames.S_TYPE.Name_Pm))
                        {
                            sType = ecv_ADisplay.Dictionary_SAttribute[PmNames.S_TYPE.Name_Pm];
                        }
                        else
                        {
                            sType = "<エラー>";
                        }

                        if ("DSP_空レコード" == sType.Trim())
                        {
                            //
                            // 子要素が true を返してきたら、
                            // グレー表示。


                            // ★★★★★★★★★★★この中で時間食ってる。
                            DataRowView dataRowView = (DataRowView)ccLst.Items[e.Index];
                            ecv_ADisplay.SetDataRow(dataRowView.Row);
                            string sResult = ecv_ADisplay.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports);
                            // ★★★★★★★★★★★この中で時間食ってる。



                            bool bResult;
                            if (Boolean.TryParse(sResult, out bResult))
                            {
                                //
                                // 変換成功

                                if (bResult)
                                {
                                    //
                                    // 空レコードなら
                                    foreBrushOrNull = this.Owner_MemoryApplication.MemoryBrushes.GetByName("BRUSH_listItem_emptyRecord");
                                }
                                else
                                {
                                    //
                                    // 空レコードではないなら
                                    foreBrushOrNull = this.Owner_MemoryApplication.MemoryBrushes.GetByName("BRUSH_listItem_existsData");
                                }
                            }
                            else
                            {
                                //
                                // 変換失敗

                                foreBrushOrNull = this.Owner_MemoryApplication.MemoryBrushes.GetByName("BRUSH_listItem_error");

                                // ループから脱出
                                goto gt_EndLoop_Validation;
                            }
                        }
                        else
                        {
                            //
                            // エラー。
                            goto gt_Error_UndefinedType;
                        }
                    }
                }
            }
gt_EndLoop_Validation:
            //
            //

            //
            // 項目のテキストを描画。
            //
            this.P4_DrawString(sender, e, sItemDisplayText, foreBrushOrNull, ccLst, log_Reports);

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_UndefinedType:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                //コントロールの型名
                if (err_Expressionv_ADisplay.Dictionary_SAttribute.ContainsKey(PmNames.S_TYPE.Name_Pm))
                {
                    tmpl.SetParameter(1, err_Expressionv_ADisplay.Dictionary_SAttribute[PmNames.S_TYPE.Name_Pm], log_Reports);
                }
                else
                {
                    tmpl.SetParameter(1, "ヌル", log_Reports);
                }

                this.Owner_MemoryApplication.CreateErrorReport("Er:534;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Пример #9
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="displayText"></param>
        /// <param name="foreBrushOrNull">指定しない場合はヌル。</param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        public virtual void P4_DrawString(
            object sender,
            DrawItemEventArgs e,
            string sDisplayText,
            Brush foreBrushOrNull,
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "P4_Main", log_Reports);
            //
            //

            ListBox pclst = (ListBox)sender;

            bool      bForeBrushCreated = false;
            Brush     foreBrush;
            Exception err_Excp;

            if (log_Reports.Successful)
            {
                // 正常時

                //
                // 文字列の描画
                try
                {
                    if (null == foreBrushOrNull)
                    {
                        // スタイルシートで設定しないとき

                        if (e.State == DrawItemState.Selected)
                        {
                            // 選択項目

                            // 背景色が濃い色と想定。
                            foreBrush = Brushes.White;
                        }
                        else if (e.State == DrawItemState.None)
                        {
                            // 非選択項目

                            // 無視
                            foreBrush         = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                        else
                        {
                            //無視
                            foreBrush         = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                    }
                    else
                    {
                        // スタイルシートで設定するとき

                        if (e.State == DrawItemState.Selected)
                        {
                            // 選択項目

                            // 背景色が濃い色と想定。
                            foreBrush = Brushes.White;
                        }
                        else if (e.State == DrawItemState.None)
                        {
                            // 非選択項目

                            foreBrush = foreBrushOrNull;
                        }
                        else
                        {
                            // 無視
                            foreBrush         = new SolidBrush(e.ForeColor);
                            bForeBrushCreated = true;
                        }
                    }

                    e.Graphics.DrawString(sDisplayText, e.Font, foreBrush, e.Bounds);
                }
                catch (ArgumentException ex)
                {
                    foreBrush = null;
                    err_Excp  = ex;
                    goto gt_Error_ArgumentException;
                }

                //
                // 後始末
                if (bForeBrushCreated)
                {
                    foreBrush.Dispose();
                }

                // フォーカスを示す四角形を描画
                e.DrawFocusRectangle();
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_ArgumentException:
            {
                Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl();
                tmpl.SetParameter(1, sDisplayText, log_Reports);                                     //表示テキスト
                tmpl.SetParameter(2, e.Font.ToString(), log_Reports);                                //フォント名
                tmpl.SetParameter(3, foreBrush.ToString(), log_Reports);                             //前景ブラシ名
                tmpl.SetParameter(4, e.Bounds.ToString(), log_Reports);                              //矩形位置とサイズ
                tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ

                this.Owner_MemoryApplication.CreateErrorReport("Er:535;", tmpl, log_Reports);
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            pg_Method.EndMethod(log_Reports);
        }
Пример #10
0
        //────────────────────────────────────────

        /// <summary>
        ///
        /// </summary>
        /// <param name="curIx"></param>
        /// <param name="ccLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns>指定しない場合はヌル。</returns>
        public Brush P2_GetForeBrush(//virtual
            int nCurIx,
            CustomcontrolListbox ccLst,
            Log_Reports log_Reports
            )
        {
            //
            // "banana|apple"など、スタイルの名称を予定。
            string sStyleAttrNames = this.P2b_GetStyleName(nCurIx, ccLst, log_Reports);//ok


            Brush brush;


            // ↓2012-02-03 追加
            if (nCurIx < ccLst.List_ForeBrush.Count)
            {
                brush = ccLst.List_ForeBrush[nCurIx];
                if (null != brush)
                {
                    goto gt_EndMethod;
                }
            }


            // スタイルを読み取りたい。
            if (this.Owner_MemoryApplication.MemoryStyles.Dictionary_RecordStyle.ContainsKey(sStyleAttrNames))
            {
                RecordXenonStyle sStyleRec = this.Owner_MemoryApplication.MemoryStyles.Dictionary_RecordStyle[sStyleAttrNames];

                XenonStyle o_Style = new XToMemory_Style().Parse(
                    sStyleRec.Style,
                    log_Reports
                    );

                if (null != o_Style.ForeXenonColor)
                {
                    // 前景色の指定があれば。

                    //
                    // 指定の色のブラシを作成。
                    brush = this.Owner_MemoryApplication.MemoryBrushes.GetByStyle(o_Style);
                }
                else
                {
                    // 前景色の指定がなければ。

                    //
                    // ブラシ変更なし。
                    brush = null;
                }
            }
            else
            {
                // 前景色で。

                //
                // ブラシ変更なし。
                brush = null;
            }

            //
            //
            //
            //
gt_EndMethod:

            // ↓2012-02-03 追加
            while (ccLst.List_ForeBrush.Count <= nCurIx)
            {
                ccLst.List_ForeBrush.Add(null);
            }
            ccLst.List_ForeBrush[nCurIx] = brush;


            return(brush);
        }
Пример #11
0
        //────────────────────────────────────────

        public virtual string P2b_GetStyleName(
            int nCurIx, CustomcontrolListbox ccListbox, Log_Reports log_Reports)
        {
            return("");
        }
Пример #12
0
        //────────────────────────────────────────

        /// <summary>
        /// 項目の文字列。
        /// </summary>
        /// <param name="e"></param>
        /// <param name="cctLst"></param>
        /// <param name="log_Reports"></param>
        /// <returns></returns>
        public virtual string P1_GetItemString(
            int nCurIx,
            CustomcontrolListbox cctLst,
            Log_Reports log_Reports
            )
        {
            Log_Method pg_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static);

            pg_Method.BeginMethod(Info_Controls.Name_Library, this, "P1_GetItemLabel", log_Reports);
            //
            //
            string sDisplayText;


            // ↓2012-02-02 追加
            if (nCurIx < cctLst.List_SText_Display.Count)
            {
                sDisplayText = cctLst.List_SText_Display[nCurIx];
                if (null != sDisplayText)
                {
                    goto gt_EndMethod;
                }
            }

            //
            // 項目の数だけ呼び出される。
            // 処理はできるだけ軽く。


            //
            // リストボックスには、テーブルをセットしています。
            // 取り出されるものは「行」になります。
            //
            // DataRowをセットしましたが、取り出されるのは DataRowViewになるようです。
            DataRowView      dataRowView = (DataRowView)cctLst.Items[nCurIx];
            Table_Humaninput o_Table     = cctLst.Table_Humaninput_Datasource;

            if (null == o_Table)
            {
                // データソースがセットされていない場合。
                goto gt_Error_10;
            }
            else if (!log_Reports.Successful)
            {
                goto gt_Error_20;
            }


            //
            // 使われ方として、
            // リストボックスの oValue は、データテーブルであることが多い。
            //
            // その場合、HTMLのような、リストボックスからvalue値を取ると数字が返ってくる、ということがない。
            //

            PipeSeparatedString sPipes = new PipeSeparatedStringImpl();

            sDisplayText = sPipes.Perform(
                cctLst.SItemDisplayFormat,
                dataRowView,
                o_Table,
                log_Reports
                );

            if (!log_Reports.Successful)
            {
                sDisplayText = "(エラー発生中)";
            }

            goto gt_EndMethod;
            //
            //
            #region 異常系
            //────────────────────────────────────────
gt_Error_10:
            {
                sDisplayText = null;// "(Err10)早すぎロード";//"[" + ccLst .ControlCommon.Expression_Name_Control.E_Execute(null)+ "]リストボックスにデータソース・テーブルが指定されていませんでした)");

                // 項目数だけエラーダイアログボックスが出てくるので、省略。
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
gt_Error_20:
            {
                sDisplayText = "(リストボックスにDataSourceTableが指定されていません)";

                // 項目数だけエラーダイアログボックスが出てくるので、省略。
            }
            goto gt_EndMethod;
            //────────────────────────────────────────
            #endregion
            //
            //
gt_EndMethod:
            // ↓2012-02-02 追加
            while (cctLst.List_SText_Display.Count <= nCurIx)
            {
                cctLst.List_SText_Display.Add(null);
            }
            cctLst.List_SText_Display[nCurIx] = sDisplayText;

            pg_Method.EndMethod(log_Reports);
            return(sDisplayText);
        }