我有一点问题.我有一个1 RichTextBox和2个按钮.
我有2个按钮,用于"切换Bold FStyle"和"切换斜体FStyle".
我想在不影响其他FontStyles的情况下切换FontStyles.我希望你能理解我.
下面的代码在组合 FontStyles时有效,但在分离/减去FontStyles时不起作用.
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.SelectionFont = new Font(richTextBox1.Font, (richTextBox1.SelectionFont.Bold == false ? richTextBox1.SelectionFont.Style | FontStyle.Bold : richTextBox1.SelectionFont.Style));
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.SelectionFont = new Font(richTextBox1.Font, (richTextBox1.SelectionFont.Italic == false ? richTextBox1.SelectionFont.Style | FontStyle.Italic : richTextBox1.SelectionFont.Style));
}
Run Code Online (Sandbox Code Playgroud)
我上课了
像这样
class im_a_class
{
static function not_empty() {...}
function render() { return array_filter($array,'self::not_empty') };
}
Run Code Online (Sandbox Code Playgroud)
此代码适用于php 5.3.0,但在5.2.8版中不起作用.
我不得不把它拿出来并像这样使用它
function not_empty() {...}
class im_a_class
{
function render() { return array_filter($array,'not_empty'); }
}
Run Code Online (Sandbox Code Playgroud)
这种方式有效但......
我想知道我有什么选择.
请帮助谢谢.
array-filter ×1
c# ×1
class ×1
fonts ×1
function ×1
php ×1
richtextbox ×1
static ×1
textbox ×1
winforms ×1