예제 #1
0
파일: FLERForm.cs 프로젝트: 96-LB/FLER
 private void UpdateBuilder(object sender, EventArgs e)
 {
     if (!Building)
     {
         return;
     }
     CurrentCard.Tags = txt_tags.Text.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
     Flashcard.Face face = sfc_builder.Flipped ? CurrentCard.Hidden : CurrentCard.Visible;
     face.BackColor = pnl_backcolor.BackColor;
     face.LineColor = pnl_linecolor.BackColor;
     face.ImagePath = img_img.ImageLocation;
     face.ImageBox  = new Rectangle((int)Math.Round(num_img_left.Value), (int)Math.Round(num_img_top.Value), (int)Math.Round(num_img_width.Value), (int)Math.Round(num_img_height.Value));
     face.ImageTop  = check_drawover.Checked;
     //note: font is omitted because it is directly set in PickFont()
     face.Text      = txt_text.Text;
     face.TextColor = pnl_txt_color.BackColor;
     face.TextBox   = new Rectangle((int)Math.Round(num_txt_left.Value), (int)Math.Round(num_txt_top.Value), (int)Math.Round(num_txt_width.Value), (int)Math.Round(num_txt_height.Value));
     foreach (Control control in pnl_builder.Controls)
     {
         if (control is RadioButton radio)
         {
             if (radio.Checked)
             {
                 face.TextAlign = radio.TextAlign;
             }
         }
     }
     sfc_builder.LoadCard(CurrentCard);
     Invalidate(sfc_builder.Bounds);
 }
예제 #2
0
파일: FLERForm.cs 프로젝트: 96-LB/FLER
 private void UpdateBuilderControls(object sender, EventArgs e)
 {
     Building = false;
     tim_builder.Stop();
     txt_tags.Text = string.Join(" ", CurrentCard.Tags ?? new string[0]);
     Flashcard.Face face = sfc_builder.Flipped != (sender == sfc_builder) ? CurrentCard.Hidden : CurrentCard.Visible;
     pnl_backcolor.BackColor = face.BackColor;
     pnl_linecolor.BackColor = face.LineColor;
     try
     {
         img_img.Image?.Dispose();
         img_img.Image         = Image.FromFile(face.ImagePath);
         img_img.ImageLocation = face.ImagePath;
     }
     catch
     {
         img_img.Image         = Properties.Resources.Missing;
         img_img.ImageLocation = null;
     }
     num_img_left.Value      = face.ImageBox.Left;
     num_img_top.Value       = face.ImageBox.Top;
     num_img_width.Value     = face.ImageBox.Width;
     num_img_height.Value    = face.ImageBox.Height;
     check_drawover.Checked  = face.ImageTop;
     lbl_font.Text           = $"{face.Font.FontFamily.Name}, {Math.Round(face.Font.Size)}pt";
     lbl_font.Font           = new Font(face.Font.FontFamily, lbl_font.Font.Size, face.Font.Style);
     _fontDialog.Font        = face.Font;
     txt_text.Text           = face.Text;
     pnl_txt_color.BackColor = face.TextColor;
     num_txt_left.Value      = face.TextBox.Left;
     num_txt_top.Value       = face.TextBox.Top;
     num_txt_width.Value     = face.TextBox.Width;
     num_txt_height.Value    = face.TextBox.Height;
     foreach (Control control in pnl_builder.Controls)
     {
         if (control is RadioButton radio)
         {
             radio.Checked = radio.TextAlign == face.TextAlign;
         }
     }
     Building = true;
 }