问题描述
您好,我正在制作一个基于APA网络的引文生成器.一切都很好,但是我似乎无法使字符串具有斜体字体,这是我的代码.
Hi, I am making an APA web based citation generator. All is well but I seem to be having trouble making a string have an Italic font, Here is my code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string author;
string date;
string TitleOfArticle;
string Retriveddate;
string websiteURl;
string citation;
private void Form1_Load(object sender, EventArgs e)
{
AuthorBox.Items.Add("unidentified");
PublishBox.Items.Add("n.d");
TitleBox.Text.Equals(Font.Italic);
}
private void button1_Click(object sender, EventArgs e)
{
//issues: make the richtextbox display title as italic.
author = AuthorBox.Text;
date = PublishBox.Text;
TitleOfArticle = TitleBox.Text;
Retriveddate = RetrivedBox.Text;
websiteURl = URLBox.Text;
citation = author + " ." + "(" + date + "). " + TitleOfArticle + ". Retrieved " + Retriveddate + ", from " + websiteURl;
richTextBox1.Text = citation;
}
private void button3_Click(object sender, EventArgs e)
{
richTextBox1.Copy();
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Clear();
}
}
}
如您在示例代码中所看到的,我为每个组合框都有字符串,并且它们记录了每个框的用户输入.然后,我将所有这些组合在一起,并将其放入1个称为引文"的字符串中,当用户按下按钮时,该字符串将显示在Richtextbox中.在对APA进行适当的网络引用时,网页标题必须为斜体.当用户生成引用时,如何更改标题的字体样式并使其变为斜体?网页标题的字符串称为"TitleOfArticle".
感谢大家的帮助.
谢谢.
As you can see in my sample code I have strings for each combobox and they record the user''s input for each box. Then I combine all of them and put it into 1 string called "Citation" and when the user presses a button this string is displayed in a richtextbox. In a proper web citation for APA the title of the webpage needs to be Italic. How can I change the font style of the title and make it Italic when the user generates the citation? The string for the title of webpage is called "TitleOfArticle".
I appreciate everyones help.
Thanks.
推荐答案
这篇关于如何更改字符串的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!