public MonthlyDataViewer(DataManager dataManager) { if (dataManager == null) { throw new ArgumentNullException("data"); } InitializeComponent(); _dataManager = dataManager; // DBから初期設定情報を読み込む。 _settings = _dataManager.GetMonthlyDataViewerSettings(); this.RemoveValueChangedEventHandler(); this.comboBox_Month.SelectedIndex = _settings.month.Month - 1; this.chart_Income.Controls.Add(this.label_Income); this.label_Income.Top = this.chart_Income.Top + ((this.chart_Income.Height - this.label_Income.Height) / 2) - 45; this.label_Income.Left = this.chart_Income.Left + ((this.chart_Income.Width - this.label_Income.Width) / 2) - 23; this.chart_Spending.Controls.Add(this.label_Spending); this.label_Spending.Top = this.label_Income.Top; this.button_PrevMonth.BackColor = CommonConst.PrevNextMonthButtonColor; this.button_NextMonth.BackColor = CommonConst.PrevNextMonthButtonColor; this.AdjustButtonShape(); this.numericUpDown_Year.BackColor = CommonConst.MonthControlButtonColor; this.comboBox_Month.BackColor = CommonConst.MonthControlButtonColor; }
/// <summary> /// 月毎のデータ閲覧画面の初期表示内容を決定するためのパラメータをDBに保存する。 /// </summary> /// <returns></returns> public void SetMonthlyDataViewerSettings(MonthlyDataViewerSettings settings) { _command.CommandText = "update 月毎のデータ画面設定 "; _command.CommandText += "set 設定値='" + settings.month.ToString("yyyy/MM") + "' "; _command.CommandText += "where 設定項目='年月'"; _command.ExecuteNonQuery(); }