Font size change C++ windows form application

Ibrokhimov Akhrullo 1 Reputation point
2022-03-19T07:34:37.963+00:00

how to change textbox font size with combobox value in c++ windows form application

Developer technologies | Windows Forms
Developer technologies | C++
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2022-03-19T08:17:39.41+00:00

    You can do something like :

    private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)  
    {  
    	ComboBox^ comboBox = (ComboBox^)(sender);  
    	if (comboBox->SelectedItem != nullptr)  
    	{  
    		int nSize = int::Parse(comboBox->SelectedItem->ToString());  
    		textBox1->Font = gcnew System::Drawing::Font(textBox1->Font->FontFamily, nSize);  
    		// etc...  
    	}	  
    }  
    

    184773-cpp-cli-fontsize.gif

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.