private void Initialize() { textBox = new AATextBox(); renameBtn = new PictureBox(); renameBtn.SizeMode = PictureBoxSizeMode.AutoSize; renameBtn.Image = Resources.Layer_RenameBtn_on; textBoxBG = new ThreePatch(Resources.Layer_TextBox_Left, Resources.Layer_TextBox_mid, Resources.Layer_TextBox_Right); textBox.BorderStyle = BorderStyle.None; textBox.Font = new Font(FontManager.스웨거체.FontFamily, 16); textBox.BackColor = Color.FromArgb(235, 235, 235); textBox.Location = new Point(Layer.textPadding, (int)((textBoxBG.Height - textBox.Height) * 0.5f)); textBoxBG.Visible = false; Controls.Add(textBoxBG); Controls.Add(renameBtn); textBoxBG.Controls.Add(textBox); textBoxBG.SetWidth(MaxWidth); textBoxBG.BringToFront(); textBox.BringToFront(); renameBtn.BringToFront(); Size = new Size(0, textBoxBG.left.Height); Render(); }
public void Render() { if (attachedLayer != null) { SuspendLayout(); Show(); Location = new Point(MainForm.instance.Location.X + Layer.LeftPadding + attachedLayer.LeftSpace + attachedLayer.Width + 5, MainForm.instance.Location.Y + MainForm.instance.layerArea.Location.Y + attachedLayer.group.Location.Y + (Layer.Height - Height) / 2); if (attachedLayer.TargetDate.Year == DateTime.Now.Year) { text.Text = attachedLayer.TargetDate.ToString("M월 d일 ddd"); } else { text.Text = attachedLayer.TargetDate.ToString("yyyy년 M월 d일 ddd"); } text.UpdateWidth(); Size = new Size(text.Width + panel.right.Width + 3, Height); panel.SetWidth(Width); ResumeLayout(); Update(); } else { Hide(); } }
//외부함수 public void Render() { if (attachedLayer != null && !attachedLayer.isPeriodPressed) { SuspendLayout(); Visible = true; textBoxBG.Visible = isEditing; int textWidth = attachedLayer.mainText.Width; Point layerPos = new Point(Layer.LeftPadding, (int)(attachedLayer.IndexY * Layer.Height) + MainForm.instance.layerArea.Location.Y); BackColor = attachedLayer.BGColor; if (isEditing) { Location = new Point( layerPos.X + attachedLayer.LeftSpace + Layer.textPadding, layerPos.Y + (int)((Layer.Height - textBoxBG.Height) * 0.5f)); int textBoxBGWidth = 0; if (attachedLayer.mainText.Width > MaxWidth) { textBoxBGWidth = textWidth; } else { textBoxBGWidth = Math.Min(MaxWidth, attachedLayer.mainText.maxWidth); } textBoxBG.SetWidth(textBoxBGWidth); textBox.Size = new Size(textBoxBG.Width - 10, Height); textBox.Text = attachedLayer.mainText.Text; textBox.Select(textBox.Text.Length, 0); renameBtn.Location = new Point(textBoxBG.Width, 0); Size = new Size(renameBtn.Location.X + renameBtn.Width, Height); textBox.Focus(); } else { Location = new Point( layerPos.X + attachedLayer.LeftSpace + Layer.textPadding + textWidth, layerPos.Y + (int)((Layer.Height - textBoxBG.Height) * 0.5f)); renameBtn.Location = new Point(0, 0); Size = new Size(renameBtn.Width, Height); renameBtn.Focus(); } ResumeLayout(); Refresh(); } else { Visible = false; } }