|
Hi, I have a server/client application. I want to block the clients' desktops to prevent pc usage. I also want to show a picture on the screen. Currently, I show a form covering the whole screen with topmost property set to true but it doesn't help much. Is there a better way to achieve that? Thanks!
|
|
|
|
|
Are you familiar with "kiosk mode"? if not, ask Google.
|
|
|
|
|
Hi Luc, Regarding to google results, some uses shell and some use win forms just like I do to implement kiosk. Is this what you mean or there is a speacial implementation for kiosk mode. Sorry to bother you
|
|
|
|
|
all I know is it is called kiosk mode, there are some CP articles on it, and Google knows everything.
|
|
|
|
|
|
Thanks, the reference helped a lot
|
|
|
|
|
So the DataBindingComplete event tells me when the data binding for a control is finished but is there a way to check at any point whether or not the data binding for a control is finished? (ie not event driven)
What I'm trying to achieve is this:
I have two DataGridView controls on a form bound to different data sources and I have some code that I'd like to execute when either of their data binding operations are finished. So far so good, I write an event handler which consumes both of their DataBindingComplete events.
The problem is I also have some code which I want executed only once both of the controls are done with their data binding. I don't know for which control the event handler will fire first so it would have been convenient if I could do something like:
if (dataGridView1.isDataBindingComplete && dataGridView2.isDataBindingComplete)
{
}
I suppose I could maintain a global boolean or something but I'm sure there must be a more elegant way. Any ideas?
|
|
|
|
|
Since the DataBindingComplete event hands you the sender parameter containing the DataGridView which has completed binding, and the EventArgs which tells you the reason, why not just use the Tag property?
Set it to true when it binds and check if both tags are true at the end of the event handler.
Simple, and elegant.
[edit]I can't spell for toffee this morning![/edit]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
Hi,
I would like to know that how to get the list of methods in OCX and how to invoke the particular method with the input parameters in run time?
|
|
|
|
|
You need to have a look at COM interop - see here[^].
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.
|
|
|
|
|
When you add an ocx to your project, it appears as a reference. You can have a look into all the methods of the ocx using the object browser of visual studio.
|
|
|
|
|
Hi all,
Create a ListView and an ImageList to go with it. Set the following:
Set the ImageList.ImageSize to 250 x 250 in the editor and then add some images - it'll automatically scale them up if you use small images but, for this test, that won't matter at all.
Create a textBox somewhere for the feedback string you're about to get.
Define the ListView as:
ListView1.View=LargeIcon;
ListView1.LargeImageList = ImageList1;
Now create some items for the collection - three is plenty for now - only top level items and don't add any text; you want to show a row of thumbnails to the user, no text or sub-children.
Now, put the following code behind the MouseMove event for the ListView:
Point cp = ListView1.PointToClient (new Point(e.X, e.Y));
ListViewItem TheNode = ListView1.GetItemAt(cp.X, cp.Y);
if (TheNode == null)
{
textBox1.Text = "nothing";
return;
}
textBox1.Text = "item " + TheNode.Index.ToString() + " selected";
My ListView is 1000 wide and not that high (300) so I should get all three items in a horizontal row - and I do - but when I move the mouse around, I'm getting some very bizare feedback from GetItemAt(). In some cases, I get a null until I'm about 50 pixels below a ListItem and when I'm within the bounds of the ListItem image, I'll get a null!
Am I exceptional or is this normal behaviour? If it's normal, anyone know what on earth I can do to mitigate it? My users will be able to define a range of thumbnail sizes and have control over the size of the ListView at runtime.
SysInfo: .NET 4 / VS 2010 / XP SP3 / ex-Pascal hack on keyboard. SysInfo[3] = usual cause of errors
|
|
|
|
|
DaveGriffith wrote: Point cp = ListView1.PointToClient (new Point(e.X, e.Y));
I don't understand why you would do this, the coordinates are already relative to the receiver of the mouse events, hence ListView1.
|
|
|
|
|
Hi Luc,
Mainly because I'm trying to debug the problem I'm getting with sorting and DragDrop. When I try to use list reordering from an example Drag and Drop ListView row reordering
Using the e.X, e.Y values work as you suggest for my mouse move, why does every example I see of DragDrop use PointToClient() because it doesn't appear to report the right information to me when I try it in a mousemove event and I'm getting very bizarre re-ordering in my results! Heck, even MS use it in their example of OnDrop and I can't work it out.
|
|
|
|
|
Mouse coordinates are relative to the Control they apply to. If you have a MouseDown event on a Panel, the Panel is active and gets its event with local coordinates. MSDN holds examples where e.Location is used directly for painting something inside a Control.
There are only a few exceptions, and they always clearly state "in screen coordinates"; they apply to situations where there isn't an active Control, e.g. when you drop something (DragDrop.Drop event), or just ask for the mouse location (Control.MousePosition); for these, chances are you want to relate the event to the underlying Control, and then you would need Control.PointToClient.
Try it without PointToClient!
And check the MSDN documentation.
|
|
|
|
|
Ahhh... so in a DragDrop.Drop event, focus is (potentially) still with another control or out of scope entirely and so we use PointToClient to find out where the mouse is.
As soon as I read "...where there isn't an active control" the peneny dropped (no pun intended). Thanks Luc!
|
|
|
|
|
you're welcome.
|
|
|
|
|
Hello Everybody
My Name is leonardo i am from ecuador, i have a navigation bar in my c# application,
in the NaviBar I added two NaviBands, you see in the picture attached.
I want that when I make a click in the police-man picture or in the clock picture (show the picture attached),
the NaviBar will do something like show a message box for example...
Please could you tell me how I will make it?
and could you show me the code-lines or maybe through of pictures that you can made.
Notes:
a) The picture of police-man is in NaviBand1.
B) the picutre of clock is in NaviBand2.
Thanks in advance.
Leonardo Ayala R.
PD: if you can not see the image, please go to the link below:
http://yfrog.com/77navibarj[^]
|
|
|
|
|
hey guys...i have a textbox which is in panel..i want to clean all textboxes' text property with a button click in my Form..to do that i created a method but it doesnt clean the text of the textbox which is in panel..the method is below
foreach (Control item in this.Controls)
{
if (item.GetType() == typeof(TextBox))
((TextBox)item).Text = null;
}
how i can reach the textbox inside the panel ?
|
|
|
|
|
Message Closed
modified 23-Nov-14 5:53am.
|
|
|
|
|
hey friend..thanks for your reply..i want to ask one more question
it works if i have one panel but what about if i have more than one..i mean one panle and a textbox in it..and one more panle and textbox inside and so on..
|
|
|
|
|
Off the top of my head, this should clear the value of all the text boxes in a form:
private void ClearTextboxes(Form parentForm)
{
foreach (Control childControl in parentForm.Controls)
{
ClearTextboxes(childControl);
}
}
private void ClearTextboxes(Control control)
{
foreach(Control childControl in control.Controls)
{
ClearTextboxes(childControl );
}
TextBox textBox = control as TextBox;
if (textBox != null)
{
textBox.Text = string.Empty;
}
}
|
|
|
|
|
thanks freind for your help..it works now as i wish.
|
|
|
|
|
You're welcome. You could boil it down to one generic method if you liked, but this should work as is.
|
|
|
|