|
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
|
|
|
|
|
|
One way would be to populate the DataTable with only the 3 columns you want from the database and then set the datasource property to it. i.e. Use a SQL query to retreive from the database only the information you want to fill the datatable with.
|
|
|
|
|
Hi.
What is pdb files ?
Best wishes
|
|
|
|
|
From MSDN
program database (.pdb) file
A file used to store symbolic information about the compiled application.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
hello everybody in this forum.
i need to ask one question.
i had implemented multicast chat room to connect to multicast enabled ip address and on a specific port.
that's ok......
actually all users will be connected to that chat room who will connect to that ip address with that port pair.
but what if i wanted to create multiple chat rooms .
does that mean i will use multiple ip addresses and multiple ports for creating multiple chat rooms or it is only one ip address and port pair that i will relay on but with additional coding ?????
Human knowledge belongs to the world.
Human knowledge belongs to the world.
|
|
|
|
|
Hello snouto.
Any network program generally falls into two main categories. Either it's client/server app where all clients connect to one server, or it's a peer-to-peer where all apps act as aclient & a server in the same time.
So, whether your program is from the first type or the second (usually chatting programs are from the first type, but you can make p2p chatting program), you use one IP to listen to, but you may liten on different ports using multiple "TCPListener"s for each port. So there will be a listener for each port and each room will have a name and a port. This way Your server may have multiple chatting rooms (each on a different port), and you may add more rooms (or remove) at run time.
If this isn't what you were looking for, or you need more clarification, just ask.
Happy programming.
|
|
|
|
|
I am trying to process some work in the back ground so my UI is not locked up. This is what I have currently:
private void btnPHourly_Click(object sender, EventArgs e)
<code>{
string tempDestination = FileCopier.Properties.Settings.Default.PHourlyPath.ToString();
string tempRemoveable = FileCopier.Properties.Settings.Default.RemoveableDiskPath.ToString();
ValidatePaths(ref tempDestination, ref tempRemoveable);
DisableButtons();
CopyFiles cf = new CopyFiles(tempDestination, tempRemoveable, ExtensionFlag);
EnableButtons();
}</code>
I want to CopyFiles cf = new CopyFiles(tempDestination, tempRemoveable, ExtensionFlag); process to work in the background. How can I implement the BackGroundWorker in this scenerio?
Since I cant pass parameters (such as tempDestination etc) to bgworker I am not sure how I can acomplish this. Can someone up here help me with this issue? Thanks in advance.
|
|
|
|
|
What is "bgworker" and why can't you pass it a string?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Well you can pass parameters. The RunWorkerAsync can take an object parameter which will be transferred to the event arguments of the DoWork event callback. You could argue that it is only one parameter and that you need several ones but this is not really a restriction because you can stuff anything you like into that parameter like an ArrayList filled with values, a Hashtable or plain an object array.
using (BackgroundWorker bw = new BackgroundWorker()) {
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerAsync(new object[] { tempDestination, tempRemoveable, ExtensionFlag});
bw.DoWork -= new DoWorkEventHandler(bw_DoWork);
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
object[] o = (object[])e.Argument
CopyFiles cf = new CopyFiles((string)o[0], (string)o[1], (string)o[2]);
}
Not tested but should work
|
|
|
|
|
hi
i'm making a form in VS.Net .When i debug the code,i want my textbox come with grids.
But i dont know how i drawing grids to the textbox and show it when the form run.That is in one way,i want to use InitializeComponent() method.
how can i do it
thanks
|
|
|
|
|
You cannot use grid in textbox. Use DataGrid instead.
It is simple to use datagrid. Just put datagrid in your
form. Then fill datagrid using datatable.
e.g. :
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("X", typeof(int));
dataTable.Columns.Add(new DataColumn("Y", typeof(int));
for(int i = 0; i < 10; i++)
{
DataRow dataRow = dataTable.NewRow();
dataRow["X"] = i;
dataRow["Y"] = i;
dataTable.Rows.Add(dataRow);
}
this.dataGrid1.DataSource = dataTable; Now you can see a table with X and Y column, fill with number 0 until 10.
|
|
|
|