|
Thank you! it works now!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I have TreeView with an imageList containing 3 image. I gave the TreeView root with ImageIndex =0, and it`s child with ImageIndex =1 or =2. The problem is, when the left mouse is released after being pressed on a node, the node`s ImageIndex will change into 0. Any idea why this happened?
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Tree view items have two properties of your interest:
ImageIndex - image to display when node is not selected (almost always)
SelectedImageIndex - image to display when node is selected.
To fix your problem, set SelectedImageIndex to the same value as ImageIndex (unless you want a different behavior.
Hope that helps,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
That will help. Thanks
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I am developing a small RTF writer to create Project report
by refering microsofts specifications to gerenate RTF code. The method that I am using is, first get the page height then insert text line by line, every time any line is inserted, decrease the page height by font height. Thus till the printable space is available insert the text in the page. At the last line insert page number. It works fine.
But when I insert any bitmap (having height in exact multiple of font height) along with text in the page with proper height calculations, the location of the last line in actual printing/previewing gets shifted either upwords or downwords.
Thus page number on two pages do not get printed at same location.
When there is no sufficient data to fill up the page, I insert blank paragraphs to reach up to the last line and add the page number.
In both the cases the available printable area calculation gives exactly same value,still actual print differs a bit in vertical alignment of page number.
what could be the problem ? please guide....
|
|
|
|
|
Are there any samples or example c# programs to map key heirarchies in the windows registry to an xml file?
|
|
|
|
|
Probably not. At least I haven't been able to find anything via Yahoo or Google.
Why would you want to?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi there,
In C/C++ it's not unusual to have a parameters to a method like...
void UpdateStuff(char* name, int* age, bool* likesToast);
where if likesToast points to a bool true we update our record of whether this person likes
to true, if it points to a false we update it to false, but if it's NULL we don't update it,
but we might be updating his name and age.
What's the preferred way of doing this in C#, other than having a bunch of overloads for UpdateStuff?
Thanks in advance,
Nev.
|
|
|
|
|
You will have to create your own nullable class for each of the primitive types you need to use this way
|
|
|
|
|
I thought that would be the case, but I thought I'd better ask first.
Thanks Robert.
|
|
|
|
|
|
Hi All,
I have a business level and database level app running on a server. It currently is a TCP/IP remoting app monitoring a port. I would like to change it to a service. At this point the program needs updating about once a week.
My questions are:
Is it easy to update a service?
Can a service monitor a port like this DOS app does?
I would like to remotely update the service and am wondering is it possible to stop, update and start the service without ever having to log into the machine?
Thanks for any help or thoughts as I have not written a service before.
Regards
Stephen McAllister
|
|
|
|
|
1. Its as easy as with any other application with the difference (as you mentioned yourself later) that you will have to stop the service before doing so.
2. A service can do everything a normal app can do.
3. I think windows has some default mechanisms to do this, but I dont know how this is done. If nothing helps make a little update service for your service. It could receive the update files, stop your service, replace the files and restart the service.
|
|
|
|
|
Robert Rohde wrote:
2. A service can do everything a normal app can do.
With restrictions. If the service runs as SYSTEM - and you should really determine if you need SYSTEM privileges - the service needs to be marked for interactive use by bitwise OR'ing the Type registry key for the service name under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services. In that case, you would typically impersonate the caller or pipe owner, etc.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
You do not necessarily have to stop a service when servicing your application, but a reboot will be required if you don't (to act on the pending file rename operation - or PFRO - that was scheduled since your service executable was in use).
Whether or not you can remotely update the service depends on what remote administrative tools you have set up. There's nothing built into Windows to enable this functionality directly, but you can use WMI to stop the service, use the Admin share (like \\SomeMachine\c$) to copy over the service executable, then use WMI to restart the service. This wouldn't require an interactive login, but your connecting user account would still be authenticated.
A strong word of caution (and this is an area I know well) - really evaluate what the minimum set of permissions are. Too many services often run as SYSTEM, which grants your service full administrative rights. It's highly discouraged to run as SYSTEM unless you have to. Run either as an interactive user (which allows you to create window stations in which to run Windows applications - visible or not), NetworkService (for basic rights + network privileges) or LocalService for a decent amount of privileges.
You can find a lot of information about Windows services - and just about everything else regarding Windows development - at http://msdn.microsoft.com[^].
For information specfic to services, see http://msdn.microsoft.com/library/en-us/dllproc/base/services.asp[^]. To learn more about the privileges granted to LocalSystem (SYSTEM), LocalService, and NetworkService see http://msdn.microsoft.com/library/en-us/dllproc/base/service_user_accounts.asp[^].
You can also create window stations (which host desktops, which are required for Windows applications) by running as SYSTEM and OR'ing the Type registry key with 256 (when I get time to finish it, I'll be releasing an article describing this in more detail) as I mentioned in my indirectly reply to your post. It is recommended in this case to impersonate the caller, typically calling ImpersonateLoggedOnUser which you'd have to P/Invoke.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi
Is there any body help me to solve my problem ?
I read a HTML file from web unsing MSWinSock and I need show some strings contaned in it that is UNICODE (such as "س") in a textbox, but i can't convert it to original carachters readable for human.
Please help me
if you can help me please send your solution to my mail box : mirzaei@gmail.com
Thank You
|
|
|
|
|
What does this have to do with C#? If you were using C# (or .NET in general) you shouldn't be using Winsock but the System.Net classes, like the HttpWebRequest , or more simply the WebClient , to retrieve a web page. Unnecessarily interoperating with native code (like Winsock) creates security dependencies that may or may not be granted to your code.
What is it exactly that you're asking? Do you want to show a Unicode (not all caps, BTW) character as س, or resolve س to a Unicode character?
If you understand HTML (or actually SGML that defines entities like this), it should be simple. The representation above is a decimal (base 10) representation. If you see an x, like س, then it's hexadecimal (base 16). In either case you could parse the number, convert it to hex (if necessary), then split it into 2 characters (2 hex digits). Use the UnicodeEncoding.GetString or UnicodeEncoding.GetChars to covert that byte[2] array into a char (in .NET, a char is always stored in Unicode) or a string (again, always stored in Unicode internally).
mirzaei wrote:
if you can help me please send your solution to my mail box : mirzaei@gmail.com
All forums on Code Project are message boards. Direct email is not encourage and should not be expected. If you entered your address correctly into your profile you will receive notification email by default when someone replies to you.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
If you need to convert a Unicode character to that representation, then it's quite easy. Use UnicodeEncoding.GetBytes to get a byte[] array, then loop over that byte[] array and print either decimal or hexadecimal.
The following example loops in 2-byte increments and prints a decimal format:
using System;
using System.Text;
class HtmlEntities
{
static void Main(string[] args)
{
if (args.Length > 0)
{
Console.WriteLine(HtmlFormat(args[0]));
}
}
static string HtmlFormat(string value)
{
StringBuilder sb = new StringBuilder(value.Length * 7);
Encoding enc = Encoding.Unicode;
foreach (char c in value)
{
byte[] buffer = enc.GetBytes(new char[] {c});
int i = BitConverter.ToInt16(buffer, 0);
sb.Append("&#" + i.ToString() + ";");
}
return sb.ToString();
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have to render to screen images that come from a variety of sources (such as faxes, etc.), and some of those images are TIFF files with YCbCr encoded Jpegs. Unfortunately, .Net doesn't handle these kinds of images.
I need some help understanding how to decode a jpeg. I have enough code to take apart the TIFF, and I have some sample code which will translate YCbCr values into RGB values, but I could really use some help with decoding the jpeg itself.
Any pointers?
|
|
|
|
|
You need to read it manually ? If you just read it in, the byte array won't read in with YCbCr values ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Well, even if I read it in manually, it's compressed. That's the trick: how do I handle jpeg compression? Jpegs aren't stored in a simple pixel-by-pixel format. Or... so I gather.
|
|
|
|
|
C# can read a number of formats, including jpeg, and give you a byte array. Read my image processing articles for more info.
So, if the jpeg just contains YCbCr instead of RGB, it would be a simple case of reading the file, iterating over it, and converting each pixel to an RGB value.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I think that there's something broken in the image I was testing with. I have a single-page TIFF which I can extract a YCbCr encoded jpeg from and open with a .Net bitmap. Thanks for the help!
|
|
|
|
|
Hi All,
I added a C# class file to the C# project.
I want to use the drop down control at runtime. I get an error when I write
using System.Web.UI.WebControls;
on top of the page. Can't we not use it?? How do I access any control at runtime in a class. Please let me know.
Thanks.
|
|
|
|
|
You're probably trying to use web controls in a project that has not imported the dll that contains them
But that's a wild guess, seeing as you've not told us the error.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|