本文整理汇总了C#中System.Windows.Controls.RichTextBox.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.SetValue方法的具体用法?C# RichTextBox.SetValue怎么用?C# RichTextBox.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.RichTextBox
的用法示例。
在下文中一共展示了RichTextBox.SetValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetIsEnabled
public static void SetIsEnabled(RichTextBox richTextBox, bool value)
{
if (richTextBox == null)
{
throw new ArgumentNullException("richTextBox");
}
richTextBox.SetValue(IsEnabledProperty, value);
}
示例2: CreateGrid
private Inline CreateGrid(DocTree tree)
{
Grid g = new Grid();
int rowMax = 0; int colMax = 0;
Dictionary<int, Dictionary<int, RichTextBox>> cells = new Dictionary<int, Dictionary<int, RichTextBox>>();
foreach (var child in tree.Children)
{
Span span = new Span();
DocTreeToTextElement(child, span.Inlines);
int row = child.Row - 1;
int col = child.Column - 1;
if (!cells.ContainsKey(col))
cells.Add(col, new Dictionary<int, RichTextBox>());
var column = cells[col];
if (!column.ContainsKey(row))
{
var spanel = new RichTextBox()
{
BorderThickness = new Thickness(0),
IsReadOnly = true
};
spanel.SetValue(Grid.ColumnProperty, col);
spanel.SetValue(Grid.RowProperty, row);
column.Add(row, spanel);
g.Children.Add(spanel);
}
RichTextBox tb = column[row];
tb.Selection.Insert(span);
rowMax = (int)Math.Max(rowMax, child.Row);
colMax = (int)Math.Max(colMax, child.Column);
}
for (int i = 0; i < rowMax; i++)
g.RowDefinitions.Add(new RowDefinition());
for (int i = 0; i < colMax; i++)
g.ColumnDefinitions.Add(new ColumnDefinition());
InlineUIContainer c = new InlineUIContainer()
{
Child = g
};
return c;
}
示例3: SetIgnorePrefix
public static void SetIgnorePrefix(RichTextBox richTextBox, bool value)
{
if (richTextBox == null)
{
throw new ArgumentNullException("richTextBox");
}
richTextBox.SetValue(IgnorePrefixProperty, value);
}
示例4: SetExcludeMentions
public static void SetExcludeMentions(RichTextBox richTextBox, bool value)
{
if (richTextBox == null)
{
throw new ArgumentNullException("richTextBox");
}
richTextBox.SetValue(ExcludeMentionsProperty, value);
}
示例5: SetBindableDocument
public static void SetBindableDocument(RichTextBox obj, FlowDocument value)
{
obj.SetValue(BindableDocumentProperty, value);
}
示例6: SetPreventTextInput
public static void SetPreventTextInput(RichTextBox obj,
bool value)
{
obj.SetValue(PreventTextInputProperty, value);
}
示例7: limitSkill_BindData
private void limitSkill_BindData(LimitSkillMaster skill, ActiveSkillMaster[] laSkill)
{
if (skill == null || skill.id == 0) {
UnitInfo_LimitSkill.Visibility = Visibility.Collapsed;
return;
}
UnitInfo_LimitSkill.Visibility = Visibility.Visible;
limitSkill_id.Text = skill.id.ToString();
limitSkill_name.Text = skill.name;
limitSkill_general_text.Document = Utility.ParseTextToDocument(skill.general_text);
limitSkill_coefficient.Text = skill.coefficient.ToString();
UnitInfo_LimitSkill_AS.Children.Clear();
for (int i = 0; i < 3; i++) {
ActiveSkillMaster askill = laSkill[i];
Grid grid = new Grid();
if (askill.id == 0) {
continue;
}
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
TextBlock tblTitle = new TextBlock() { FontWeight = FontWeights.Bold, Text = string.Format("L_AS{0}", i.ToString()) };
tblTitle.SetValue(Grid.ColumnProperty, 0);
tblTitle.SetValue(Grid.RowProperty, 0);
grid.Children.Add(tblTitle);
TextBox tbId = new TextBox() { Text = askill.id.ToString() };
tbId.SetValue(Grid.ColumnProperty, 1);
tbId.SetValue(Grid.RowProperty, 0);
grid.Children.Add(tbId);
TextBox tbName = new TextBox() { Text = askill.name };
tbName.SetValue(Grid.ColumnProperty, 2);
tbName.SetValue(Grid.RowProperty, 0);
tbName.SetValue(Grid.ColumnSpanProperty, 2);
grid.Children.Add(tbName);
RichTextBox rtb = new RichTextBox() { Document = Utility.ParseTextToDocument(askill.text) };
rtb.SetValue(Grid.ColumnProperty, 0);
rtb.SetValue(Grid.RowProperty, 1);
rtb.SetValue(Grid.ColumnSpanProperty, 4);
grid.Children.Add(rtb);
TextBlock tblType = new TextBlock() { Text = "type" };
tblType.SetValue(Grid.ColumnProperty, 0);
tblType.SetValue(Grid.RowProperty, 2);
grid.Children.Add(tblType);
TextBox tbTypeId = new TextBox() { Text = askill.type.ToString() };
tbTypeId.SetValue(Grid.ColumnProperty, 1);
tbTypeId.SetValue(Grid.RowProperty, 2);
grid.Children.Add(tbTypeId);
TextBox tbType = new TextBox() { Text = Utility.ParseSkillType((ActiveSkillType)askill.type) };
tbType.SetValue(Grid.ColumnProperty, 2);
tbType.SetValue(Grid.RowProperty, 2);
tbType.SetValue(Grid.ColumnSpanProperty, 2);
grid.Children.Add(tbType);
TextBlock tblAttr = new TextBlock() { Text = "attribute" };
tblAttr.SetValue(Grid.ColumnProperty, 0);
tblAttr.SetValue(Grid.RowProperty, 3);
grid.Children.Add(tblAttr);
TextBox tbAttr = new TextBox() { Text = Utility.ParseAttributeToString(askill.attribute) };
tbAttr.SetValue(Grid.ColumnProperty, 1);
tbAttr.SetValue(Grid.RowProperty, 3);
grid.Children.Add(tbAttr);
TextBox tbSubAttr = new TextBox() { Text = Utility.ParseAttributeToString(askill.sub_attr) };
tbSubAttr.SetValue(Grid.ColumnProperty, 2);
tbSubAttr.SetValue(Grid.RowProperty, 3);
grid.Children.Add(tbSubAttr);
//gridStyle
Grid gridStyle = new Grid();
gridStyle.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50) });
gridStyle.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
TextBlock tblStyle = new TextBlock() { Text = "style" };
tblStyle.SetValue(Grid.ColumnProperty, 0);
gridStyle.Children.Add(tblStyle);
TextBox tbStyle = new TextBox() { Text = Utility.ParseStyletype(askill.style) };
tbStyle.SetValue(Grid.ColumnProperty, 1);
gridStyle.Children.Add(tbStyle);
gridStyle.SetValue(Grid.ColumnProperty, 3);
gridStyle.SetValue(Grid.RowProperty, 3);
grid.Children.Add(gridStyle);
//gridInfo
Grid gridInfo = new Grid();
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
gridInfo.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
TextBlock tblPhase = new TextBlock() { Text = "phase" };
tblPhase.SetValue(Grid.ColumnProperty, 0);
gridInfo.Children.Add(tblPhase);
TextBox tbPhase = new TextBox() { Text = ((SkillPhase)askill.phase).ToString() };
tbPhase.SetValue(Grid.ColumnProperty, 1);
gridInfo.Children.Add(tbPhase);
//.........这里部分代码省略.........