|
Anyway, got it!
Thx for your help!
|
|
|
|
|
Thx for your help - am going to try it tomorrow.
|
|
|
|
|
This is my first post on this forum, and I am also new to C#.
I am trying to adapt my GDImage Win32.dll to managed code,
so far I have already translated my first graphic demo ZoomPlus,
and I am translating another one named AeroGlass.
AeroGlass, allows the user to move transparent alphablended sprites, with either the mouse or keyboard.
The mouse works just fine, however I have troubles with the keyboard focus using arrow keys.
It looks like the last button of my .NET form keeps the focus on itself,
even if my Win32.dll control uses SetFocus to gain the keyboard focus.
Do you have any suggestion on how to solve this problem ?
and remember I am new to C#, thus still learning...
Patrice Terrier
www.zapsolution.com
|
|
|
|
|
Hello
What I understood from your question is that you want to use an extended way to move your form using the keyboard but you are facing a problem that one of the form's controls -say a button- is having the input focues?
There is an event called Form.KeyPreview which is present in .Net 2.0 framework. You can use it to catch keyboard events in your form before theyu are sent to the controls and move your form according to the key pressed, but first there is a property named Form.KeyPreview also that you must set to true.
I hope that was what you are looking for.
Regards
|
|
|
|
|
Nader--
Thank you for your answer, what I want to do is not to move my form
or any control inside of it.
What I want to do is to move sprites like in game, using the arrow keys.
Thus when I put the focus on the graphic control it must keep it,
even if I am using the direction keys.
If I hold down CTRL+arrow + (up, down, left, rigth)
then I can move the sprites, and also when holding down SHIFT+CTRL.
But holding down a direction key, with or without SHIFT, doesn't work.
This is related to the fact that the form also uses the arrow keys
to navigate between the .NET child controls of the form.
In Win32 it is often the result of using a call to IsDialogMessage
in the WinMain message pump.
Being new to C# I have no idea of what .NET realy does under the hood
in its message pump that would cause this havoc.
|
|
|
|
|
zapsolution wrote: Thus when I put the focus on the graphic control it must keep it
Actually to make your control able to recieve focus -supposing it's inherited from the Control class-, you must call SetStyle(ControlStyles.Selectable, true) first. Otherwise it won't even recieve focus no matter how many Focus() calls or any other calls you make.
zapsolution wrote: This is related to the fact that the form also uses the arrow keys
to navigate between the .NET child controls of the form.
If you want to make the direction keys move the spirit even if the buttons have the focus, you can implement the solution I provided in my previous post, yet note that if the user presses Enter or Spacebar the button which has the focus will be pressed.
zapsolution wrote: Being new to C# I have no idea of what .NET realy does under the hood
in its message pump that would cause this havoc.
I don't see much of a havoc here. The message pump in .Net forms is very much similar to Win32, in fact you can send Win32 messages to .Net forms normally!! Also you can implement IMessageFilter interface to filter messages of your form before being processed, but I don't think that would do you much help. What you really need is to set the focus to the graphics control. Try the SetStyle() method in your control's constructor as it's a protected method.
Regards
|
|
|
|
|
Perhaps my problem is that the graphic control itself, is not created by the .NET machinery, but inside of the Win32.dll (using the low level CreateWindowEx API).
Then the problem is how to use SetStyle(ControlStyles.Selectable, true)
with a control that is not created in a .NET class ?
|
|
|
|
|
I'm trying to create a custom DataGridColumStyle object that has a color dialog attached. When the user clicks the cell the color dialog is displayed and a new color can be selected and then displayed in the cell.
The problem is... I just don't have a clue where to start.
I've previously created a custom column that uses an enum to populate a combo box so I thought it wouldn't be a problem but I was wrong
Can anyone help?
|
|
|
|
|
Place code like
MyColorDialog dialog = new MyColorDialog();
dialog.ShowDialog() in DataGridColumnStyle.Edit method
|
|
|
|
|
i want to record sound , help me please !!!!!
|
|
|
|
|
|
I found this example in MSDN and download it , but it doesnt work ,it was because of wavein /waveout class .i couldnt get that how to work .
but you show me a complete solution of that .
Thanks
But
please dont judge when you dont know anything about me ,
"i searched Record Sound C#" and nothing suitable result!!!
|
|
|
|
|
Hi all,
Iam working on a windows application where we have to do backgorund operation(Communication check with hardware) and have to update the GUI Status icon(if Commn. passed- Green color, failed-Red color). Initially i used the windows timer to do the background commn check but this was sometime hanging the GUI. so i changed this into a system timer operation but this introduces the thread safe problems since i have to update the GUI thread's status icon on the system timer's thread. is there any way to do this. is there any spl class available on .net for doing background operation. without affecting GUI.
Thanks
Srini
|
|
|
|
|
Keep using the System.Timers.Timer and use Invoke or BeginInvoke to update your GUI. This article[^] probably helps you in doing so.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i have tried to use invoke in timer thread. but some times i get a exception Object disposed or windows handle has not been created. but this background worker components sove the issue.
Thanks
|
|
|
|
|
how bout you try running your process on another thread? try using the BackgroundWorker.
|
|
|
|
|
|
Hi,
Is there a Multiview control like in ASP.NET 2.0 (or like TNotebook component in Delphi), that can be used in a C# Windows Forms application? I didn't found such a component among the standard components shipped with VS 2005.
I need to change the displayed controls within a dialog, upon an event, but without tabs for each view (like in tab control).
Can anyone post some info on how can that be achieved in C# Windows Forms App?
Best Regards,
Yas
|
|
|
|
|
The easiest way is to create custom controls that each represent a possible view, expose delegates for events you want in your main form, and then show/hide those controls to get your views in the one form
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
Thank you for your answer!
I have one more question: Is it possible to use the tab control but with hidden tab buttons and if yes, how can I hide the tab buttons?
Best Regards,
Yas
|
|
|
|
|
I doubt it. You could perhaps create an owner drawn tab control that draws no tabs.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
try
{
cn=new SqlConnection("server=.;database=Stock_Accounting; integrated security=true");
cm_combo=new SqlCommand();
cm_combo.CommandText="select * from Cust_Info";
cm_combo.Connection=cn;
cn.Open();
SqlDataReader dr_combo=cm_combo.ExecuteReader();
comempnam.DataSource=dr_combo;
comempnam.DisplayMember="Cust_Name";
comempnam.ValueMember="Cust_ID";
dr_combo.Close();
cn.Close();
}
catch(Exception ee)
{
MessageBox.Show(ee.ToString());
}
it gives me an error " comblix databinding accepts as a datasource either an Ilist or an Ilistsource"
pleaze help me
MD_NADA
|
|
|
|
|
You need to data the data from the SqlDataReader and put it into a collection that implements either the IList or IListSource interface such as Dataset or Datatable.
|
|
|
|
|
use these instead of data reader
SqlDataAdapter da = new SqlDataAdapter(cm_combo);
DataTable dt = new DataTable("Table");
da.Fill(dt);
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "au_lname";
comboBox1.ValueMember = "au_id";
|
|
|
|
|
better still, just after you execute your data reader, insert a do while loop to iterate all rows read (i.e:
if(dr_combo.HasRows())
{
do
{
comempnam.Add(dr_combo["Cust_Name"]);
// or if you choose to display the Cust_ID then:
//comempnam.Add(dr_combo["Cust_ID"]);
}
while (dr_combo.Read());
}
cn.close();
hopefully, this should work.
'Tilewa
-- modified at 12:38 Sunday 24th September, 2006
|
|
|
|