|
man, it comes step by step ...
thanks a lot ... it is done now
Thanks alot
Hamody
|
|
|
|
|
hi all,
I'm using VS.net2005 C#,
I've class inherited from System.Windows.Forms.Button named PanelButton and FlatStyle is Flat, in run time when the PanelButton foucsed there is a rectangle displayed in the middle of button, i want to hide this rectangle..is it possible?
plz i need any one have an idea to help me.
thank you
-- modified at 5:11 Sunday 27th August, 2006
|
|
|
|
|
Hello
Yes of course in many ways..
The simplest one is to handle the paint event, and draw another rectangle over this one using the BackColor of your button. This should hide it.
Regards
|
|
|
|
|
hello,
this may help if the button have a back color, but what can i do if the back color of the button is transparent?
thank you
|
|
|
|
|
Hello
This rectangle appears around the text in the middle of the button. So, take the value of the string when it changes, put it in a private field. Now, make the Text = "", and draw the text yourself from te string your've stored in the paint event.
Regards
|
|
|
|
|
i'm fear to disturb you,
my button already has no text in spite of that "This rectangle appears around the text space in the middle of the button." as u said
thanks for reply
|
|
|
|
|
Hello
No text!!
You are not making this any easy, are you?
Alright! I'm out! I don't know!! What is this rectangle?? If there is no text in the button it shouldn't appear!! Something is wrong in this matter.
I want to help, but, the last thing I got in my sleeves is a bit inconvenient. Don't give your button a focus. IIRC it would be
SetStyle(ControlStyles.Selectable, false);
This way it won't get input focus, and you still can click it by the mouse -but not the keyboard-
I hope this works, otherwise I'm moving to java!;P
Regards
|
|
|
|
|
Dear Friends,
I have one DatGRid Control in my .aspx page with C#. I have last field as Status field which is boolean and is bound as checkbox control. Could you please show how can I se wether the user has checked it or uncheked it according to that I want to change the status of all customers record. if the checkbox is checked means the status is trus and i want update his status in the database through gridcontrol. I want to check all the record at one time. Even if possible I would like to give "Select all records" and "Deselect all Records" option also. Your quick response will be highly appreciated.
Thanks and Best Regards
Murtuza Patel;
|
|
|
|
|
Hello
1- To check if the value of any of the CheckBoxes has changes or not, you should handle the DatagridView.CellContentClick. Then Check the ColumnIndex and RowIndex f the e parameter to know which cell was clicked.
2- Now to check or change the value of a CheckBox, you will just have to access it right by casting it as this for example:
((DataGridViewCheckBoxCell)MyDataGridView.Rows[Y].Cells[X]).Value = true;
Where Y is the row index, and X of course is the CoumnIndex. The above line will set the value of the cell to true. You can put it in a foreach loop to set All the records to true/false.
Regards
|
|
|
|
|
How can i programatically send a shutdown or a restart command from a On_click event?
Is this possible in c#?
Thanks
|
|
|
|
|
|
how do we move a file containing an image eg pic.jpg to a certain path like "e:\vs2005\images in c#????and the file info and directory info methods cant do this.is ther any other way too move a file to a path?
any help/suggestions/ideas would be highly appreciated!
bia ali
|
|
|
|
|
biaali wrote: and the file info and directory info methods cant do this
Why not?
is ther any other way too move a file to a path?
Yes, but if you can't do it with System.IO, there is virtually no chance that any other method would work.
---
b { font-weight: normal; }
|
|
|
|
|
It seems likely to me that you've opened the file in your code and not disposed of it, which leaves a file handle open. This would cause the file to be inaccesible, and as has been said, if the IO classes won't do it, nothing will.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
can u still tell me how to do this using the IO classes....cause i m not able to find any method for moving a file to a certain directory....though ther are methods for moving a file to a certain file and moving a directory to a certain directory but i cant seem to find any metyhod for moving a file to a directory.i need help in this regard.
bia ali
|
|
|
|
|
What you're asking makes no sense. How do you turn a file into a directory ?
System.IO.File.Move()
This method will take file paths. How else could it move a file ? If the directory does not exist, you need to create it first.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
how can make textbox (with bold red line ) in Border ??
Palestine
|
|
|
|
|
win form load it will be normal textbox
but when mouse over (the border will be red color)
Palestine
|
|
|
|
|
Hello
You'd have to handle MouseEnter and MouseLeave events like this:
private void textBox1_MouseEnter(object sender, EventArgs e)
{
Graphics g = textBox1.CreateGraphics();
g.DrawRectangle(new Pen(Brushes.Red, 3), new Rectangle(0, 0, textBox1.Width - 5, textBox1.Height - 5));
}
private void textBox1_MouseLeave(object sender, EventArgs e)
{
Graphics g = textBox1.CreateGraphics();
g.DrawRectangle(new Pen(Brushes.White, 3), new Rectangle(0, 0, textBox1.Width - 5, textBox1.Height - 5));
}
Regards
|
|
|
|
|
Hi!
That's not a good advice you're giving there.
You're creating resource leaks because you don't dispose of the Graphics object and drawing to the textbox in this way is only visible as long as the textbox isn't redrawn.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello
mav.northwind wrote: you don't dispose of the Graphics object
Well, last time I checked my GC wasn't on vacation! My graphics objects are local variables, they will be disposable once the call to the handler is over.
mav.northwind wrote: drawing to the textbox in this way is only visible as long as the textbox isn't redrawn.
Unfortunately, no! This is not a webpage where the user may click refresh, and almost all the causes of paint are mouse involved. Once the mouse is out of the box, it doesn't matter!! Even when the user types in the box without moving the mouse out, the box is still there. Besides, this is just a hint. You want to handle the paint event as well, not a problem.
Thanks for the post though.
Regards
|
|
|
|
|
ReHi!
Nader Elshehabi wrote: Well, last time I checked my GC wasn't on vacation! My graphics objects are local variables, they will be disposable once the call to the handler is over
It's not that the GC isn't working correctly, you're not calling Dispose() !
You shoud use:
using (Graphics g = textBox.CreateGraphics())
{
} Nader Elshehabi wrote: Unfortunately, no! This is not a webpage where the user may click refresh, and almost all the causes of paint are mouse involved. Once the mouse is out of the box, it doesn't matter!!
Sorry to say that, but this is exactly the cause for many questions in this forum when people ask why they are having problems when they paint directly on top of controls.
The paint event is the only correct place to perform painting.
With your suggestion, just move another window over the textbox (or part of it) and you'll see what I mean.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello
I don't want to sound like I'm just arguing, but it's nice to have this talk with you.
mav.northwind wrote: you're not calling Dispose()
Best practice, you should call dispose() I know, but it occurs to me, why to dispose it, if it will be disposed by itself after the event handler is finished??
mav.northwind wrote: just move another window over the textbox (or part of it) and you'll see what I mean.
How could you do that without moving the mouse out of the textbox first?;P
Again, it's nice to have this talk with you.
Regards
|
|
|
|
|
Rehi!
Graphics implements IDisposable and is freeing the native GDI+ graphics handle in its Dispose() method.
When you don't call Dispose() the resource doesn't get freed and your app will crash the computer after a while because it's running out of GDI handles eventually.
Nader Elshehabi wrote: How could you do that without moving the mouse out of the textbox first?
Alt-Tab? And another Alt-Tab to get back to the original window. The mouse still is inside the TextBox but I'm pretty sure there'll be no red border.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hello
Thank you for your kind advice. I'll make sure to dispose managed objects I create. Also I'd be happy to read an article -specially if you wrote it- about when to dispose and when to leave that to the GC.
About the Alt-Tab!! Nice catch!!
Extra Regards
|
|
|
|