|
Is the "ColorDepth " property of your imagelist set to "Depth32Bit "? If not, then set it to that value and see if that fixes the problem.
Happy Programming and God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
The ImageList control, not the .NET class, but the ImageList control it wraps, has a bunch of problems. I would suggest you try to avoid using the control if you can.
But, the problems depends on what other controls your using the ImageList with, such as a TreeView getting it images from an Imagelist, and/or the types of file your loading into the ImageList. For instance, the Imagelist has problems with certain types of images using an alpha channel.
So you'll have to be a bit more specific about the problem so we can suggest a fix or workaround. What kind of problems are you having specifically? Do they involve using the ImageList supplying images to other controls?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm not very experienced in .NET Remoting technology. I wrote some simple demos involving that aspect.but I found the client side must reference the server side so that the Activator can create the stub of the server object. when we distribute the application, we have to place a copy of server assembly along with client side.
A copy of server object along with client means Remoting? I think it should not like that, but I don't quite understand.
Then in general, what's the correct way to develope and distribute a .NET remoting application?
Thanks.
|
|
|
|
|
Yes, that's right. You have to reference the library that implements the server objects from the client side. I think it is similar to COM+ (or DCOM) where you have to install the type library on the client machine.
I hate this, too, that's why I prefer web services to remoting. However, I am no expert on .NET remoting.
My articles and software tools
|
|
|
|
|
Then you might want to do it right. You do not have to reference the server code, only the interface that the Remoting object implements. So, either define the interface that the server object implements in a shared assembly, or use soapsuds.exe to create a client-side proxy.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
You do not have to reference the server code, only the interface that the Remoting object implements.
But that is still a pain, don't you agree? With web service, I only care about the interface of the web method I am calling. Also, I can use web methods in non .NET programs or non windows platforms.
My articles and software tools
|
|
|
|
|
I'm afraid I don't understand the point you're trying to make. Personally, I don't think it's hard at all - in fact, I'd rather link against the same interface for type safety and resolution. But the original question doesn't deal with ease, only how to do what the poster was wanting.
As far as a shared interface between web services and remoting, it's really don't different. The biggest difference is that with web services you can create a similar interface, where with .NET remoting the Type of the interface almost always has to be the same (there are tricks around this).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
I'm afraid I don't understand the point you're trying to make. Personally, I don't think it's hard at all - in fact, I'd rather link against the same interface for type safety and resolution. But the original question doesn't deal with ease, only how to do what the poster was wanting.
You are right, it is not hard and my point (if I have one) is not very closely related to the original question.
However, in the original post the poster does show his "frustration" that he has to deploy a server dll on the client side. This server dll may contain only the interface not the implementation details, as pointed out by you and others. My point is, using web service you don't have to do this and there are other advantages of using a web service.
[Edit]
Here is an example to demonstrate the "pain" I am talking about. Supppose the remote object has 3 methods and it is used by mutiple client applications running on remote machines.
The clients and the server are closely tied by the shared dll that contains the interface of the remote object. If you add another method to the remote object which is needed by only one new client, then all the clients have to be recompiled with the new version of the shared dll.
[/Edit]
My articles and software tools
|
|
|
|
|
Xiangyang is wrong. You don't have to reference the implementation dll. Check out an example of how to use a proxy share dll here.
http://www.glacialcomponents.com/ArticleDetail.aspx?articleID=RemoteObject
|
|
|
|
|
I saw that article of
http://www.glacialcomponents.com/ArticleDetail.aspx?articleID=RemoteObject [^]
Basicly it's approach is that the client and server both reference a abstract class ,from which the server side object inherites. while the client side can also activate the real descendant object by knowing it's parent type.
This is quite a elegant way.
Thank you and Xiangyang.
|
|
|
|
|
Allen Anderson wrote:
Xiangyang is wrong. You don't have to reference the implementation dll. Check out an example of how to use a proxy share dll here.
A proxy share dll is somewhat similar to a type library in COM+, right? In that case, I am not completely wrong.
My articles and software tools
|
|
|
|
|
[ToolboxBitmap(typeof(myNamesapce.myControl), "myNamespace.FlatComboBox.bmp"]
How can i change the icon defaul of the custom control
Thanks
Rock Throught The Night
|
|
|
|
|
You might start by reading about the ToolboxBitmapAttribute . The reason you include the Type is to provide a namespace in order to resolve the bitmap.
Just attribute your control with:
[ToolboxBitmap(typeof(myNamespace.myControl), "FlatComboBox.bmp")] "myNamespace" is grabbed from the Type and prepends the filename to find the embedded resource. Make sure you change the Build Action in VS.NET for the "FlatComboBox.bmp" to "Embedded Resource" and that it is contained in your project with the root namespace set to "myNamespace", or in a folder which is used to generate the namespace for embedded resources (and used for the default namespace for new source files, although you can change it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I know that this is possible.
internal static string ByteArrayToHexString( byte[] buf )
{
StringBuilder sb = new StringBuilder( buf.Length );
for ( int i = 0; i != buf.Length; ++i )
{
sb.Append( buf[i].ToString( "X2" ) );
}
return ( sb.ToString() );
}
But I found this code in the BCL and was just trying to
make it work. The trouble I am having is in the lowwer
while loop. From what I can see is it is supposed to index
into the s_acharval array that contains the valid hex
digits. But I have had no luck in figuring it out.
internal unsafe static string ByteArrayToHexString( byte[] buf, int iLen )
{
char[] chs1 = s_acharval;
if ( chs1 == null )
{
chs1 = new char[16];
int i = (int)chs1.Length;
while ( --i >= 0 )
{
if ( i < 10 )
{
chs1[i] = (char)( 48 + i );
}
else
{
chs1[i] = (char)( 65 + ( i - 10 ) );
}
}
s_acharval = chs1;
}
if ( buf == null )
{
return null;
}
if ( iLen == 0 )
{
iLen = (int)buf.Length;
}
char[] chs2 = new char[(uint)(iLen * 2)];
fixed ( char* ch1 = &chs2[0])
{
fixed ( char* ch2 = &chs1[0])
{
fixed ( byte* b1 = &buf[0] )
{
char* ch3 = ch1;
byte* b2 = b1;
while ( --iLen >= 0 )
{
*ch3++ = *( ch2 + ( 2 * (( *b2 & 240 ) >> 4 )));
*ch3++ = *( ch2 + ( 2 * ( *b2 & 15 )));
b2++;
}
}
}
}
return new String( chs2 );
}
Any help would be greatly appreciated.
Thank You
Bo Hunter
|
|
|
|
|
So what exactly are you trying to figure out? If you don't understand how the code works, I suggest you first read-up on the fixed statement (which pins an object in memory, preventing it from being relocated by the GC). The rest is simple pointer math.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I should have been more pacific.
What I ment by the part I am having
trouble with is the last while loop
is it does not work.
These lines are the problem.
*ch3++ = *( ch2 + ( 2 * (( *b2 & 240 ) >> 4 )));
*ch3++ = *( ch2 + ( 2 * ( *b2 & 15 )));
b2++;
What I am going by is the hash returned for a
certain byte[] does not match the result from
the same function with the same byte[] in the BCL.
Thank You
Bo Hunter
|
|
|
|
|
"Specific". "Pacific" is the worlds largest ocean.
Also, sayinging "it does not work" doesn't help me one bit. What doesn't work? Be more specific. Do you tell your doctor that you don't feel well and leave it at that?
A byte is a byte is a byte. A byte is 8 bits (currently; I doubt that will ever change). On some platforms, these are big endian and some art little endian, but the .NET Framework takes care of that detail for you.
Whatever the case is, the BCL is correct. If you don't understand pointer math, I suggest you just use byte.ToString("x2") ; otherwise, please be more specific about what the problem is. I - or any other regular here - am not going to debug your code for you, but we'll try to help you if you be more specific and tell us what's wrong.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You know something Heath; don’t answer any more of my post.
You have a big chip on your shoulder.
I have never seen you correct someone's
Spelling before, all you are doing is being a smart ass.
It is because of me posting some of your previous posts when you
start bashing people for not doing this and not doing that.
What is your problem? I could understand that being
vague or something but to start a post with
("Specific". "Pacific" is the world’s largest ocean.)
Is nothing more than the arrogant, self absorbed, inconsiderate
prick that you are.
Now did I misspell anything this time?
This is what Heath Stewart thinks about Certifications.
Heath Stewart said
"Personally, I am not certified because I really don't want to be. I know a large number of people with certifications that know crap. They studied for the tests, memorized a few things, took the tests (sometimes a couple times) and got their certs. They're still idiots."
|
|
|
|
|
Heath,
I agree with Bo.
Please do not waste our time with negative and counterproductive rants.
Karl
|
|
|
|
|
Please don't waste your time? I reply to about 1,000 posts per month in this forum - I don't see your name as a reply to even a fraction of as much. It's people that don't state what the problem is and expect the other regulars and me to debug their code for them that wastes time.
Saying "it doesn't work" is a waste of the developers' time who spend their time in this forum answering questions on a regular basis, and it is happening more often lately.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Bo,
First off let me apologize for the rudeness of others. This is the place to post questions like these, and you did show us in the code exactly where the problem was occurring.
I believe that replacing your troubled lines with the following might fix your problem.
<br />
*ch3++ = *( ch2 + ( 1 * (( *b2 & 240 ) >> 4 )));<br />
*ch3++ = *( ch2 + ( 1 * ( *b2 & 15 )));<br />
b2++;<br />
Best of Luck!
Karl Baum
CEO of KGB Technologies
Specializing in custom software development.
|
|
|
|
|
Background: Winforms Dialog Application, .NET 2003
Overview:
1 form, contains:
panel for main content
panel for navigation
2 custom controls loaded into main forms depending on scenario
1 class containing my event
Description:
This is apparently beyond the scope of the issue but may be important.
The app starts, it loads one of the childern controls into the form's main content panel. It passes the event class as a parameter. A user clicks on an item in the control, the event class's public method is called with the items id. The class functions internally calling the delegate, etc. The main form catches the event and proceeds to switch the main panel's control.
Up to this point the application functions properly. Now heres the oddity I have found. The event handler gets triggered, does some processing and then calls:
PanelMain.Controls.Clear();
// set control
tabbed = new CtrlMainTabbed( m_meeting );
// Load tabbed control onto main panel
this.PanelMain.Controls.Add(tabbed);
// Add the Panel to the Form.
this.Controls.Add(PanelMain);
The issue: the control is loaded properly and functions nicely if ann ONLY IF the next mouse click occurs in the application. If the mouse is clicked on any other application, or if a MessageBox is spawned by that method, the application reaches an inactive state. The title bar becomes a light blue, and the application will not recieve events. Now as I mentioned, if the application is clicked immediatly after the swirching of the panel contents, all functions normally.
I have isolated the problem to PanelMain.Controls.Clear();
I have also tried PanelMain.Controls.Remove( myItem1 );
Both result in this behavior.
I have tried calling invalidate to repaint the panel / form, along with numerous other ideas, that I will not bother with here. My assumption is that there is an event in the message pump that isnt being dealt with properly, most likely the result of me calling Clear on the panels contents.
Also, I have tried simply running the app and loading the panels, then clearing it and then loading it again and this works properly.
So what I'm gathering is the delegate and the clear event are not behaving well together. The issue appears to me to be related to the events / threads.
Keeping in mind I may be way off in my assessment, does anyone have any ideas?
|
|
|
|
|
I would agree something in the message pump is probably at fault here, so try calling Application.DoEvents at some point in that handler and see if that helps.
Also, for any calls that may be invoked from another thread (which may or may not include certain event handlers, like OnPaint when double-buffering is enabled) be sure to use Control.Invoke to make changes on the control's UI thread, although that doesn't seem to be your problem here.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your response Heath.
I followed your suggestion and tried the Application.DoEvents() at various points to no avail. I have also tried using MethodInvoker / Invoke to call Clear.
I have also noticed that coming back the other way ( loading the panels ), has the same effect. In this case, there is no event fired like the other way. The form's nav panel has a button bar that triggers the loading of the panels. Again I use Clear(), so it must be the call to Panel.Clear() regardless of the custom event. I will look more into properly clearing panels.
If anyone has any pointers thatd be great.
|
|
|
|
|
Thanks for your response Heath.
I followed your suggestion and tried the Application.DoEvents() at various points to no avail. I have also tried using MethodInvoker / Invoke to call Clear.
I have also noticed that coming back the other way ( loading the panels ), has the same effect. In this case, there is no event fired like the other way. The form's nav panel has a button bar that triggers the loading of the panels. Again I use Clear(), so it must be the call to Panel.Clear() regardless of the custom event. I will look more into properly clearing panels.
If anyone has any pointers
|
|
|
|