Hi,
I would like to get rid of the dotted selection rectangle that appears when a Tab is selected or focused. I am using the Owner Draw Mode in Windows Form.
Any ideas?
Cheers
Soorali
2 3688 Banfa 9,065
Recognized Expert Moderator Expert
Erm, if you are drawing it yourself then don't draw the focus rectangle. I look at the code handling the drawing would help.
I am not drawing it.
Below is my code: -
// tabControl1
-
this->tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed;
-
this->tabControl1->SizeMode = TabSizeMode::Fixed;
-
this->tabControl1->Controls->Add(this->tabPage1);
-
this->tabControl1->Controls->Add(this->tabPage2);
-
this->tabControl1->Controls->Add(this->tabPage3);
-
this->tabControl1->Controls->Add(this->tabPage4);
-
this->tabControl1->Font = (gcnew System::Drawing::Font(L"Arial", 11.13F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
-
static_cast<System::Byte>(0)));
-
this->tabControl1->ImeMode = System::Windows::Forms::ImeMode::NoControl;
-
this->tabControl1->ItemSize = System::Drawing::Size(115, 30);
-
this->tabControl1->Location = System::Drawing::Point(-4,76);
-
this->tabControl1->Multiline = true;
-
this->tabControl1->Name = L"tabControl1";
-
this->tabControl1->Size = System::Drawing::Size(495, 595);
-
this->tabControl1->Appearance= TabAppearance::Normal;
-
this->tabControl1->TabIndex = 0;
-
this->tabControl1->BackColor = System::Drawing::Color::White;
-
-
// tabPage1
-
this->tabPage1->BackColor = System::Drawing::Color::White;
-
this->tabPage1->BackgroundImage = System::Drawing::Image::FromFile("C:\\Program Files\\Text_General1.png");
-
this->tabPage1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Center;
-
this->tabPage1->Controls->Add(this->Range1);
-
this->tabPage1->ForeColor = System::Drawing::Color::White;
-
this->tabPage1->Location = System::Drawing::Point(-4, 34);
-
this->tabPage1->Name = L"tabPage1";
-
this->tabPage1->Size = System::Drawing::Size(495, 559); this->tabPage1->Text = L" GENERAL ";
-
this->tabPage1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form2::tabPage1_MouseMove);
-
this->tabPage1->Click += gcnew System::EventHandler(this, &Form2::tabPage1_Click);
-
this->tabPage1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form2::tabPage1_MouseDown);
-
this->tabPage1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form2::tabPage1_MouseUp);
-
-
//Not including code here for all the other tab pages and the controls within each Tabpage
-
// Below is the Code for the Draw Item
-
private:void tabControl1_DrawItem( Object^ sender, System::Windows::Forms::DrawItemEventArgs^ e )
-
{
-
-
System::Drawing::Rectangle destRect = System::Drawing::Rectangle(0,-20,550,70);
-
SolidBrush^ FillBrush = gcnew SolidBrush(Color::Black);// Background Color
-
SolidBrush^ TextBrush = gcnew SolidBrush(Color::FromArgb(178,178,178)); // Text Color
-
StringFormat^ sf = gcnew StringFormat();// String Format
-
sf->Alignment = StringAlignment::Center;//Vertical Alignment
-
sf->LineAlignment = StringAlignment::Center;
-
// Horizontal Alignment
-
e->Graphics->FillRectangle(FillBrush,0,0,550,100);
-
tabArea1 = tabControl1->GetTabRect(tabPage1->TabIndex); // Gets the Selected tab area defined by its TabIndex.Returns a Rectangle to tabArea.
-
tabTextArea1 = tabControl1->GetTabRect(tabPage1->TabIndex);
-
tabArea2 = tabControl1->GetTabRect(tabPage2->TabIndex); tabTextArea2 = tabControl1->GetTabRect(tabPage2->TabIndex);
-
tabArea3 = tabControl1->GetTabRect(tabPage3->TabIndex); tabTextArea3 = tabControl1->GetTabRect(tabPage3->TabIndex);
-
tabArea4 = tabControl1->GetTabRect(tabPage4->TabIndex); tabTextArea4 = tabControl1->GetTabRect(tabPage4->TabIndex);
-
if (tabControl1->SelectedTab==tabPage1)
-
{
-
System::Drawing::Font^ font1 = gcnew System::Drawing::Font( "Arial",12.13f, System::Drawing::FontStyle::Bold );// Defines Font face, size, style
-
System::Drawing::Font^ font2 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );// Defines Font face, size, style
-
System::Drawing::Font^ font3 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );
-
System::Drawing::Font^ font4 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );
-
e->Graphics->DrawString(tabControl1->TabPages[tabPage1->TabIndex]->Text, font1, TextBrush, tabTextArea1, sf);e->Graphics->DrawString(tabControl1->TabPages[tabPage2->TabIndex]->Text, font2, TextBrush, tabTextArea2, sf);e->Graphics->DrawString(tabControl1->TabPages[tabPage3->TabIndex]->Text, font3, TextBrush, tabTextArea3, sf);
-
e->Graphics->DrawString(tabControl1->TabPages[tabPage4->TabIndex]->Text, font4, TextBrush, tabTextArea4, sf);
-
}
-
-
if (tabControl1->SelectedTab==tabPage2)
-
{
-
System::Drawing::Font^ font1 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );// Defines Font face, size, style
-
System::Drawing::Font^ font2 = gcnew System::Drawing::Font( "Arial",12.13f, System::Drawing::FontStyle::Bold );// Defines Font face, size, style
-
System::Drawing::Font^ font3 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );
-
System::Drawing::Font^ font4 = gcnew System::Drawing::Font( "Arial",11.13f, System::Drawing::FontStyle::Regular );
-
e->Graphics->DrawString(tabControl1->TabPages[tabPage1->TabIndex]->Text, font1, TextBrush, tabTextArea1, sf);e->Graphics->DrawString(tabControl1->TabPages[tabPage2->TabIndex]->Text, font2, TextBrush, tabTextArea2, sf);
-
e->Graphics->DrawString(tabControl1->TabPages[tabPage3->TabIndex]->Text, font3, TextBrush, tabTextArea3, sf);
-
e->Graphics->DrawString(tabControl1->TabPages[tabPage4->TabIndex]->Text, font4, TextBrush, tabTextArea4, sf);
-
}
-
-
// Same for Tabpage3 and Tabpage4
-
As you can see there is no where that I am drawing a focus rectangle....but it definately shows up on each Tab Header
Thanks for your help.
Cheers
Soorali
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steve |
last post by:
VS2003 .NET with C#
I have a tree view on page 1 of a tabcontrol. When the user right clicks a
node they get a popup context menu which gives them 2 options. When they
select an option, it...
|
by: Matthias S. |
last post by:
Hi there,
I've got a page with two frames. The top frame hosts a menu, which is
simply a collection of text-links. Whenever a text-link in the top frame
gets selected, the bottom-frame is filled...
|
by: Arfan |
last post by:
hi,
By default i have set focus on one particular field when the page
loads. In one condition when the page loads i want to remove focus from
that field of the form. Is there any function in...
|
by: Stephen Bedford |
last post by:
I am developing an application that is primarily keyboard not mouse driven. Navigation is very difficult within some controls (list boxes, radio groups etc) unless the focus rectangle is visible. ...
|
by: Sandy |
last post by:
writing a data to open (.txt) notepad file in desktop from vc++... then small
rectangle are coming in the file "\n" is also not working
int iLength = (int)::SendMessage(hEdit, WM_GETTEXTLENGTH,...
| |
by: Jason |
last post by:
I am creating my own tab control in vb.net. I am inheriting
System.Windows.Forms.TabControl. I want to provide a property that
disables or enables the focus rectangle being drawn on the tabs....
|
by: Brian A. Cline |
last post by:
I have a SplitContainer that holds a TreeView and ListView. When using
the splitter to resize them, a focus rectangle is shown during and after
the resize event. Is there any way to prevent this? I...
|
by: neihc2 |
last post by:
Hi,
For some pages I'm styling, the focus rectangle around a link appears just fine in Firefox.
However, they are not appearing at all in IE.
I don't think there's anything in my css file that...
|
by: vsrprasad16 |
last post by:
Hi All,
I am implementing a notification form similar to outlook email notification.
my application call this notification form from a dll. this dll includes a form class and this dll has some...
|
by: john ciriello |
last post by:
I created a form and put a button and a label on it. I set the tabstops to
false. When I first run it I can click the button and there is no focus
rectangle. Which is what I want. However, if I...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
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,...
|
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
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...
| |