473,472 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create 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 1182
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
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...
0
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...
0
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...
45
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...
2
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...
5
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...
0
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...
2
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
1
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...
0
tracyyun
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...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.