本文整理汇总了C#中System.Windows.Forms.RichTextBox.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.BringToFront方法的具体用法?C# RichTextBox.BringToFront怎么用?C# RichTextBox.BringToFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.RichTextBox
的用法示例。
在下文中一共展示了RichTextBox.BringToFront方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SwitchToHtmlSourceViewer
public static void SwitchToHtmlSourceViewer(RichTextBox richTextBox)
{
if (richTextBox.IsNull())
{
throw new ArgumentNullException();
}
richTextBox.BringToFront();
}
示例2: rich_TextChanged
private void rich_TextChanged(object sender, EventArgs e)
{
if (m_busy)
return;
m_busy = true;
m_buffer.Text = m_active.Text;
m_buffer.SelectAll();
m_buffer.SelectionColor = m_defaultColor;
ControlEventArgs args = new ControlEventArgs(m_buffer);
OnHighlight(args);
m_buffer.SelectionStart = m_active.SelectionStart;
m_buffer.SelectionLength = m_active.SelectionLength;
Native.SCROLLINFO si = new Native.SCROLLINFO();
si.Size = (uint)Marshal.SizeOf(typeof(Native.SCROLLINFO));
si.Mask = Native.SIF_POS;
Native.GetScrollInfo(m_active.Handle, (int)Native.SB_VERT, ref si);
Native.SetScrollInfo(m_buffer.Handle, (int)Native.SB_VERT, ref si, true);
uint wparam = ((uint)si.Pos << 16) + Native.SB_THUMBPOSITION;
Native.SendMessage(m_buffer.Handle, Native.WM_VSCROLL, wparam, 0);
Native.SendMessage(m_buffer.Handle, Native.WM_VSCROLL, Native.SB_ENDSCROLL, 0);
m_busy = false;
RichTextBox temp = m_active;
m_active = m_buffer;
m_buffer = temp;
m_active.BringToFront();
m_active.Show();
m_buffer.Hide();
m_active.Focus();
}
示例3: AddPage
public void AddPage(string codeName, string Text, bool generateUserList = true)
{
if (this.tabControl1.InvokeRequired)
{
this.tabControl1.BeginInvoke(new AddPageSafe(AddPage), codeName, Text, generateUserList);
return;
}
else
{
if (!codeName.StartsWith("page_"))
codeName = "page_" + codeName;
#region Input box
RichTextBox tb2 = new RichTextBox();
tb2.BackColor = Color.Black;
//tb2.Location = new Point(3, 347);
//tb2.Size = new Size(751, 20);
tb2.Height = 20;
tb2.Margin = new System.Windows.Forms.Padding(3, 3, 3, 3);
tb2.Dock = DockStyle.Bottom;
tb2.ForeColor = Color.White;
tb2.Name = codeName + "_tb2";
tb2.TabIndex = 0;
tb2.Multiline = false;
tb2.KeyPress += new KeyPressEventHandler(this.tb2_KeyPress);
#endregion
#region User list
ListBox lb1 = new ListBox();
Label l1 = new Label();
if (generateUserList)
{
l1.BackColor = Color.Black;
l1.ForeColor = Color.White;
l1.Name = codeName + "_l1";
l1.Text = "Unlocked NickList";
lb1.BackColor = Color.Black;
lb1.Dock = DockStyle.Right;
lb1.ForeColor = Color.White;
lb1.Name = codeName + "_lb1";
lb1.Margin = new System.Windows.Forms.Padding(3, 3, 3, 3);
lb1.ItemHeight = 15;
lb1.DrawMode = DrawMode.OwnerDrawFixed;
lb1.DrawItem += new DrawItemEventHandler(this.NickListColorHandler);
}
#endregion
#region Chat history text box
RichTextBox tb1 = new RichTextBox();
tb1.BackColor = Color.Black;
tb1.Dock = DockStyle.Fill;
tb1.ForeColor = Color.White;
tb1.MaxLength = 99999999;
tb1.Multiline = true;
tb1.Margin = new System.Windows.Forms.Padding(3, 3, 3, 3);
tb1.Name = codeName + "_tb1";
tb1.Font = tb2.Font = new Font("Courier New", 9);
tb1.ReadOnly = true;
tb1.Size = new Size(751, 349);
tb1.TabStop = false;
tb1.TabIndex = 1;
tb1.ScrollBars = RichTextBoxScrollBars.Both;
tb1.TextChanged += new EventHandler(tb1_TextChanged);
#endregion
#region Page
TabPage tp = new TabPage();
tp.BackColor = Color.Black;
tp.Controls.Add(tb2);
tp.Controls.Add(tb1);
if (generateUserList) tp.Controls.Add(l1);
if (generateUserList) tp.Controls.Add(lb1);
tp.Location = new Point(4, 22);
tp.Name = codeName;
tp.Padding = new Padding(3);
tp.Size = new Size(760, 480);
tp.TabIndex = 0;
tp.Text = Text;
tb1.BringToFront();
#endregion
tabControl1.Controls.Add(tp);
tabControl1.SelectedTab = tp;
}
}
示例4: LayoutFields
///<summary>Runs as the final step of loading the form, and also immediately after fields are moved down due to growth.</summary>
private void LayoutFields() {
panelMain.Controls.Clear();
RichTextBox textbox;//has to be richtextbox due to MS bug that doesn't show cursor.
FontStyle style;
SheetCheckBox checkbox;
//first, draw images---------------------------------------------------------------------------------------
//might change this to only happen once when first loading form:
if(pictDraw!=null) {
if(panelMain.Controls.Contains(pictDraw)) {
Controls.Remove(pictDraw);
}
pictDraw=null;
}
imgDraw=null;
pictDraw=new PictureBox();
if(SheetCur.IsLandscape) {
imgDraw=new Bitmap(SheetCur.Height,SheetCur.Width);
pictDraw.Width=SheetCur.Height;
pictDraw.Height=SheetCur.Width;
}
else {
imgDraw=new Bitmap(SheetCur.Width,SheetCur.Height);
pictDraw.Width=SheetCur.Width;
pictDraw.Height=SheetCur.Height;
}
pictDraw.Location=new Point(0,0);
pictDraw.Image=(Image)imgDraw.Clone();
pictDraw.SizeMode=PictureBoxSizeMode.StretchImage;
panelMain.Controls.Add(pictDraw);
panelMain.SendToBack();
Graphics pictGraphics=Graphics.FromImage(imgDraw);
foreach(SheetField field in SheetCur.SheetFields) {
if(field.FieldType!=SheetFieldType.Image) {
continue;
}
string filePathAndName=ODFileUtils.CombinePaths(SheetUtil.GetImagePath(),field.FieldName);
Image img=null;
if(field.FieldName=="Patient Info.gif") {
img=Properties.Resources.Patient_Info;
}
else if(File.Exists(filePathAndName)) {
img=Image.FromFile(filePathAndName);
}
else {
continue;
}
pictGraphics.DrawImage(img,field.XPos,field.YPos,field.Width,field.Height);
}
pictGraphics.Dispose();
//Set mouse events for the pictDraw
pictDraw.MouseDown+=new MouseEventHandler(pictDraw_MouseDown);
pictDraw.MouseMove+=new MouseEventHandler(pictDraw_MouseMove);
pictDraw.MouseUp+=new MouseEventHandler(pictDraw_MouseUp);
//draw drawings, rectangles, and lines-----------------------------------------------------------------------
RefreshPanel();
//draw textboxes----------------------------------------------------------------------------------------------
foreach(SheetField field in SheetCur.SheetFields) {
if(field.FieldType!=SheetFieldType.InputField
&& field.FieldType!=SheetFieldType.OutputText
&& field.FieldType!=SheetFieldType.StaticText) {
continue;
}
textbox=new RichTextBox();
textbox.BorderStyle=BorderStyle.None;
textbox.TabStop=false;//Only input fields allow tab stop (set below for input text).
//textbox.Multiline=true;//due to MS malfunction at 9pt which cuts off the bottom of the text.
if(field.FieldType==SheetFieldType.OutputText
|| field.FieldType==SheetFieldType.StaticText) {
//textbox.BackColor=Color.White;
//textbox.BackColor=Color.FromArgb(245,245,200);
}
else if(field.FieldType==SheetFieldType.InputField) {
textbox.BackColor=Color.FromArgb(245,245,200);
textbox.TabStop=(field.TabOrder==0?false:true);
textbox.TabIndex=field.TabOrder;
}
textbox.Location=new Point(field.XPos,field.YPos);
textbox.Width=field.Width;
textbox.ScrollBars=RichTextBoxScrollBars.None;
textbox.Text=field.FieldValue;
style=FontStyle.Regular;
if(field.FontIsBold) {
style=FontStyle.Bold;
}
textbox.Font=new Font(field.FontName,field.FontSize,style);
if(field.Height<textbox.Font.Height+2) {
textbox.Multiline=false;
//textbox.AcceptsReturn=false;
}
else {
textbox.Multiline=true;
//textbox.AcceptsReturn=true;
}
textbox.Height=field.Height;
//textbox.ScrollBars=RichTextBoxScrollBars.None;
textbox.Tag=field;
textbox.TextChanged+=new EventHandler(text_TextChanged);
panelMain.Controls.Add(textbox);
textbox.BringToFront();
//.........这里部分代码省略.........
示例5: LayoutFields
//.........这里部分代码省略.........
pictDraw.MouseUp+=new MouseEventHandler(pictDraw_MouseUp);
//draw drawings, rectangles, and lines-----------------------------------------------------------------------
RefreshPanel();
//draw textboxes----------------------------------------------------------------------------------------------
foreach(SheetField field in SheetCur.SheetFields) {
if(field.FieldType!=SheetFieldType.InputField
&& field.FieldType!=SheetFieldType.OutputText
&& field.FieldType!=SheetFieldType.StaticText) {
continue;
}
textbox=new RichTextBox();
textbox.BorderStyle=BorderStyle.None;
textbox.TabStop=false;//Only input fields allow tab stop (set below for input text).
//textbox.Multiline=true;//due to MS malfunction at 9pt which cuts off the bottom of the text.
if(field.FieldType==SheetFieldType.OutputText
|| field.FieldType==SheetFieldType.StaticText) {
//textbox.BackColor=Color.White;
//textbox.BackColor=Color.FromArgb(245,245,200);
}
else if(field.FieldType==SheetFieldType.InputField) {
textbox.BackColor=Color.FromArgb(245,245,200);
textbox.TabStop=(field.TabOrder==0?false:true);
textbox.TabIndex=field.TabOrder;
}
textbox.Location=new Point(field.XPos,field.YPos);
textbox.Width=field.Width;
textbox.ScrollBars=RichTextBoxScrollBars.None;
if(field.ItemColor!=Color.FromArgb(0)){
textbox.ForeColor=field.ItemColor;
}
//textbox.Text=field.FieldValue;
textbox.SelectionAlignment=field.TextAlign;
textbox.SelectedText=field.FieldValue;
style=FontStyle.Regular;
if(field.FontIsBold) {
style=FontStyle.Bold;
}
textbox.Font=new Font(field.FontName,field.FontSize,style);
if(field.Height<textbox.Font.Height+2) {
textbox.Multiline=false;
//textbox.AcceptsReturn=false;
}
else {
textbox.Multiline=true;
//textbox.AcceptsReturn=true;
}
textbox.Height=field.Height;
//textbox.ScrollBars=RichTextBoxScrollBars.None;
textbox.Tag=field;
textbox.TextChanged+=new EventHandler(text_TextChanged);
panelMain.Controls.Add(textbox);
textbox.BringToFront();
}
//draw checkboxes----------------------------------------------------------------------------------------------
foreach(SheetField field in SheetCur.SheetFields) {
if(field.FieldType!=SheetFieldType.CheckBox) {
continue;
}
checkbox=new SheetCheckBox();
if(field.FieldValue=="X") {
checkbox.IsChecked=true;
}
checkbox.Location=new Point(field.XPos,field.YPos);
checkbox.Width=field.Width;
checkbox.Height=field.Height;
checkbox.Tag=field;
checkbox.MouseUp+=new MouseEventHandler(checkbox_MouseUp);
checkbox.TabStop=(field.TabOrder==0?false:true);
checkbox.TabIndex=field.TabOrder;
panelMain.Controls.Add(checkbox);
checkbox.BringToFront();
}
//draw signature boxes----------------------------------------------------------------------------------------------
foreach(SheetField field in SheetCur.SheetFields) {
if(field.FieldType!=SheetFieldType.SigBox) {
continue;
}
OpenDental.UI.SignatureBoxWrapper sigBox=new OpenDental.UI.SignatureBoxWrapper();
sigBox.Location=new Point(field.XPos,field.YPos);
sigBox.Width=field.Width;
sigBox.Height=field.Height;
if(field.FieldValue.Length>0) {//a signature is present
bool sigIsTopaz=false;
if(field.FieldValue[0]=='1') {
sigIsTopaz=true;
}
string signature="";
if(field.FieldValue.Length>1) {
signature=field.FieldValue.Substring(1);
}
string keyData=Sheets.GetSignatureKey(SheetCur);
sigBox.FillSignature(sigIsTopaz,keyData,signature);
}
sigBox.Tag=field;
sigBox.TabStop=(field.TabOrder==0?false:true);
sigBox.TabIndex=field.TabOrder;
panelMain.Controls.Add(sigBox);
sigBox.BringToFront();
}
}