|
I am working on a project and need the communities help. I have searched extensively, and cannot seem to find a solution to this problem.
I need to create a very simple properties grid. It should have no headers, and simply display 2 columns with name/value pairs listed one per row.
I have created this control by deriving a custom control from the DataGrid object, and it works well, except for one thing. The columns are not resizable without including a header column to the grid.
What I need to do is be able to resize the columns by clicking on the divider between the two cells on any row of the grid. This is the same behavior as what you see in the PropertiesGrid control.
Does anyone have any suggestions on how to implement this? It seems like this should not be hard to do, yet I have been unable to find any reference on where to even begin, much less an implemented solution to this problem.
Thanks in advance for everyones time.
Scot.
|
|
|
|
|
i have some piece of info which might get you further but it's for resizing columns according to the header text size.
piece of code is:
MethodInfo methodInfo = datagrid.GetType().GetMethod("ColAutoResize", BindingFlags.NonPublic | BindingFlags.Instance);
if (methodInfo == null)
return;
for(int i=0; i
|
|
|
|
|
Hi, I want to solve this problem, maybe yu can help me.
I have a lisview with filters, when perm any filter I clear an fill the listview with the filterde rows, the problem is when I have my lisview scrolled horizontally to the right and perform a filter, the listview scroll is moved to the left again to the star of the listview, I dont want this I wat the lisview mantain its scrolled position.
Thank you!!!!
Another question:
When I have both vertical and horizontal scrolls and clear the listview items, what happans with the horizontal scroll (vertical scroll desapear and listview resize (I think)). Resize? Move? and the lisview??
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Hi.
The only way I see without using unmanaged code is to not clear the listview but modify the ListViewItem s to reflect the new data.
When you remove a ListViewItem , the ListView has to check whether the remaining items can be displayed with or without scrollbars, so when you remove all items (clear the LV), then there will be no scrollbars at all, because 0 items will occupy no space.
Perhaps you could remember the scroll position and restore it afterwards, but that will include using P/invoke.
Regards,
mav
|
|
|
|
|
Hello all,
I've noticed an "interesting" behavior in winforms. If I have a custom control whose paint event is overridden to draw a gradient background. When the control is docked and I try to create a LinearGradientBrush by specifying colors and a rectangle, I get an Out of Memory exception. OutOfMemoryException is the most useless exception type, because it does not allow you to fix or even diagnose problems in your code. You are simply screwed as far as I can tell.
Does anybody have an idea why this happens when the control is docked, but does not occur at any other time (like when the control is anchored to achieve the same effect)?
Will
|
|
|
|
|
I guess you should verify the dimensions of your rectangle in either case...
Regards,
mav
|
|
|
|
|
|
That's possible. I didn't unit test that code as thoroughly as I should have. I was thinking it was something like running out of a handle, which didn't make sense at all. I'll have to check that when I get home tonight.
That still doesn't explain what would cause the problem to occur only when the control is docked. Any ideas?
Will
|
|
|
|
|
From personal experience, exhausting the handle pool will generate OutOfMemory exceptions. This can easily happen if you grab a Graphics object and don't Dispose it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does this mean I should worry about re-entering the paint method of my form? In other words, can it be called from multiple threads (I would think not, since the message loop is single threaded)?
So far, I've been having problems on the first attempt at painting, so I doubt that I am overallocating GDI objects. I also use the using statement religiously. I am creating a graphics object in the background however, to enable double-buffering - I'll check that as well.
Will
|
|
|
|
|
gantww wrote:
Does this mean I should worry about re-entering the paint method of my form?
If, by this, you mean that your Paint method is calling itself, you've got huge issues. Paint should never call itself recursively.
gantww wrote:
In other words, can it be called from multiple threads (I would think not, since the message loop is single threaded)?
You should NOT be doing this. You can invoke an Invalidate call back on the UI thread, but you should NEVER make a direct call from a thread to a forms Paint code. Bad, and unpredictable, things will happen.
gantww wrote:
I am creating a graphics object in the background however, to enable double-buffering -
You're what? Are you saying that you're creating a Graphics object on a background thread? Bad idea! Graphics objects should only be created on the thread that created the control your painting.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Uhh. I was running real low on caffeine when I wrote the above statements. Let me rephrase them. I'm creating a graphics object in paint and drawing to a bitmap first (in many cases, anyway) and then painting that bitmap onto the form using the graphics object provided by the event handler. I'm not invoking the paint event from multiple threads or recursing it - I'm wondering if there is any way that windows (or the development environment) could be doing something like that behind my back. I'm particularly concerned that it may be occurring while I'm debugging the code (I'm using dual monitors, so I don't have all the problems of debugging paint code).
By the way, I checked my code and I was able to reproduce the issue where a colorblend was not ending with 1.0. My calculations were off very slightly. I'm hoping that will fix the issue.
Thanks,
Will
|
|
|
|
|
gantww wrote:
I'm wondering if there is any way that windows (or the development environment) could be doing something like that behind my back.
No chance.
gantww wrote:
By the way, I checked my code and I was able to reproduce the issue where a colorblend was not ending with 1.0. My calculations were off very slightly. I'm hoping that will fix the issue.
More than likely.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want someone help me in this small part of my project
i have client / server App ;
in client there is a login form that send username and password to server
that server chek these in its DB and if true it ((CREAT OBJECT )) called user and send this object to the client machine
i ask about the most effcient tecniuqe is it Remoting or web service ? if it web service i don't want use internet i mean it must be locally
i want help please
|
|
|
|
|
|
Web Service does not mean that you HAVE to go over the internet.
Just have it running on your service and use the machine name on the client. Your network config should then auto-magically decide that no outside routing is necessary.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
If you can see your server application being consumed by non .NET clients on the same machine then web services are the only way to go.
Otherwise, I don't see what's wrong with remoting.
See this article, it might help you out: http://www.developer.com/net/net/article.php/2201701
|
|
|
|
|
I hope you really meant to say that you send the username and a hash of the password to the server and check whether they are in the database.
Matt Gerrans
|
|
|
|
|
Hi everybody,
I am working on a PDA project and the user interface (UI) should be constructed by reading XML files (XMLTextReader) and upon the contents creating the approperate Contols.
The problem is on the following areas:
1. How to adapt the perant-child relationships between controls obtained from XML file and set them(since .net Compact Framework does not support Name property in Control class)
2. Connecting event handlers is not a problem but how to access within the event handler another controls (not the sender) which will be created in runtime.
Every reply is welcomed!
Thanks in advance for the effort.
tutah
|
|
|
|
|
How to add controls to OpenDialog box?
|
|
|
|
|
Is this what you are looking for?
this.regsiterStartupScript("tjoff", "window.open('url', '_blank');")
/M
|
|
|
|
|
I'm sorry that i didnt mention it earlier, but i need to add combobox to opendialog box in winForms.
|
|
|
|
|
Hi all,
I'm going to verify a selected item of a combobox with the contents of a datatable in the
combobox.SelectionChangeCommitted method.
But
"SELECT * FROM table WHERE field = " + combobox.Text;
fails due to the combobox.Text doesn't got the selected item yet.
When does the combobox.Text has the valid value from the selected combobox.list ?
Is there a flag to check for completing
I don't want to use a delay or wait.
Thank's for your ideas
Frank
|
|
|
|
|
Use SelectedValue instead of Text.
---
b { font-weight: normal; }
|
|
|
|
|
How to pass arguments to the thread...
I do the next things in the constructor:
m_PaintThread = new Thread(new ThreadStart(PaintMap));
And next things in function that calls the thread:
if(m_PaintThread.IsAlive)
{
m_PaintThread.Abort();
m_PaintThread.Join();
}
m_PaintThread.Start();
So...
In that thread i draw the map, and i call the function CreateGraphics,
but it says that an object reference is required when i call nonstatic method...
I remember in C++ I could pass the parent class in parameter LPVOID lParam,
But how to make it here???
And another question - How to paint map Without Flicking? So how to implement double buffered painting...
|
|
|
|