Re: changing font of textboxes

  • From: sameer manohtra <sameermanohtra@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 4 Nov 2010 11:10:58 +0530

Thanks all for your help, I  have finally done the trick.

Now, I am stuck on another issue.

By doing the coding on relevant buttons I’m able to change the font
face and style of the textbox’s text,
But by this, everything inside the textbox is changing, instead of
selected text.

I got to know by a bit of searching that it can easily be done by
taking rich textboxes, but I have been instructed by superiors to use
simple textboxes only.

Any idea how can i assure to apply the changes in font for only the
selected text instead of entire textbox?

Many thanks.

Sameer!



On 11/3/10, Jacques Bosch <jfbosch@xxxxxxxxx> wrote:
> However, that won't work if the requirement is that there actually
> needs to be a button on the form that exhibits that behavior.
>
>
> On Wed, Nov 3, 2010 at 4:16 PM, black ares
> <matematicianu2003@xxxxxxxxxxx> wrote:
>> instead of using button click, and shortcut for it.
>> try to use the keypressed event.
>> that event will corectly give to you tte control who received the focus.
>>
>> ----- Original Message ----- From: "sameer manohtra"
>> <sameermanohtra@xxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Wednesday, November 03, 2010 9:38 AM
>> Subject: Re: changing font of textboxes
>>
>>
>> its windows application in c#.
>>
>> there's "focus()" and "bool focused"  available there, but none of
>> them is working.
>>
>> the reason i think is that i'm writing this coding on button click
>> event, which means that the coding comes on action  when button one is
>> clicked.  means, even if i assign a shortcut to it, the on focus item
>> would be that button, right?
>>
>> i was trying to find out any property which can let me check the last
>> focused control, but no luck as of now.
>>
>> any help, list?
>>
>> sameer!
>>
>> On 11/3/10, Jacques Bosch <jfbosch@xxxxxxxxx> wrote:
>>>
>>> Hi there. In what language / environment? Windows Forms .Net?
>>> Is there not perhaps a HasFocus property on those textbox controls?
>>> Then you could loop through them and check which is true.
>>>
>>> On Wed, Nov 3, 2010 at 8:26 AM, sameer manohtra
>>> <sameermanohtra@xxxxxxxxx> wrote:
>>>>
>>>> hi list,
>>>> I’m in an interesting situation:
>>>>
>>>> I’m trying to develop a simple form where my users should have
>>>> options to change the font size, font style etc on click of buttons.
>>>> i know this can be done by writing like following on the button:
>>>>
>>>> textBox1.Font = new Font(this.Font, FontStyle.Bold);
>>>>
>>>> its working, but the problem is, that I need a bold button which
>>>> should change the font style into bold of the text box which is
>>>> selected.
>>>>
>>>> What i mean is, that there should just be one bold button, and if user
>>>> is on textbox1 and presses the shortcut key (ctrl+b for instance),
>>>> text of textbox 1 should be bolded, but if user is focused on textbox2
>>>> and presses the same shortcut key, text of textbox2 should be changed
>>>> this time, not textbox1.
>>>>
>>>> I know, conditional expressions will be use, but I’m unable to find
>>>> out what should I check in this case?
>>>>
>>>> Please help me doing this.
>>>>
>>>> Sameer manohtra.
>>>> __________
>>>> View the list's information and change your settings at
>>>> //www.freelists.org/list/programmingblind
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Jacques Bosch
>>> __________
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/programmingblind
>>>
>>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>>
>
>
>
> --
> Jacques Bosch
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: