|
Yes, I do, but that's not the right way to do it and will only be supported on Windows 2000 and newer (for Windows NT platforms). This uses the SetLayeredWindowAttributes native API that you must P/Invoke, something we've discussed in this forum before and which a few articles on this site discuss.
However, there's still better ways. If you just don't want the DataGrid to respond to any user input (at least on cells, which begs the question of why you're even using the DataGrid then when either using a ListView or just drawing the items yourself would be sufficient), then use the DataGrid.HitTest in conjunection with overriding OnMouseDown to make sure that when a user is over a cell you don't call base.OnMouseDown to continue processing the notification message (WM_LBUTTONDOWN ). This allows you to maintain the normal mouse message processing for other parts of the DataGrid while maintaining functionality for all supported platforms on which the CLI is implemented.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Is there a control I can add to the textbox that is like the "formatting bar" in Word. I need the user to be able to choose font, color, etc... The question is, do I have to make that panel/bar from scratch or can I import it as a control from anywhere?
|
|
|
|
|
You'll have to either write your own Toolbar code to handle what all the buttons are supposed to do or you can use a commercially available control to handle the Toolbar, still writing the code that does what the buttons say they do.
A Textbox has very few properties that make it useful for editing and formatting like this. Why not use a RichTextBox control instead?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What I meant by textbox is RichTextBox, sorry. But is there a control for that or will I still have to write my own?
|
|
|
|
|
A Toolbar is just a collection of buttons and other controls. Clicking the button will fire an event that signals such, but it will not do whatever the button image says on it's own. You have to supply the code to Save, for example, or Save As, or change the Font of the selection and so forth. There is nothing that will do this for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If a user clicks on a cell in a dataGrid is there any way to return the row number of the cell they clicked (or double clicked) on?
Thanks.
|
|
|
|
|
|
Hi everyone,
I've been stuck with this problem for several days already. My code extensively uses asynchronous delegate invocation using the Delegate.BeginInvoke method. The general pattern is as follows:
Scheduler or UI thread:
1) BeginInvoke function 1
First function:
1) prepare data
2) BeginInvoke data processing passing CurrentThread (see below)
3) CurrentThread.Suspend
4) (after resume) go to step 1 with new data processing command, if all commands are executed, exit
Data processing:
0) get calling thread (passed in parameters)
1) process data
2) set result
3) resume calling thread
Several data processing commands (Command pattern) require asynchronous calls, too. That is that BeginInvoke method is called from inside another method which was called using BeginInvoke, too. What I've noticed so far is that sometimes the delegate being BeginInvoke'd is NOT CALLED AT ALL! To give more evidence, I have a special Logger class which sends messages to a text box. Apparently, it uses Control.BeginInvoke to correctly dispatch Text property changes. Sometimes again the function specified in MethodInvoker delegate is also NOT CALLED AT ALL!
What could be the problem? I honestly hope it is not a bug in the framework, as the project is (and has been for the last month) in the final stage.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Serge Lobko-Lobanovsky wrote:
First function:
1) prepare data
2) BeginInvoke data processing passing CurrentThread (see below)
3) CurrentThread.Suspend
4) (after resume) go to step 1 with new data processing command, if all commands are executed, exit
I've got a question. Why are you launching another thread and then pausing the current one, waiting for the newly launched thread to complete? There's no reason to launch another thread to do the work if your just going to sit around and wait for it to complete!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You're right. I am now simplifying the code. However, the proble is still there: I call Control.BeginInvoke(new MethodInvoker(myMethod)) and the debugger never stops in myMethod, and the code never executes.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Hi folks...
I am working with mdi forms and i would like to disable the mdichild to be moved out from the mdicontainer and the scrollbars must not appear. What i am trying to say is that the mdichild form must not be able to be moved out of the parent container. How can i do that?
Sorry my poor english
Thiago
C# beginner - brazil
|
|
|
|
|
My suggestion would be to add handlers to the move and size properties of your child window, and make sure its position stays within the bounds of the parent window
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
and... how can I do that?
I've never worked with handlers in C#... as I said, i am beginner. Plz, help me! If you want, I can send you the project.
Best reguards
Thiago
|
|
|
|
|
I'm not at a computer with C# on it at the moment, but if memory serves me right, you'll need to bring up the form for the child window in the form editor, then in the properties panel click on a little icon that looks like a bolt of lightning (a yellow zigzag) - click that and it'll show all the possible handlers you can give this form - double click on the move and size ones and it'll make the functions for you
(Anyone else able to give a better description?)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Hello,
i want to ask if image buttons are supported by Smart Device Applications?
thx
regards
pat
|
|
|
|
|
Hello,
i developed a smart device application with a login function. Now i want to develop that after the user presses the login button for approximately 3 seconds a greeting screen is displayed where personal information of the logged in user is displayed and then it is automatically forwarded to the main screen.
Is this possible to develop for a smart device application? if yes can anybody give me a short explanation how it works?
thanks in advance
regards
patrick
|
|
|
|
|
I'm not sure about smart device applications specifically, but the approach I'd try would just be to open up a form with your greeting message displayed, that has a timer attached set to fire after 3 seconds, and have an handler function for that timer that closes the form. Then just create an instance of the greeting form from the constructor (or some suitable place) of your main form, that'll make it get displayed
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
hi,
I have code to add access control entry to active directory user object so that they can't change password (User cannot change password is checked)
But i wonder it's possible to write code to remove this access control entry again. I have tried using AccessControlList.RemoveAce method..but the "User cannot change password" is still checked.
Using Windows 2003 server active directory and System.DirectoryServices here.
Any help?
Thanks
|
|
|
|
|
Dont know if this is exactly what you are looking for but i found it a very informative site on this topic - maybe you could find some answers/clues there-
http://weblogs.asp.net/cumpsd/archive/2004/02/08/69403.aspx
|
|
|
|
|
Ok i have a DataTable that has 2 columns: ID & Name
I have populated a combo box from that data table like so
ComboBox1.DataSource = XmlIn.Tables["Names"];
ComboBox1.DisplayMember = "Name";
Now when a user selects a name from the combobox and then clicks a button i need away to return the coresponding ID to that name.
I have thought of using a DataView to scan for the name and return the relevent number but was sure there was a tidier way to return the ID value.
Can any one help?
Thank you.
|
|
|
|
|
set the ValueMember property of the control:
ComboBox1.ValueMember = "ID";
ComboBox1.DisplayMember = "Name";
ComboBox1.DataSource = XmlIn.Tables["Names"];
Then, you can get the selected Value by using the SelectedValue property:
ComboBox1.SelectedValue;
Jon G
www.Gizmocoder.com
|
|
|
|
|
just add another line to you code after setting the displaymember -
combobox1.ValueMember = XmlIn.Tables["ID"];
then to get the id you could do something like -
combobox1.SelectedValue.toString()
gavirj
|
|
|
|
|
Hi, sorry to bother with the easy stuff. Im brand new to C#, and loving it BTW.
Anyway. coming from scripting everything in KORN and Perl I need an example of the following in c#.
I would like to see simple c# code to
open a file,
build each line into an array by splitting on a char,
and print that line on a match on any element on an array.
In perl it would go:
@array = `cat file`;
foreach $line (@array) {
if ( $array[0] =~m/something/ ){
print "$line\n";
}
A simple C# example to this would get me off the google prompt, and back in happyville.
--
sween
|
|
|
|
|
Try this one:
FileStream fs = new FileStream(fileName);
StreamReader reader = new StreamReader(fs);
String line = String.Empty
while( (line = reader.ReadLine()) != null ){
if(line.indexOf("something") > 0){
Console.WriteLine( line );
}
Regexp epression = new Regex("~m/something/")
if(expression.IsMatch(line)){
Console.WrileLine(line);
}
}
reader.close();
|
|
|
|
|
Thank you.
FileStream fs = new FileStream(FileName, FileMode.Open);
seemed to work a little better... but all is getting less fuzzy.
Thanks again.
--
sween
|
|
|
|