473,795 Members | 3,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# App: Question on .Net TabControl

2 New Member
Hi,
I am doing a small tool in .Net(C#). I have a TabControl in my application; I need to achieve two functionality in it as follows.

1. I have enabled drag-drop property for my tabcontrol, so what I want to achieve is when I drag an item and move over an tabpage name which is now currently not in front, has to come in front so that I can drop my item in that tabpage.

For example let’s say we have 2 tabpage named 'Tab1' and 'Tab2'. Right now Tab1 is in front so we can see only the items in Tab1 page. So now when I drag an item and move over Tab2 name I want to make Tab2 to come in front so that now I can see the items on Tab2 and drop items in that page.

2. My second functionality is to allow user to rename the tabpage name (Display text of tabpage). Is there any way to directly change the display text like file rename. Like some short-cut key F2 user should be able to change the text in the Tab control itself.

I can do it by popping up an dialog which takes the new display text and change the tabpage display text. Is there any better way to do this?


Thanks in Advance

Vignesh Anand
Dec 18 '07 #1
3 5509
Plater
7,872 Recognized Expert Expert
1)
Drag-drop has some events that get fired, not sure if there any that help you. Check on the TabPages themselves (and not just the tabcontrol) to see if you can find something that will fire when dragging over a Tab name.
(Hot tracking is able to happen because some event gets fired when you mouseover the name, so SOMETHING has got to fire for it)

2) You could attack a keypress handler to the TabPage (not the tab control, although you could probably make do with that as well)
And watch for the F2 key. I would have it pop up a special rename dialog. Then you can just set the tabpage.Text to it.
Trying to directly edit the text on the top of the tab would be pretty crazy to implement (it would be a lot of keypress watching and owner-draw stuff)
Dec 19 '07 #2
VigneshAnand
2 New Member
1)
Drag-drop has some events that get fired, not sure if there any that help you. Check on the TabPages themselves (and not just the tabcontrol) to see if you can find something that will fire when dragging over a Tab name.
(Hot tracking is able to happen because some event gets fired when you mouseover the name, so SOMETHING has got to fire for it)

2) You could attack a keypress handler to the TabPage (not the tab control, although you could probably make do with that as well)
And watch for the F2 key. I would have it pop up a special rename dialog. Then you can just set the tabpage.Text to it.
Trying to directly edit the text on the top of the tab would be pretty crazy to implement (it would be a lot of keypress watching and owner-draw stuff)

Thanks Plater,
As per your idea on the second issue for renaming the tabname, I launched a dialog which takes the new name and updated the tabpage name.

But for the first issue drag-drop, none of the mouse events are getting trigged if i am dragging an item.

When i move the mouse without dragging any item all the events are getting trigged like MouseEnter, MouseLeave, MouseHover.

I am not aware of "Hot tracking" if possible can you please provide me some useful links on the same.

Thanks
Vignesh Anand
Dec 20 '07 #3
Plater
7,872 Recognized Expert Expert
Hottracking is a property on the tab control that changes the color of the tab the mouse is over, probably not useful.

There are "DragEnter" and the like events that should get fired for your dragdrop stuff?
Dec 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
18511
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould custom control that inherit all information from TabPage, but how to access those properties, not supported by standart interface??? Thank you
2
2371
by: Patrick McGuire | last post by:
I want to place a tabControl with almost identical properties on several forms. I think the best way is to define a UserControl that inherits System.Windows.Forms.TabControl, and place all my controls on it. The problem is that I don't know how to bring up the graphical design interface for the TabControl. I suppose I COULD just design it as a UserControl and place a TabControl on it, but that seems a bit... inelegant (I'm going to...
9
3458
by: Michael Turner | last post by:
Hi Guys Having problem with the tab control, I need to set the background color to something different than the standard, I have found code on the web and now can redraw the tabpage buttons so the are set to the right color, I can obviously change the tabpage colour but I am left with a grey top edge(Where there are no buttons) when the background of the form is changed any ideas on what I can do? Mike.
5
3352
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in advance Zadkin
2
3355
by: Simon Verona | last post by:
I have a few hundred forms in my application. All are based on a custom base form class. I decided that I wanted to globally change the look and feel of many of the controls in my application - including the tab control. I did this by writing a component that I attached to the form. The component has a "Start" function which takes the form as a paramater. This cycles through all the controls on the form, changes some of the properties...
2
2781
by: Gav | last post by:
I am writing an application where I will have a TabControl and 3 styles of Tabs to go in it, each containing different controls. The tabs will be added to the tabcontrol when items are clicked on in a TreeView. So the the application starts by displaying no tabs and adds them in as required. There could be any number of each tab (0 upwards). What is the best way of me doing this? Should I create 3 custom controls that extend TabPage?...
1
3459
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all In a Visual Studio 2005 C# project, I have a simplest tabcontrol with two tabpages. When I set tab control's Alignment property to Right, tab texts (captions) disappear. Does anybody know how to fix this? I tried this on two computers, at work and at home, both with Windows XP with latest service packs, and Framework 2.0 and 3.0 with latest SP.
0
1421
by: bertie78 | last post by:
Hi all, New poster here! I'm having some difficulty updating a tabcontrol cross-threads. The general idea is : the main thread is the owner of the tab control and the form controls. However, due to the vast amount of data to populate listviews within the tabs, I have created a worker thread (an implementation of a BackgroundWorker) to form the data and populate a tabcontrol 'offline', so that it doesn't interfer with (i.e freeze) the UI. ...
1
1346
by: zubair1 | last post by:
Hello, I am in abit confusion here :( i have 2 tab controls on my app they work fine but when i choose LEFT for alignment The tabcontrol does align to left but the text it displays (ie.TabPage1) disappears from it. could some body tell me how i can get that text to appear again - if i make the alignment to TOP it comes back, but i want to align it LEFT. Any help is highly appreciated
0
9672
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10439
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10215
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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 we have to send another system
3
2920
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.