Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

refresh the title bar of a "sub window"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 31 Dec 2007 06:09 GMT
Happy New Year !

I have a rather trivial question, but it bugs me for a while.

Here is a bullet-wise description:

1.  My application has a "main form".  It has two buttons.

2.  The first button is an open button. By clicking it, I can open a
data file (e.g., file1.dat).

3.  The second button is a display button.  By clicking it, a new
window (let's call it "sub window") pops out.  It displays the
contents are file1.dat.  On the title bar of the "sub window", the
file name (file1.dat) is displayed.

4.  From the "sub window", I can switch back to the "main form" and
click its open button to open another data file, file2.dat.

5.  After this action, the file content displayed in the "sub window"
is automatically re-displayed.  This is done through a event handler
OnOpenAnotherFile

6.  But what annoys me is that the the title bar of the "sub window"
does not refresh to file2.dat.

I guess I need to add a line of code in the event handler
OnOpenAnotherFile to refresh the title bar.  But I do not know the
specific command.

Could anyone give me some hint?  BTW, I do NOT want to refresh the
titlebar by automatically close the "sub window" and re-open it.

Thank you very much.

Alex
Ciaran O'Donnell - 01 Jan 2008 02:47 GMT
subwindow.Text = "file 2";

The text property is whats displayed in the title bar.

HTH

Signature

Ciaran O'Donnell
There are 10 types of people in this world. Those that understand binary and
those that don't

> Happy New Year !
>
[quoted text clipped - 32 lines]
>
> Alex
guoruimin@gmail.com - 02 Jan 2008 02:45 GMT
I have done that.  But the title bar of the "sub window" does NOT
redraw automatically.  It is still "file 1".  If I close and re-open
the "sub window", "file 2" is shown in title bar

Any clue?

Thanks .................

> subwindow.Text = "file 2";
>
[quoted text clipped - 44 lines]
>
> > Alex
Scudder Consulting - 04 Jan 2008 01:16 GMT
> I have done that.  But the title bar of the "sub window" does NOT
> redraw automatically.  It is still "file 1".  If I close and re-open
> the "sub window", "file 2" is shown in title bar
>
> Any clue?

In the sub window class call this after changing the text.

this.Invalidate(rectangle);

The rectangle should contain the coords for the title bar only... you don't
want to redraw the whole form (or you may see some flicker).

R

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.