嗨我目前有一个texbox,当用户按下不同的按钮时会向用户输出信息.我想知道是否有办法让我的一些文字加粗,其余的不是.
我尝试过以下方法:
textBox1.FontWeight = FontWeights.UltraBold;
textBox1.Text. = ("Your Name: " );
TextBox1.FontWeight = FontWeights.Regular;
textBox1.Text += (nameVar);
Run Code Online (Sandbox Code Playgroud)
唯一的问题是,使用这种方式会使一切变得大胆或什么都没有.有没有办法做到这一点?我在C#中使用WPF项目
任何意见或建议表示赞赏.谢谢!
编辑:所以现在我想尝试你所有建议的RichText框,但我似乎无法得到任何东西出现在其中:
// Create a simple FlowDocument to serve as the content input for the construtor.
FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("Simple FlowDocument")));
// After this constructor is called, the new RichTextBox rtb will contain flowDoc.
RichTextBox rtb = new RichTextBox(flowDoc);
Run Code Online (Sandbox Code Playgroud)
rtb是我在我的wpf中创建的我的richtextbox的名称
谢谢
我想拥有类型特征,这将有助于我从成员函数指针中获取类的类型。我调查了这个答案 ,发现我已经达到目标了。
看起来像这样:
#include <iostream>
// example class
struct MyClass {
void funct() { std::cout << "funct has been called....\n"; }
};
// traits
template<typename Class> struct get_class{};
template<typename ReType, typename Class, typename... Args>
struct get_class<ReType(Class::*)(Args...)>
{
using type = Class;
};
template<typename Type> using get_class_t = typename get_class<Type>::type;
int main()
{
get_class_t<decltype(&MyClass::funct)> myObj;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---> this is a lot of typing
myObj.funct();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,如代码中所示,我每次都需要编写,get_class_t<decltype(&MyClass::funct)>
或者
auto ptr = &MyClass::funct;
get_class_t<decltype(ptr)> myObj;
// ^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
这很多decltype() …
Iterable<Board> theNeighbors = new ArrayList<Board>();
Run Code Online (Sandbox Code Playgroud)
这是我对ArrayListtheNeighbors的初始化,它使用了interafce Iterable进行声明.但是,当我使用方法add()来构建我刚刚构建的变量时,编译器会发出警报
Board.java:78:错误:找不到符号theNeighbors.add(nb); ^
符号:方法添加(Board)
位置:变量类型Iterable的邻居
是什么让它发生?在我使用的另一种情况
List<Board> theNeighbors = new ArrayList<Board>();
Run Code Online (Sandbox Code Playgroud)
该add()方法效果很好.您为声明选择的界面是否应始终具有您稍后要调用的方法?
我可以在.NET运行时中将IronPython代码编译为EXE或DLL吗?
我想在OpenCV上编写自己的内核用于Image分类.
但对于SVM(Opencv的内置函数),内核已经定义.
我的问题是,OpenCV中有什么东西可以让我定义我的内核吗?
实际上,我想为图像分类实现多核学习.
鉴于以下代码,我从Shape继承了一个Circle:
class Shape
{
void Draw();
}
class Circle : Shape
{
}
void Main(string[] args)
{
Shape s = new Shape();
Shape s2 = new Shape();
Circle c = new Circle();
List<Shape> ShapeList = new List<Shape>();
ShapeList.Add(s);
ShapeList.Add(s2);
ShapeList.Add(c);
}
Run Code Online (Sandbox Code Playgroud)
怎么可以c加入ShapeList?
我开发了一个网站:有些字段用英文输入,而其他字段用阿拉伯语输入.
现在我想简化用户的输入操作,并希望阿拉伯文本框作为DLL.
我有一个,但它只适用于IE - 不使用Firefox或谷歌浏览器..
非常感谢..
如何强制用户用阿拉伯语写?我的意思是每次尝试更改语言时都没有(ALT + SHIFT)键直接移动光标......如果有任何方式,属性,DLL或者什么都做...
我想将 jquery fullcalendar 更改为波斯日历。
我正在使用此代码:
isRTL: true,
monthNames: ['???????', '????????', '?????', '???', '?????', '??????',
'???', '????', '???', '??', '????', '?????'],
monthNamesShort: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
dayNames: ['??????', '??????', '???????', '????????', '???????', '????', '????'],
dayNamesShort: ['??????', '??????', '???????', '????????', '???????', '????', '????'],
dayNamesMin: ['??????', '??????', '???????', '????????', '???????', '????', '????'],
weekHeader: '????',
dateFormat: 'yy/mm/dd',
firstDay: 6,
Run Code Online (Sandbox Code Playgroud)
我的用户界面已更改,但日历可能不是波斯语
请考虑以下代码:
char char_a = 'A';
int int_b = 34;
char* p_a = &char_a;
int* p_b = &int_b;
cout<<"Value of int_b is (*p_b) :"<< *p_b<<endl;
cout<<"Value of &int_b is (p_b) :"<< p_b<<endl;
cout<<"Value of char_a is (*p_a) :"<< *p_a<<endl;
cout<<"Value of &char_a is (p_a) :"<< p_a<<endl;
Run Code Online (Sandbox Code Playgroud)
当我运行它时,输出是:

那么为什么不在char指针的情况下显示地址,就像它对整数的指针一样?
exit和std::exitC++有什么区别?我研究了它,但我找不到任何东西.
这两个代码有什么区别:
1:
if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
std::cout << "Error: Can't initialize the SDL \n";
exit(EXIT_FAILURE);
}
Run Code Online (Sandbox Code Playgroud)
2:
if(SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
std::cout << "Error: Can't initialize the SDL \n";
std::exit(EXIT_FAILURE);
}
Run Code Online (Sandbox Code Playgroud) c# ×4
c++ ×3
.net ×2
arraylist ×1
asp.net ×1
bold ×1
c#-4.0 ×1
c++11 ×1
dll ×1
exit ×1
inheritance ×1
ironpython ×1
java ×1
javascript ×1
jquery ×1
oop ×1
opencv ×1
pointers ×1
polymorphism ×1
templates ×1
textbox ×1
type-traits ×1
upcasting ×1
wpf ×1