|
|
Why don't you try to help yourself first.
Instead of posting here for each line of code you need writing, attempt to do the code yourself then come here when you get stuck. You can also ask here for general guidance, for instance if you want to know how to compress an array of bytes then you can ask that question, to which you were earlier given an answer the same as you have received in this post - the only different here is someone has gone and searched for you.
In my opinion you are having a lucky day with everyone seeming so helpful, but if you don't start to attemp the work for yourself, people will be less willing to help you.
Also, in relation to your post, somebody was trying this the other day and found that compressing a JPEG stream in fact made it larger, this was possible due to the fact a JPEG file format is already designed for compression, so you may be best just leaving it as it is.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
I'm using MeasureString method to calculate size of a string. I used same font type and style. But for Chinese and Japanese text primitives the MeasureString returning more height than the height returned when English or French text primitives are passed to the MeasureString.
I used the following statement
return g.MeasureString(measureString, m_font, new PointF(0, 0), m_stringFormatForSizeCalc);
Where m_stringFormatForSizeCalc is set by the following method
m_stringFormatForSizeCalc = CreateSizeCalculationStringFormat();
StringFormat CreateSizeCalculationStringFormat()
{
StringFormat stringFormatForSizeCalc = StringFormat.GenericTypographic.Clone() as StringFormat;
stringFormatForSizeCalc.Trimming = StringTrimming.None;
stringFormatForSizeCalc.Alignment = StringAlignment.Near;
stringFormatForSizeCalc.LineAlignment = StringAlignment.Near;
stringFormatForSizeCalc.FormatFlags = StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap;
return stringFormatForSizeCalc;
}
Ex: font Arial Regular size 100.
For Chinese and Japanese strings height is 153
For English and French strings height is 149
|
|
|
|
|
This is normal for those characters. If you noticed, you're not exactly looking at a Latin character set. So, what's the problem??
|
|
|
|
|
The height calculated from MeasureString is used to find the font point size with the following formula
font point size = (adjustedPixelsPerInch) * (fontEmHeight / fontAscentAndDescention) );
adjustedPixelsPerInch = height in pixels * 0.75
0.75 is points per pix.
The problem is if i use different text primitives(say Chinese and English) of same size 100 and font type Arial regular.
While trying to render the text primitives the height calculated from MeasureString for Chinese string is higher than the English string. So the font point size that will be calculated while rendering is more than the actual 100 that has been set.
|
|
|
|
|
Raghu566 wrote: adjustedPixelsPerInch = height in pixels * 0.75
So where did this ".75" magic number come from??
|
|
|
|
|
I voted for Remove this message
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Same here. He's dumping the same message in a lot of forums. If I didn't know better, I'd say that he was promoting the websites in his signature
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
How to code in for USB to serial......sending and receiving communication
|
|
|
|
|
When I bought my USB-to-serial cable, it came with a CD-ROM containing a driver. When I installed it, it turned the port into a regular serial port, so it shows up in all serial port enumerations, and most/all serial apps can use it, whether HyperTerminal or some .NET based app using SerialPort class.
The app never is aware the USB-based serial port is connected in a different manner, all the nasty details are hidden by Windows and the device drivers.
BTW: there are minor differences between such a USB-to-serial cable and a regular serial port, mainly in timing; it is not able to achieve very high speed in toggling the control lines, which for most applications is irrelevant; if however the attached hardware requires very short pulses on say the DTR/DSR/RTS pins, the motherboard- based serial port might be able to deliver and the USB-to-serial might not, due to the fact USB communication requires data packets, which must be transmitted and interpreted, whereas a direct port is much "closer" to the CPU.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Dear All, I know this hasn't to do any thing with C# forum, but as you people are expert in programming section.
i have a question. well i decided to take MCPD enterprise application development certification
i am asking u guys about a good institute or university in India, UK?
yours really appreciated
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
I want to create a desktop application having a single centralized server
which accepts multiple client connections and responds them.
I am trying to use TcpListener class (for server) and TcpClient class (for clients). The server and client application are able to connect but I am not able to accept multiple clients connections.
Can anyone help me out to solve this issue.
|
|
|
|
|
|
I am trying to create an on update event and have recieved the following error:
An object reference is required for the non-static field, method, or property 'RenishawVMCU.CommandParser.OnUpdate(RenishawVMCU.CommandData)'
It is generated form this line: OnUpdate(rxPortData);
public class CommandParser
{
CommandData rxPortData = new CommandData();
public delegate void delUpdate(CommandData commandData);
public event delUpdate update;
protected virtual void OnUpdate(CommandData commandData)
{
if (update != null)
{
this.update(commandData);
}
}
}
public static string ParseCommand(string m_recievedUCCData)
{
byte[] rxData;
rxData = StrToByteArray(m_recievedUCCData);
CommandData rxPortData = ParseCommand(rxData);
rxData.ToString();
return "Parsing done!" ;
}
public class VirtualMCU
{
public VirtualMCU()
{
cmdParser.update += new CommandParser.delUpdate(cmdParser_update);
}
}
Does anyone know what could be wrong as this is the only line that is causing a problem i cant work it out.
|
|
|
|
|
ParseCommand is a static method.
You cannot access non static methods / members from the static one.
Uri
|
|
|
|
|
This is static
public static string ParseCommand(string m_recievedUCCData)
{
OnUpdate(rxPortData);
} This is not so can only be called by an instance of CommandParser
protected virtual void OnUpdate(CommandData commandData)
{
} If there is no particular reason for the ParseCommand method to be static, then make it an instance member. Alternatively, pass a CommandParser instance as a parameter into the ParseCommand method and act on that.
public static string ParseCommand(string m_recievedUCCData, CommandParser commandParser)
{
commandParser.OnUpdate(rxPortData);
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanx for the help. I had not yet learnt of this so was useful information.
i soleved the probelm by passing in the perameter as you suggested which stopped the error.
This is the final code, it didnt have a problem with calling Parsecommand(byte[]) as the method is static.
public static string ParseCommand(string m_recievedUCCData, CommandParser commandParser)
{
byte[] rxData;
rxData = StrToByteArray(m_recievedUCCData);
CommandData rxPortData = ParseCommand(rxData);
commandParser.OnUpdate(rxPortData);
return "Parsing done!" ;
}
|
|
|
|
|
Here[^] is a hint for you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
Created a user i.e. UserA in the domain.
Added this user to the administrators group in serverA.
Using C#, I impersonate this user in my application.
Then using UserA, the application creates a vbscript on ServerA.
Problem is that the vbscript does not get run when I use the processstart call
The error is vbscript engine is not found.
Please note that if I log into the application using my credentials then all works fine and the script runs correctly on serverA.
Do you know why I get the below error if logged in as UserA?
I have also run regsvr32 vbscript on serverA but this does not help in the case of UserA
Error is:
Can not find script engine vbscript for script "path of the vbscript".
Thanks
|
|
|
|
|
hi i can convert an image(in picturebox) in bytes nw i want to compress it hw can i compress it
|
|
|
|
|
Read it into a MemoryStream. Then compress it using the System.IO.Compression.GZipStream class. You could also use the #ZipLib library - there is an article on this site about it (MemoryStream Compression[^])
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
The Subject says it all... At the moment I am using the following method:
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
However, since I need to be taking screenshots at around every 250ms, I need to find the most efficient way possible (if any)...
Thanks!
Note: I have found that taking partial parts of the screen is much more efficient, but at the moment I need all the screen taken...
modified on Monday, July 20, 2009 3:22 AM
|
|
|
|
|
here[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I must say that that was really helpful...
|
|
|
|
|
hi i m shekhar i having an image tht stored in picturebox i want to convert this image in to bytes plz help me
|
|
|
|