Karthik Agarwal

Karthik Agarwal

  • NA
  • 748
  • 266.9k

How to maximize a textbox when a button is clicked

Aug 30 2011 1:28 AM
Hi,

I have a textbox (dynamically created textbox) into which i will write some text after reading a file. But the text in that is very big when compared to the form size. So what i did is i kept a button at the end of the textbox so that when user clicks on that i will increase or popup some dialog box which just shows the complete text in the textbox. how can i do that? The way how i added button to textbox is as follows:

[Description ("Sample string to be displayed in viewer"), Category ("Text Configuration")]
       [EditorAttribute(StringSelect::typeid, System::Drawing::Design::UITypeEditor::typeid)]
       property String ^ StringSelect
       {
           String ^ get()
           {
               return sample_string;
           }

           void set( String ^ val )
           {
               sample_string = val;
           }
       }

public ref class StringSelect : System::Drawing::Design::UITypeEditor
   {
        public:
            virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext ^ context) override
            {
                if(context != nullptr && context->Instance != nullptr)
                {
                    return System::Drawing::Design::UITypeEditorEditStyle::Modal;
                }
                else
                {
                    return System::Drawing::Design::UITypeEditorEditStyle::None;
                }
            }

            [RefreshProperties(RefreshProperties::All)]
            virtual Object ^ EditValue( ITypeDescriptorContext ^  context,
                                System::IServiceProvider ^ provider,
                                Object ^ value)   override
            {
                if(context == nullptr || provider == nullptr || context->Instance == nullptr)
                {
                    return value;
                }
                return value;
            }
   };

What ever the answer you are gonna give, if that is an extension of this that would help me better.

Thanks & Regards,
Karthik

Answers (4)