|
Already tried, doesn't work, because as soon as user actives the control below, parts of it come in front.
I changed the z-order by writing
this.Controls.SetChildIndex(myControl, 0);
Do you know any other way?
|
|
|
|
|
But does the control that's on top become obstructed by the control beneath it?
I've given it some though and I can't come up with a reason to do what you're doing. If you want to hide some controls based on conditions in the form, just hide 'em or disable 'em.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I doubt there will be a solution; anyway you probably didn't provide enough details here.
if the bottom control supports interaction, e.g. it is a TextBox and is enabled, then it not coming to the front would normally considered bad. So what is it that you want enabled and not topmost when activated?
|
|
|
|
|
It's a Panel on top of ScrollableControl. I have painted a custom "toolbar" on my form (it's just a drawing, not a control), and I want to add shadow to it. To achieve a look as if drawings in ScrollableControl are going under the toolbar-drawing, I need to separate the shadow into a control and put over it. The shadow-panel is 2 pixels high, has transparent background and has 2 black lines with different alpha value painted on it. Adding the shadow to the ScrollableControl instead of to the form doesn't work, because vertical scrollbar gets over the shadow (gets focused) and I'd also have to keep the shadow steady on scrolling (every control you put inside ScrollableControl will get scrolled).
It's the least important thing, but I always like to add some eye-candy to my applications.
|
|
|
|
|
I'm not an eye candy specialist, however if memory serves, the way to go is by having your regular Control in the back, and a special transparent panel on top of that. You paint whatever it takes on the panel, and teach it to sit in front visually, while being invisible to all mouse operations, so it clicks through. I did something similar once, long ago, however I don't remember every detail.
|
|
|
|
|
I know I'm asking a lot, but could you please try to write an example code how to keep a control in front visually and how to make it click-through-able?
Thanks in advance!
|
|
|
|
|
Sorry no, it was really long ago, and I don't want to go there again.
|
|
|
|
|
I hope you can give me at least a hint in the right direction... Was it win32-like code or just overriding some functions? I'm more interested in how to keep a panel visually in front at all times. Thanks for the help.
|
|
|
|
|
1. make sure the background control (ListBox, whatever) and the foreground control (Panel) both have the Form as their parent.
(If you were to use Visual Dersigner, and simply add the background control first, then a smaller foreground Control on top of it, it would be a child of the background, not of the form).
One way of doing that is: position it outside the background color, select it, goto properties, and type a new location value.
2. at run-time, never move the controls, never change their Z-order. Let them as they are.
3. in as much as the foreground control must be transparent (visually) and must ignore the mouse (click-through), do whatever that takes (Enabled=false; for starters).
|
|
|
|
|
hi,
in my MDI application suppose i have combo on one of my child form and now i want to populate that combo with all the form name whether any form is closed or opened.how can i do this by c# code. i search Google but found nothing. please help me with code.
thanks
tbhattacharjee
|
|
|
|
|
You'd need to use reflection to search through all the classes in your application, and check to see if it was a form or not. If it's a form, you can then retrieve the IsMdiContainer property and see if it's true or not - if it's true, then this is the MDI parent.
|
|
|
|
|
Hi there
i want to install some fonts; when i detect it is deleted. my code works fine on XP. but in win7 it is deleted immediately. i think it is beacause of UAC and use fileiopermission and demand with no lock. even i use right click run as administrator. so any suggestion is appreciated. sorry for my English.
Best wishes
|
|
|
|
|
The modern way of thinking is a single app should not be allowed to perform actions that (could) have effects on other apps, so Vista/Windows7 will not allow you to add or remove fonts. If you must, the UAC will kick in.
If you need the extra font(s) inside your app only, there probably is a solution based on System.Drawing.Text.PrivateFontCollection class. You'll have to Google for details and examples. And I expect it may not work for printing, I don't really know.
|
|
|
|
|
hi Luc,
thanks for your answer. but we use PrivateFontCollection before and it has several performance issues.
Best regards
|
|
|
|
|
Hi guys,
I have a Table (TableTest ) in a Database (database1 ) in SQLExpress 2008.
I wanna to call a method in C# whenever something is inserted in the Table.
Could you please guide me?
It would be great if you post a sample code.
Thanks.
|
|
|
|
|
I normally use a SqlNotification to accomplish this. Take a look here[^].
|
|
|
|
|
I am building a WEBSERVICE that will listen for PUSH NOTIFICATION from MS Exchange. What I was hoping to do is use the Query Notifications capability too be notified of changes to to specific data in SQL Server.
1. How specific are the SqlNotificationEventArgs that are raised to the dependency?
2. Could/Would it tell me anything specific about the event that triggered the notification? Insert/Update/delete and the primary key of the item?
Thanks
|
|
|
|
|
Hi To All,
Please help me to solve my problem.
I am A Window Application developer. I am Developing a Attendance Calculation Software. I have InTime And OutTime of Employee's. Every Thing is Working fine. The Only thing That I Cannot Calculate is OT i.e. OverTime of Employee.
I am not getting The exact Result. I have shift time like 9:00 AM To 6:00 PM.
I am Unable to calculate the OT if Employees Shift Ends On Next Day. For Example :
If Shift End Time Is 6:00 PM And Employee Shift Ends At 12:00 AM Or After 12:00 AM Then It Gives Me Incorrect Answer.
I am Unable to Resolve This Problem. Please Help Me.
Thanks & Regards
Sanket Patil.
.
|
|
|
|
|
Too easy. Look at the DateTime and TimeSpan classes. Use something like
DateTime start = new DateTime(... ... ...);
DateTime finish = new DateTime(... ... ...);
TimeSpan worked = finish - start;
then pull worked apart as you need.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Hi Perter_in_2780,
Thanks for Your Reply. But Still I am getting Incorrect Result. I have only Time. When I convert the Out Time in datetime Then Both the Time that is employees out time and shift out time has default date as todays date and if the Emd Time Of Employee is 12:00 AM and Shift Out Time ois 6:00 PM Then Iam Getting the Result is 17.00 in TimeSpan.
Which I dont want. I want Result as 6:00. Iam unable to calculate time difference in case when time is from PM to AM.
Thanks & Regards
Sanket Patil
.
|
|
|
|
|
You need to include at least part of the date in start and end DateTime's. The dates can be "made up", like this:
DateTime start = new DateTime(2000, 1, 1, 18, 0, 0);
DateTime finish = new DateTime(2000, 1, 2, 9, 0, 0);
TimeSpan worked = finish - start;
... That should come out at 15 hours.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Check this[^] out.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi Abhinav s,
Thanks for your reply But I am Not Getting The Solution if its night shift.
Thanks And Regards
Sanket Patil
.
|
|
|
|
|
For the night shift split the calc in 2 start to 24:00, 00:00 to finish. Decide which calc to use based on the start time or if the end time is less than the start time. Os as others have suggested add the date to the start/end variables.
Bloody hell this is simple stuff, try thinking.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
This is exactly why you store start and end date and not just time.
If you stored:
start date = 2010-09-12 20:00:00
end date = 2010-09-13 07:00:00
then you would have no problem.
Go back and fix your model/database before you continue with incorrect data storage.
|
|
|
|