//──────────────────────────────────────── #endregion #region イベントハンドラー //──────────────────────────────────────── private void UsercontrolLabel_Paint(object sender, PaintEventArgs e) { UsercontrolLabel ucLbl = (UsercontrolLabel)sender; // 自分の内側に線を引ければよい。 Rectangle rect = new Rectangle( 0, 0, ucLbl.Width - 1, ucLbl.Height - 1 ); // 背景色はない。 // 枠もない。 if (Log_ReportsImpl.BDebugmode_Form) { // 画面レイアウト・デバッグ用 e.Graphics.DrawRectangle(Pens.Red, rect); } // テキスト表示領域は、四角の線から1ドット離すように小さくします。 rect.Inflate(-2, -2); e.Graphics.DrawString(this.customcontrolLabel1.Text, this.customcontrolLabel1.Font, new SolidBrush(this.customcontrolLabel1.ForeColor), rect); // e.Graphics.DrawString(this.ccLabel.Text, this.ccLabel.Font, Brushes.Black, rect); }
//──────────────────────────────────────── public Usercontrol Perform( Expression_Node_StringImpl ec_FcName, MemoryApplication owner_MemoryApplication ) { UsercontrolLabel uctLbl = new UsercontrolLabel(); // 名前だけ初期設定 uctLbl.Expression_Name_Control = ec_FcName; uctLbl.ControlCommon.Owner_MemoryApplication = owner_MemoryApplication; return uctLbl; }
//──────────────────────────────────────── private void UsercontrolLabel_SizeChanged(object sender, EventArgs e) { UsercontrolLabel ucLabel = (UsercontrolLabel)sender; this.customcontrolLabel1.Width = ucLabel.Width; this.customcontrolLabel1.Height = ucLabel.Height; // サイズを変更しても、 // ラベルの設定によってはサイズが変わらないことがあります。 // // ラベルのサイズをフィードバックします。 ucLabel.Width = this.customcontrolLabel1.Width; ucLabel.Height = this.customcontrolLabel1.Height; }