473,671 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Main from should redraw another

5 New Member
Hi Guys!

I stuck in this problem quiet awhile. I have a MainForm in my application. It contains a second one as a member. If both a visible I have a problem to redraw the second one.
eg: MainForm and SecondForm is open and I move another window over the SecondForm. After that I click on the MainForm it will get the Focus and it will be redrawn. But the SecondForm stays behind.

I tried the following:
Using the OnActivation or OnEnter of my MainForm to redraw my Second doesn't work. (I got a appropriate result but my MainForm lost the focus and that should be the case)
I tried to paint the SecondForm in OnPaint of MainForm but that doesn't work either.

What is the right solution for this problem. Two Threads? an Mdi solution?

greetings Stefan
Mar 9 '08 #1
8 1191
maheshmrk22
23 New Member
Hi,

As if you will be able to put some code then it will be easier to understand the fact. But as you mentioned above i think, MDI one will be better option and under that you would be able to set properties of child form.

Thanks
Mahesh






Hi Guys!

I stuck in this problem quiet awhile. I have a MainForm in my application. It contains a second one as a member. If both a visible I have a problem to redraw the second one.
eg: MainForm and SecondForm is open and I move another window over the SecondForm. After that I click on the MainForm it will get the Focus and it will be redrawn. But the SecondForm stays behind.

I tried the following:
Using the OnActivation or OnEnter of my MainForm to redraw my Second doesn't work. (I got a appropriate result but my MainForm lost the focus and that should be the case)
I tried to paint the SecondForm in OnPaint of MainForm but that doesn't work either.

What is the right solution for this problem. Two Threads? an Mdi solution?

greetings Stefan
Mar 10 '08 #2
Spockman
5 New Member
Hi Mahesh!

It's quite a simple problem. I want to create my own Media Player. And my MainForm is the Player itself and the Second form is my playlist.

If I use the Mdi version should be the player the parent and the playlist the child or should I create a container mdi form for both?

Posting the code needs a little bit of time because I have my stuff at home

greetings
Stefan
Mar 10 '08 #3
Plater
7,872 Recognized Expert Expert
The forms (as well as all other controls) have an .Update() function that causes them to redraw themselves.
Have you tried that?
Mar 10 '08 #4
Spockman
5 New Member
Yes I tried that.

Expand|Select|Wrap|Line Numbers
  1. private void MainForm_Activated(object sender, System.EventArgs e)
  2. {
  3. playlist.Update();
  4. }
  5.  
but that won't work.
Mar 10 '08 #5
Plater
7,872 Recognized Expert Expert
Well what do you mean by "won't work".
Are you sure you are calling it at the correct times?

Seems like you should be using the Enter event if you want it to fire everytime the form becomes selected?
Mar 10 '08 #6
Spockman
5 New Member
So I implement the Mdi way, but there are some new problems now.

Is it possible to to make the mdi form invisible and show only the child forms?

And the second problem is that my Player form has a menu and it will appear in mdi form but it should stay at the child form

It won't work was that if both forms are open and I move eg a editor window over the second form and I activate the main form the main form is fully visible but the second one is hidden behind the editor window

regards Stefan
Mar 10 '08 #7
Plater
7,872 Recognized Expert Expert
Ahh ok, so it's a focus issue.
Yeah, the MDI way should work for you.
Mar 11 '08 #8
Spockman
5 New Member
I found the best and easiest solution for my problem!

I have to set the owner of second form and than all problems are fixed

But thanks for your help

greetings Stefan
Mar 11 '08 #9

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

Similar topics

10
11697
by: Peter | last post by:
I want to draw some lines on a widget. This works ok, but when I want to redraw, the old lines are still there. How do I clear or refresh the widget, so I can draw a new set of lines? Code snip below. TIA Peter
0
1294
by: PHH | last post by:
Help me, please, When I redraw a ListviewItem in Listview (redraw items with icon and text columms). I used SetStyle(ControlStyle.UserPaint, true) function. And I redraw finish and run program, when I run program I choose first line (line with index = 0) but this line is not actived (draw border over that), after I click to another control (ex: other Listview, button ...) then this line is redrew border around. Only first line (first...
0
1902
by: WHITETIGER | last post by:
Help me, please, When I redraw a ListviewItem in Listview (redraw items with icon and text columms). I used SetStyle(ControlStyle.UserPaint, true) function. And I redraw finish and run program, when I run program I choose first line (line with index = 0) but this line is not actived (draw border over that), after I click to another control (ex: other Listview, button ...) then this line is redrew border around. Only first line (first...
45
3595
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes themselves are an exception to this), and 'bootstrap' your program by instantiating a single application object in main(), would that place any limitations on what you could accomplish with your program? Are there any benefits to doing things that...
2
3485
by: ch424 | last post by:
Hi, Does anybody know the fastest way to trigger a DrawingArea redaw in pygtk? At the moment, I'm using a bit of a hack: def redraw(self): self.area.hide() self.area.show() Is there a better way to trigger a redraw? This causes flickering when
5
11071
by: CroDude | last post by:
Hi all! I've made a simple control derived from a panel class which draws gradient in a overrided OnPaintBackground event. Well, I know that I need to redraw control when it's resized by overriding OnResize event, but how would I know when to redraw if, let's say, user drags some form over it or some other action that messes display of this control. I'm stuck here ... what to do?
0
2585
by: Dean Earley | last post by:
Hi all. I have just added translucency to one of my applications using the layered windows API, but I have come across a redraw problem. Unfortunately, I cant reproduce this in a standalone app but I'll try and explain what's happening. When a form is obscured when it is resized or made "visible" (I show some other forms on restore), it seems to remember that visibility
2
13066
by: diogoko | last post by:
I have some code like: try { someButton.disabled = true; cpuIntensiveCode(); } finally { someButton.disabled = false; } The problem is that someButton is never disabled, because the browser
2
3982
by: dmitrey | last post by:
Hi all, here is a question already mentioned below, and I'm also interested in that one very much. unfortunatly, I can't write anything to matplotlib mailing lists because I constantly get server internal error (500) Does anyone knows the answer? (howto redraw figure automatically (for example update from time to time in cycle), without stop in show()/draw()?) Thx in advance, D.
0
8472
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
8819
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
8596
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
7428
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...
1
6222
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
5690
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
4221
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...
1
2806
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
2
1801
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.