Hi, I am going crazy trying to resolve a stupid issue. I have a RTB
control and created a method to accept a string and (hopefully) set
the font and size and alignment... Here is the method:
private void AddToRTFReport( string asText, object aoColor,
string asFont,object aoFontStyle, int aiSize, object aoAlignment)
{
int liLen = rtb1.Text.Lengt h;
if (liLen <= 0)
{
rtb1.Text = asText;
rtb1.SelectionS tart = 0;
rtb1.SelectionL ength = rtb1.Text.Lengt h;
}
else
{
rtb1.Text += asText;
rtb1.SelectionS tart = liLen;
rtb1.SelectionL ength = asText.Length;
}
rtb1.SelectionC olor = (Color)aoColor;
rtb1.SelectionA lignment =
(HorizontalAlig nment)aoAlignme nt;
rtb1.SelectionF ont = new Font(asFont, aiSize,
(FontStyle)aoFo ntStyle);
}
I call my method like this:
AddToRTFReport( "Some Text", Color.Black, "Microsoft Sans Serif",
FontStyle.Bold, 10, HorizontalAlign ment.Center);
The problem is, if I call it using bold, 16 pt and then call it again
using regular 10 point, everything displays as bold 16pt. It is
making me crazy. Can you see what I may be doing wrong??
Thanks! 3 1355
On Fri, 28 Dec 2007 11:54:29 -0800, Soulless <dg*******@gmai l.comwrote:
[...]
The problem is, if I call it using bold, 16 pt and then call it again
using regular 10 point, everything displays as bold 16pt. It is
making me crazy. Can you see what I may be doing wrong??
I'm not seeing anything immediately apparent to me. Maybe someone else
can solve this via code inspection.
But: what do you see when you step through the code? What is the
selection just before you set the selection formatting properties? Did it
get set to the text you expected it to?
Pete
On Dec 28, 2:02*pm, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Fri, 28 Dec 2007 11:54:29 -0800, Soulless <dgmsal...@gmai l.comwrote:
[...]
The problem is, if I call it using bold, 16 pt and then call it again
using regular 10 point, everything displays as bold 16pt. *It is
making me crazy. *Can you see what I may be doing wrong??
I'm not seeing anything immediately apparent to me. *Maybe someone else *
can solve this via code inspection.
But: what do you see when you step through the code? *What is the *
selection just before you set the selection formatting properties? *Did it *
get set to the text you expected it to?
Pete
When I walk through it, it all looks fine... I can see the appropriate
font, but it is not reflected on the Richtext control.
I am putting newlines in as well to work with a totally different line
of text. don't know if that is causing an issue.
On Fri, 28 Dec 2007 12:27:58 -0800, Soulless <dg*******@gmai l.comwrote:
When I walk through it, it all looks fine... I can see the appropriate
font, but it is not reflected on the Richtext control.
But what's the selection for the control at the moment that you set the
SelectionFont (for example)?
I am putting newlines in as well to work with a totally different line
of text. don't know if that is causing an issue.
I don't think it should, but I suppose you could try it without them.
For best help, you should post a concise but complete sample of code that
reliably reproduces the problem. I haven't had a chance to try the code
you posted, but if the problem isn't reproducible with any random Forms
application using that code, no one will be able to look at the behavior
directly without a complete sample from you.
Pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pete Griffint |
last post by:
Howdy!
I want to get the following in a Richtext control:
Paragraph 1....
Paragraph 2...
Obviously I want to do something like
rtb.SelectedText="Paragraph 1...";
rtb.SelectedText=<paragraph break>; (*)
|
by: Lukas Thanei |
last post by:
Hi,
Im trying for 2 days to solve a problem but now Im on a point where all
ideas exhausted. Im writing a software to print out some cards containing
richtext and images.
To print the richtext im using an windows api call (Sendmessage
EM_FORMATRANGE -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp).
Because I have to print background images, the richtext background should be
|
by: Du |
last post by:
I like richtext textbox and its shortcut, but I don't need the richtext
format. How do I tell the richtext text box to strips all the format and
convert everything to plain text?
Thanks
|
by: JC - home |
last post by:
Hello..
I've been having some problems for a little while with this which I was
sure I would beat...hmmm.
Anyway, I have a form with two rich textboxes. One at the top which is
to display a concatenated summary, and one at the botton for making a
new entry.
When items are added in from the bottom box, I do this via a class
|
by: Gary Shell |
last post by:
I have a very ODD situation.
I have a RichTextBox and a button. In the button click event I have the
following:
me.richtextbox1.SelectedText="test"
Assuming I start with "aaaabbbbcccc" in the richtext box and I place the
caret between the a and b and hit the button. I get "aaaatestbbbbcccc" as
expected. Then I click between the b and the c and hit the button I get:
| |
by: rigamonk |
last post by:
Is there a way to save richtext from a richtextbox into an access DB using
vb.net?
thanks
patrick
|
by: tlyczko |
last post by:
I have Stephen Lebans' RichText control on a subform, which is bound to
a memo field.
The only editable control on this subform is the rich text control for
the memo field.
When the main form opens, the first record of the subform cannot be
typed into.
The only way to fix this is to page to the next record, then page back
to the first record, then one can type into the rich text control to
|
by: Tomo |
last post by:
How to use RichText in ASP.NET application. I need to make web page where
user can write some text, click save and than this content must be saved as
html content. Can I find some richtext control or I need to use javascript?
|
by: giddy |
last post by:
hi ,
i made a little RtfEncapsulator. Its a class thats called RichText ,
it has an RtfElementCollection which takes any class that exposes the
IRtfElement interface.
I managed to make an RtfTextElement which works really well.
So to add text this has to be done:
Code:
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |