473,602 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

focus woes while making a caption control for splitcontainer!

hi ,

I made a simple little caption control , i want to put it in a split
container so it looks a litte like the VS windows.

Problem is , i cant get it to the correct Inactive/Active colour!

Apparently , the splitcontainerP anel ContainsFocus even after it has
lost focus , atleast thats what you'd think after you run the code!

Thanks so much

Gideon

heres *part* of the code:
public class Caption : UserControl
{
public Caption()
{
InitializeCompo nent();
this.Dock = DockStyle.Top;
this.BackColor = SystemColors.Gr adientInactiveC aption;
}
private Label lblCaption;//i use this for the caption text
private Label lblMinimize;//this is for the minimize button
//events
private readonly object MininizeClicked EventLock = new
object();
private EventHandler MininizeClicked Event;

protected override void OnLoad(EventArg s e)
{
Parent.GotFocus += new EventHandler(Pa rent_GotFocus);
Parent.LostFocu s += new EventHandler(Pa rent_LostFocus) ;
base.OnLoad(e);
}
protected override void OnClick(EventAr gs e)
{
Parent.Focus();
base.OnClick(e) ;
}
private void Parent_LostFocu s(object sender, EventArgs e)
{
if (!Parent.Contai nsFocus)
{
this.BackColor = SystemColors.Gr adientInactiveC aption;
}
}
private void Parent_GotFocus (object sender, EventArgs e)
{
this.BackColor = SystemColors.Gr adientActiveCap tion;
}
private void lblCaption_Clic k(object sender, EventArgs e)
{
OnClick(EventAr gs.Empty);
}
}

Jun 2 '07 #1
1 1815
Nevermind , i got the answer. Seems i had to attach the GotFocus/
LostFocus handlers to all the panels child controls

Gideon

Jun 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3077
by: J.S. | last post by:
I have a TreeView control in the left panel of a SplitContainer. When I click on various nodes in the TreeView I would like different sets of buttons and textboxes to appear in the right panel. Is this doable? Also, it seems that the TreeView nodes do not have a click event. Is that correct? Thanks, J.S.
0
1539
by: LCAdeveloper | last post by:
Another newbie question I'm afraid. When I use the .Focus() or .Select() methods to set the initial control that has focus on a form, try as I might I cannot get the control to visually indicate that it has the focus (e.g. a dotted outline around the caption of a RadioButton). The visible and enabled properties are set to true, and I know that the desired control has the focus (in this case one of two or more RadioButtons located in a...
4
6432
by: Tom | last post by:
Another question relating to focus: Is it possible to set the focus to another program's window and send it keystrokes, YET still keep my VB program in the foreground (i.e. showing on the screen)? For instance, I want to monitor another program's window and send keytstrokes to it, yet I want my VB.NET program to remain in the foreground, where I will show progress indicators. Is this even possible in .NET? I believe it was in VB6 (cause...
2
6450
by: Trammel | last post by:
Hi. I have been trying to make a simple application that will sit in the background and alert me of any changes in window focus (IE: Pop-up windows) on my system. I have used DirectTextToSpeech from Microsoft and tried the following code... The problem I am having is that it detects its own caption fine... but no captions of other windows :¬/ Could someone please have a look at the following code and lemme know what
11
3216
by: Dave | last post by:
Access 2003 I have a main form with two tab forms, one showing Client, and the other Spouse info, each with Address tabs. When I click on the Client address tab, I would like to have the Spouses address tab show as well. Although the above is the primary issue to resolve, it would also be handy to go a step further...each Address tab has a sub-form with two tabs; Civic Address, and Mailing Address. Being able to click on the Clients...
0
1778
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 Cline
0
1706
by: =?Utf-8?B?TmVpbGc=?= | last post by:
I have a SplitContainer in which I have TextBox filled on one side and a RichTextBox on the other. I just noticed when I do a text select in either textbox, the controls don't respond to Control C for a copy. Has anyone seen this behavior when using a Splitcontainer and textboxes? I have been captured the keydown event for the textboxes but
8
1899
by: Nivetha | last post by:
I have requirement like the first page contains LoginName and CompanyName after typing the value clicking Submit button so i am giving in body onload="document.forgotPassword.loginName.focus(); document.forgotPassword.securityAnswer.focus();" bcoz after giving correct value by clicking submit button it is going to the same page with some otherfields like Login Name Coompany Id Security Question Security Answer here i need to focus my...
5
4736
by: kulabhishek | last post by:
Hello, I have developed one user control using SplitContainer. It is simply like two textboxes connected to each other with splitter in between them. Whenever I increase width of the control 1. By dragging it with right edge, I want the splitter and the left textbox to remain fixed and 2. By dragging it with left edge, I want the splitter and the right textbox to remain fixed. We can set only one of the panels as FixedPanel.
0
7993
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
7920
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
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
8404
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
8054
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,...
1
5867
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1254
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.