|
Sorry for the mistake. I fixed my message though. I will look for it, if I find something I'll let you know.
But, can you give me a hint why you want it in a preprocessor directive rather than ordinary if statement?
|
|
|
|
|
I'm trying to use System.Drawing.BufferedGraphics, which is only available on .NET 2.0. I could use System.Drawing.Bitmap instead, but it's slightly less performant.
Also, some of the form mouse events are slightly different between the two versions.
I want to avoid having two copies of the code if I can, so I want to use the preprocessor to distinguish between the two.
There's one variable, VC_V7 that's used in an example in the C# documentation on MSDN, but that's only for Visual Studio (I think... I'm not sure why it'd be VC_V7).
Thanks for helping
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/0feaad6z.aspx[^]
The C# compiler itself defines no symbols or macros that you can use in your source code; all symbol definitions must be user-defined.
That's why there's no documentation
Guess I'll have to find some ways to work around it.
Thanks though.
|
|
|
|
|
Hi. I have a winform (with fade-in and fade-out effect) and I run it on VS 2003 and works great. But when I use VS 2005, the winform appears like with flicks, it's like it had a rendering problem. The example works great with VS 2003, but I have to run in in VS 2005.
Any ideas??
Thanks a lot !!!
|
|
|
|
|
Try this in the form's constructor:
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
If that doesn't work, try playing around with the other ControlStyles things.
That might fix it.
|
|
|
|
|
I still have the problem.
Any other ideas ??
Thanks a lot !!!!
|
|
|
|
|
Hmm... try turning off the Application.EnableStyles thing in the Main() method, if it's there.
|
|
|
|
|
Reinux, I can't see the option you're reffering , only one: Application.EnableVisualStyles(); but it isn't take any parameters.
Thanks a lot !!!
|
|
|
|
|
Try taking the whole line out.
It's sorta optional.
|
|
|
|
|
|
I'm out of ideas
|
|
|
|
|
I found the problem ...
See this link:
http://www.dotnet247.com/247reference/msgs/42/214827.aspx
Yes, that is what I found. I hadn't seen the flickering before because my
form was too small.
However, this is true. The flickering occures when the underlaying window is
switched to "layered mode". Actually it flickers even if you set alpha to
255 (fully opaque).
Switching to layered mode involves three steps.
1. Checking the os version - it has to be NT 5 or latter
2. Set WS_EX_LAYERED window style
3. SetWindowLayeredAttributes this method is not defined in user32.dll for
versions before Win2k that's why first step is necessary.
When a Windows Forms control is created it is not a layered window. And it
switches to this mode when set the opacity to some value less then 1.
So my solution is to switch to layered mode in some early stage of the form
life. As soon as the form is created before to become visible. Otherwise
we'll see the flickering.
Javier is completely correct that the layered window has to be fully
redrawn. But it goes only when the window (form) resizes. You can still
invalidate some portions of the form and it will works how ot supposed to
work.
Layered window could even show better performance in some situations.
How internaly layered windows work is all painting is redirected to
off-screen buffer and when the painting's done alpha blending is applied to
the resulting picture and the result is drawn on the screen. This of course
is done internaly in windows and it uses the video card hardware support for
alpha blending if it has any.
Becuse all winodw is double buffered Windows doesn't send WM_PAINT when the
form is moved for example or when some part of the form is uncovered. In
such cases Windows uses double buffered image.
When children control is moved on the form it updates as much as it is
necessary. So the performance hit is not so big.
Anyway, my first solution that I was planning to post involved P\Invoke and
calling all API functions necessary to switch to "layered mode", but then I
found that if one set Opacity to value less then 1 and then return it back
to 1 the form class doesn't switch to the "normal mode" and leave the window
layered.
So the easiest way to get rid if this flickering is by overriding
OnControlCreated method and adding the following two lines:
this.Opacity = 0.9;
this.Opacity = 1;
No more flickering .
Thanks a lot people !!!
|
|
|
|
|
So you figured it out
Wow that's weird.
|
|
|
|
|
Try checking the DoubleBuffered property in your form and in the ControlStyles to true.
|
|
|
|
|
I have a single-selection listview, configured to view details.
It has 4 columns.
When I left-click on one of the items (left-most column), the
SelectedIndexChanged Event fires, as expected. The first time
I left-click (after the form loads), the SelectedItems.Count is 1.
For subsequent left-clicks the Event fires two times: the first time, the
SelectedItems.Count is zero; the 2nd time the count is 1.
Why is the event firing 2 times?
Thanks,
Don
|
|
|
|
|
I haven't used ListView in a long time, but my guess is that it's technically deselecting the selected item first so that it can fire the deselected event as well.
Given you don't want to take any action when nothing is selected, you could get around it by just saying this at the beginning of the method:
if(SelectedItems.Count == 0)
return;
Try to figure out the exact cause too though. It's always a good idea to know what caused a problem in the first place if you're using a workaround.
|
|
|
|
|
Hi i want to bring my form in front of all the windows those r opened b4 it but not in front of the windows wich r opened after thisssss
any sugessionsss
looking forward for help
Regards,
|
|
|
|
|
I'm not sure there's a way to do ittttt
You could try setting TopMost to true and then disabling it right awayyyyyy, but that probably won't make it stay in front of the other topmost onessssssss
|
|
|
|
|
how can i change this property through coding coz it is not visible there suppose if the name of the form is form1 then form1.TopMost is not available so how can i change it ??
looking forward for help
Regards,
|
|
|
|
|
Really? It shows up fine on my machine. I'm on VS2005.
Try doing it in the designer and then dissecting InitializeComponents().
|
|
|
|
|
reinux wrote: dissecting InitializeComponents().
well wot does this mean i cudn't understand plzz explain a little
|
|
|
|
|
When you design a form, all of the code for the code gets put in the InitializeComponents() method that gets called by the constructor.
Just read through that and see if you can find out how it's setting TopMost, and copy that line of code.
|
|
|
|
|
thxx sir, its done by this.TopMost
do i ve also done the same
|
|
|
|
|
hi,
I have a datagrid in windows applicaiton ..I have a data table in database whicha have around 5 columns..& now i want to show 3 columns only from that table to this datagrid..
I have been working in wwebapplicaiton. Its easy in webs application to do this. but i m confused how to do this in windows datagrid form..
In otherwords i must say that is there any way to handle the datagrid as we do in webapplication..
Any one can help me....
-- modified at 16:33 Tuesday 16th May, 2006
|
|
|
|
|