473,804 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Font copy/paste issue ...

Hi Guys,

I have the following issue ...

I have a form with two richTextBoxes named

(01) richTextBox1
(02) richTextBox2

with some controls for selecting Font types (Arial, Courier, etc) and Font
size(s).

The text I enter in richTextBox1 gets copied (sent to) richTextBox2 upon
selecting a send button (provided in the form). Say, initially, I enter a
text (say, crazy)using a font (which is Courier, size = 10) and do a send.
The text "crazy" gets displayed in the richTextBox2 in the font that is
selected in the richTextBox1.

Now, I clear the richTextBox1 and enter a new text (say, language) using a
different font (which is Times New Roman, size 17) and do a send. Now the
text "language" gets appended to the earlier one "crazy" and gets displayed
as "crazylanguage" . The displayed text is fine. The problem is with the
font.

I want the richTextBox2 to have the font of text "crazy" to be in the
Courier font with size = 10 and the newly appended text "language" to be in
the Times New Roman font with size = 17. But that is not what is happening.
The new text also, gets changed to the Courier font with size = 10.

I use the richTextBox2.St art position to calculate from where the new font
should be applicable and somehow it is not working. See the code below and
any help on this is appreciated.

PART OF THE CODE - BELOW
*************** ************
// Use the font selected from this in richTextBox2
// *************** *************** *****
private void richTextBox1_Te xtChanged(objec t sender, System.EventArg s e)
{
fontUsed4Curren tText = richTextBox1.Se lectionFont;
}

// On button send, copy the text from richTextBox1 to richTextBox2
// *************** *************** *************** *****
private void button1_Click(o bject sender, System.EventArg s e)
{
// Get the starting position for the new font to be applied
richTextBox2.Se lectionStart += richTextBox2.Te xtLength;

// Get the length of the string to be copied
richTextBox2.Se lectionLength = richTextBox1.Te xtLength;

// Set the font to be used for the copied/pasted text
richTextBox2.Se lectionFont = fontUsed4Curren tText;

// The richTextBox1 text is appended to the existing text in
richTextBox2
richTextBox2.Te xt += richTextBox1.Te xt;

// The text entered in the richTextBox1 is cleared
// and the focus is set back to richTextBox1
richTextBox1.Te xt = "";
richTextBox1.Fo cus();
}

Expecting any help on this at the earliest. Thanks in advance. Let me know,
if you have any questions.

Regards,
Hariharan S

Nov 15 '05 #1
0 1403

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2435
by: François de Dardel | last post by:
I have a complete Intranet site with about 140 pages using Verdana as the basic font. How do I place a table (12 columns) with Arial instead of Verdana, only for that table. I have defined a style in my CSS and tried to apply it to the table, doesn't work. I have tried to wrap the table in a div with the style. Doesn't work. I have tried the old-fashioned <font> tag, doesn't work. I must be doing something wrong. It works however if I...
7
2978
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
24
2846
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available with the printer that i am printing to(Zebra TLP2844). When i open Word and look at the fonts available for the default printer, it does not show the fonts i want. If i cahnge the printer to the printer that
8
2685
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must be able to receive forminformation and store that in a database and later produce it on screen on the client (just plain HTML).
0
4302
by: villagegreen | last post by:
I'm trying to use an html form to upload foreign language translations of English terms into a MySQL database. Since many different languages will be entered on the page, I have read that I should set the charset on my uploading page as follows: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> This has worked great for many different languages, including: Arabic, Spanish, Mandarin, etc. Basically, I have all the...
7
8700
kcdoell
by: kcdoell | last post by:
Good morning everyone: I created a form and set the default view as a continuous form. Basically the form is displaying records in which the user can add or edit new ones. The record source for this form is a query that I built that is based on a table. I have been working on this for several weeks and now I have been told that many times when a user wants to create a new record, much of the information that is displayed in a...
1
2059
by: lrw0831 | last post by:
I have the main form where employees enter "issues". Some issues have fields that are the same. My fields are Issue ID (auto) Product Entered BY Issue Type Priority Request from Status Assigned to
6
6532
by: lrw0831 | last post by:
I have the main form where employees enter "issues". Some issues have fields that are the same. My fields are Issue ID (auto) Product Entered BY Issue Type Priority Request from Status Assigned to
1
2119
by: =?Utf-8?B?cG10N2Fy?= | last post by:
I have installed IME for writing in japanese. But the IME Pad Hand Writing doesnt work, i can draw, but in the lef box all the sugerences are white, are invisible, I have to mouseover them to see its reading and guess it. And the main problem i got now: I installed (simply copy&paste) some new japanese font and now the IME has changed to it. I mean, when i write something and press SPACEBAR, the candidate window is in another font (not...
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
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,...
0
10082
tracyyun
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...
0
9160
agi2029
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...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.