|
My app has a CheckedListBox, after added items, not be able to gray out some items so users can't select them.
Any one has solution?
Thank you.
|
|
|
|
|
I don't think it's possible to do without some custom drawing. You might try overriding OnPaint and see if you can do some drawing in there to manually gray out a particular item.
|
|
|
|
|
OK I tried to double chech (5 times at least acctually) all things, still when I replace
this code:
<code> HttpChannel c = new HttpChannel(32469);
ChannelServices.RegisterChannel(c);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(SimpleChatProgram_DLL.SimpleChatProgramLibrary),
"RemoteMsgObj.soap", WellKnownObjectMode.Singleton);</code>
with this one
<code> RemotingConfiguration.Configure("App.config", false);</code>
and
this config file:
<code><configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown
mode="Singleton"
type="SimpleChatProgram_DLL.SimpleChatProgramLibrary, SimpleChatProgram_DLL"
objectUri="RemoteMsgObj.soap"/>
</service>
<channels>
<channel ref="http" port="32469" />
</channels>
</application>
</system.runtime.remoting>
</configuration></code>
my client app (very simple program btw), stop working it can't even start anymore...
Server start just as usual, but doesn't work as expected...
Any idea?
|
|
|
|
|
Any idea guys, I tried bunch of mine, but none give expected results, guess it's something trivial..
|
|
|
|
|
try the filters ... unfortunately i forgot the right syntax, but it have something to do with soap or binaryfilter...
<channels>
<channel ref="http" useDefaultCredentials="true" port="0">
<clientProviders>
<formatter ref="soap" typeFilterLevel="Full"/>
</clientProviders>
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
i cut/copy this from my own project, maybe it helps you
VirtualVoid.NET
|
|
|
|
|
I still didn't got this working...
|
|
|
|
|
I've recently come over to VS/C# from Delphi, and I know this is a basic question, but I am seemingly wading through far too much documentation to find the answer.
I want to use a struct or Object as a property of a component. In Delphi, any such property declaration automatically resulted in an expandable node in the IDE, displaying all the properties of the struct or Object within the root component.
I see in the VS library documentation now that structs such as Size and Rectangle do expose themselves to the IDE by way of editors. I have not written whatever required editor, but without the editor, my struct or Object property appears as grayed out text in the Property window. I believe I've properly set up the attributes for my intended property. But in any case, I cannot edit the struct or Object property in the Properties window.
Can anyone just confirm for me that indeed I do (or do not) have to write an editor, and perhaps point me toward what kind of editor to write, and what VS documentation to see for reference?
Much thanks in advance,
mike
|
|
|
|
|
mike montagne wrote: In Delphi, any such property declaration automatically resulted in an expandable node in the IDE, displaying all the properties of the struct or Object within the root component.
That doesn't happen here. You can use attributes to make a property appear in the designer, and if it's a struct, you could mark those properties as well. I think it's [Browsable].
The real question is, why do you need to set it in the designer ? But, I believe the problem is, the designer knows nothing about your struct, you need to set it up to expose the properties of the struct.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Setting the Browsable attribute hasn't seemed to be enough. I will try setting up the designer and report the results when I get around to that (hopefully later today).
Thanks, Christian.
m
|
|
|
|
|
Marking the struct/Object property [Browsable] in the root component, and marking the struct/Object property members [Browsable] as well, does not alleviate the grayed/disabled struct/Object property listing in the root component.
As to identifying what to do in the way of an editor/designer (or whatever is required), I'm still (so far) only finding plank after plank of documentation that doesn't answer the question.
Does anyone know what kind of editor/designer I need to investigate here? It would seem that example code for editors such as Rectangle or Size would do the trick.
If I stumble on the answer eventually otherwise, I shall post.
TIA,
m
|
|
|
|
|
It doesn't look to me so far that UI Type Editor will solve the problem. You can only override GetEditStyle() for instance to render a drop-down control or a modal dialog. That itself rules out the nested node behavior I'm after... and the walkthroughs are not treating a whole object descendant as a property... so they aren't really showing me what I need to do (and seem to apply instead to simply interfacing a class or type for which there is not applicable editor behavior for a singular set of values (versus numerous member properties)).
Striking out so far... and have a feeling this is far simpler than wading through all this.
|
|
|
|
|
Another possibility is that Interfaces are the intended solution.
Getting warmer or colder with this shot in the dark?
|
|
|
|
|
Christian,
If you don't mind, I'm trying still to decipher your post.
First you say, "That doesn't happen here." But you add, "You can use attributes to make a property appear in the designer, and if it's a struct..."
I believe by the latter you may mean, "That doesn't happen here, unless you use the attributes, XAttribute, YAttribute, etc. (or something to that effect)." Your next question appears to reinforce the idea I don't need a designer.
Anyway, I'm sorry to ask this again, but I need to be clear on this. Is your thinking that I should not have to write a designer -- that [Browsable] and [Serializable] should do the trick without a designer?
I'm not getting either to work.
TIA,
m
|
|
|
|
|
Hello,
mike montagne wrote: my struct or Object property appears as grayed out text in the Property window
Happens normaly only if you have set the Readonly attribute or youre property has no setter.
Here you find everything you need:
http://www.codeproject.com/cs/miscctrl/customizingcollectiondata.asp[^]
This article helped me a lot.
All the best,
Martin
|
|
|
|
|
Hmmm.
I have both set and get. Here is the property definition in the client class. Please excuse the mess from the experimental state:
[Browsable( true )]
[Category( "Appearance" )]
[Description( "Caption margins, relative to layout. Default = new GCMargins( enumMarginGroup.mgLeft, 3, 26, 3, 3, 3, 3 )." )]
[DesignerSerializationVisibility( DesignerSerializationVisibility.Visible )]
[NotifyParentProperty( true )]
public GCMargins Caption_Margins
{
get
{
return f_Caption_Margins;
}
set
{
f_Caption_Margins = value;
P__InvalidateConditionally( );
}
}
I don't find the article to pertain to my situation; and your answer suggests that your experience is that I *should* be getting a nested property in my client class, even without writing an editor. Is that so?
I've been doing walkthroughs from the VS documentation with no success whatsoever.
TIA,
m
|
|
|
|
|
PS.
Here also is the initial declaration of my property class and its internal fields. Each of the fields is exposed as a property marked with the [Browsable] attribute, and with both get and set methods. But I have nothing but a grayed out property name in my client class:
{
[Serializable]
[ToolboxItem( true )]
[DesignerAttribute( typeof( GCMargins_Designer ) )]
public class GCMargins : Object
{
private enumMarginGroup f_AlignmentGroup;
private Int32 f_Bottom_TopOrBottomAligned;
private Int32 f_Left_LeftOrRightAligned;
private Int32 f_LeftAndRight_TopOrBottomAligned;
private Int32 f_Right_LeftOrRightAligned;
private Int32 f_Top_TopOrBottomAligned;
private Int32 f_TopAndBottom_LeftOrRightAligned;
Here are the property definitions:
#region PROPERTIES
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Determines margin deployment. AlignmentGroup membership is reflected by margin nomenclature." )]
public enumMarginGroup AlignmentGroup
{
get
{
return f_AlignmentGroup;
}
set
{
if ( value != f_AlignmentGroup )
f_AlignmentGroup = value;
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Bottom margin, top or bottom aligned. Minimum = 2." )]
public Int32 Bottom_TopOrBottomAligned
{
get
{
return f_Bottom_TopOrBottomAligned;
}
set
{
if ( value != f_Bottom_TopOrBottomAligned )
f_Bottom_TopOrBottomAligned = Rectify( value );
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Left margin, left or right aligned. Minimum = 2." )]
public Int32 Left_LeftOrRightAligned
{
get
{
return f_Left_LeftOrRightAligned;
}
set
{
if ( value != f_Left_LeftOrRightAligned )
f_Left_LeftOrRightAligned = Rectify( value );
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Left and right margins, top or bottom aligned. Minimum = 2." )]
public Int32 LeftAndRight_TopOrBottomAligned
{
get
{
return f_LeftAndRight_TopOrBottomAligned;
}
set
{
if ( value != f_LeftAndRight_TopOrBottomAligned )
f_LeftAndRight_TopOrBottomAligned = Rectify( value );
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Right margin, left or right aligned. Minimum = 2." )]
public Int32 Right_RLAligned
{
get
{
return f_Right_LeftOrRightAligned;
}
set
{
if ( value != f_Right_LeftOrRightAligned )
f_Right_LeftOrRightAligned = Rectify( value );
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Top margin, top or bottom aligned. Minimum = 2." )]
public Int32 Top_TopOrBottomAligned
{
get
{
return f_Top_TopOrBottomAligned;
}
set
{
if ( value != f_Top_TopOrBottomAligned )
f_Top_TopOrBottomAligned = Rectify( value );
}
}
[Browsable( true )]
[Category( "Appearance" )]
[DefaultValue( 3 )]
[Description( "Top and bottom margins, left or right aligned. Minimum = 2." )]
public Int32 TopAndBottom_LeftOrRightAligned
{
get
{
return f_TopAndBottom_LeftOrRightAligned;
}
set
{
if ( value != f_TopAndBottom_LeftOrRightAligned )
f_TopAndBottom_LeftOrRightAligned = Rectify( value );
}
}
#endregion PROPERTIES
TIA,
m
|
|
|
|
|
Martin# wrote: Happens normally only if you have set the Readonly attribute or your property has no setter.
I must also say that the VS walkthroughs are not providing my answer, and I believe this may be because (as Martin's posts seems to suggest) that I should be getting a nested property node in my client class automatically (although this appears to conflict with Christian's answer).
The documentation for PreFilterProperties states:
Allows a designer to add to the set of properties that *it exposes* through a TypeDescriptor.
Being as TypeDescriptors assumably expose all declared public properties via Reflection, I assume this means I should not have to toy with an editor (which doesn't seem to be solving the dysfunctional property listing in the client class, anyway).
?????
|
|
|
|
|
Hi
I´ve got the following doubt. I ñve got a datagrid that can be sorted. I have attached a dataset.
For example.
DataSet ds = new DataSet("JAMONES");
ds.COLUMN(nombre);
ds.COLUMN(id);
I have associated a ArrayList with all the JAMONES. I would like to delete the selected JAMON from JAMONES using the id. How can i do to indexed easily the ArrayList?
ArrayList jamones = {jamon1, jamon2};
DataGrid jaomnesDG = {jamon2, jamon1}.
I tried to delete jamon1. How can i delte from jamones.
Best regards,
John
|
|
|
|
|
but a long time C/C++ programmer. I've ran in to a bit of a spot that I just can't seem to get a grasp on.
I have a callback in a C++ unmanaged DLL that I've written:
LRESULT CALLBACK eventListener(HWND hWnd, UINT msg, WPARAM wP, LPARAM lP)
{
switch(msg)
{
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hDc = BeginPaint(GetFocus(), &ps);
if(g_currVideo != NULL)
{
const VideoFrame& currFrame = g_frames[g_currentFrame].frame;
BITMAPINFO bi;
ZeroMemory(&bi, sizeof(bi));
bi.bmiHeader.biSize = sizeof(bi);
bi.bmiHeader.biWidth = currFrame.getWidth();
bi.bmiHeader.biHeight = currFrame.getHeight();
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = 24;
SetDIBitsToDevice(hDc, 0, 0, currFrame.getWidth(), currFrame.getHeight(),
0, 0, 0, currFrame.getHeight(), currFrame.getData(), &bi, DIB_RGB_COLORS);
}
EndPaint(GetFocus(), &ps);
return 0;
}break;
...
}
In C++, I would have no problem calling this, however, I am lost when it comes to doing it in C#.
The DLL in question relies on the callback to load and play back frames and samples of an uncommon video format.
In C#, I'm able to get it as far as loading that first frame and audio sample, however, without the callback, that's as far as I can go.
My question is how would I implement use of this callback this in C#?
|
|
|
|
|
In C#, a callback is called a delegate. If you google delegates in C#, you'll find heaps of info on how they work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
we implemented an application, where we designed the architecture like an example given by Microsoft. This architecture uses different layers, so that the presentation layer don't know where the data comes from (like it should be or?). The dataaccess component packages everything into small objects which will be transferred by the business logic to the presentation layer. There we put these objects into a datatable and display the datatable with a DataGridView.
The problem that we have now is, that the application should deal with a large amount of data. This is very slow, because the application puts all the data into the small objects. I read something about the virtual mode of a DataGridView, but this seems to be useful only if you are operating directly with a database. So my question is, does anybody had something similar, and how did you solved it?
Regards
Sebastian
|
|
|
|
|
I need to change properties of controls from an external dll
for eg. i have an app. which contains a textbox(textbox1) and references abc.dll
how can i change textbox1.text from abc.dll? Please help.
Thanks in advance.
|
|
|
|
|
You shouldn't be doing that. Unless the library is specifically for the purpose of manipulating forms, it shouldn't care about what controls are on a form.
If you're trying to return a value, return it to the caller in the form code and let the form code be responsible for updating the controls.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks a lot for ur reply... appreciate that...
actually what i want to do is this:
i have my application referencing a library.
the application has a progressbar and status bar
the library compiles other solutions(devenv .....) in the background (+ does a few other tasks) and i need it to update the status bar and progress bar
if it would be just text... it wouldnt b a problem to return the text and update textboxes accordingly.
but the progressbar is the problem... thers no point if it gets updated after everything is over..
|
|
|
|
|
It could fire events to say that the status has changed. Something else could then handle the event and update the form accordingly.
|
|
|
|
|