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 3698 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....bu t 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 builds page 3 of the tab control and changes the page to
this Page3. However the context menu remains popped up still over the top of
Page3 until you...
|
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 with the appropriate contents.
Unfortunately, after clicking the link, a focus-rectangle stays around the
selected text-link. Is there a way to get...
|
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 javascript that allows
to remove focus from field?
Regards,
Arfan
|
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. When an application starts the focus rectangle for a control is never visible and only becomes visible once the TAB key is pressed. After that...
|
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, 0, 0);
::SendMessage(hEdit, WM_GETTEXT, iLength+1, (LPARAM)textData);
CString temp = textData;
temp += "\n";
temp += "MFC";...
| |
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.
Setting the DrawMode to OwnerFixed and adding the drawing methods in
overrides OnDrawItem doesn't seem to do it. The focus rectangle is
drawn no...
|
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 have already tried
setting the SplitContainer's TabStop property to false but it had no
effect on the aforementioned behavior.
Thanks,
Brian...
|
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 gets rid of the focus rectangles:
a:link{
color: #3366CC;
}
|
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 object value to display the contents on form.
i am filling the form with the object before "form.show."
form has some timer to implement hide and...
|
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 press the tab key nothing
initially seems to happen, I know nothing should because I set the tabstop
to false, but to my surprise, when I then click...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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...
|
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...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
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...
| |