|
i need help
how can i merge images from two different picture boxes into one pic box???
|
|
|
|
|
Hi,
I want to know the about user control and how to use them?
I saw many application to create wizard, all application uses user control like one for header, one for footer, Please tell me how to use user control?
|
|
|
|
|
look at this[^]
BTW: that was a google search for 'c# user control' and the first hit on the list
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
If i have this class for example :
<br />
public Class A<br />
{<br />
public void Func1()<br />
{<br />
....<br />
}<br />
<br />
virtual public void Func2()<br />
{<br />
....<br />
}<br />
}<br />
<br />
Public Class B :A<br />
{<br />
<br />
override public void Func2()<br />
{<br />
...<br />
}<br />
<br />
}<br />
I don't want to override Func1 but i allso don't want it to be exposed to the user.
What is the best way to do so?
|
|
|
|
|
use "protected" instead of "public"
|
|
|
|
|
But if i will use "protected" i will not be able to access func1 in an instance of class A, Just in Class B!
|
|
|
|
|
From your question : "I don't want to override Func1 but i also don't want it to be exposed to the user."
That means -> Func1 must be
protected (Func1 visible to child classes)
or
private (Func1 is not visible)
From your 2. question : "But if i will use "protected" i will not be able to access func1 in an instance of class A, Just in Class B!"
That means -> Func1 must be public.
So, you can choose between them..
I think, you have a design problem.
|
|
|
|
|
What you want isn't possible with standard inheritance as far as I can work out if I'm understanding you correctly.
If you want a common function between two classes, but with their own implementation, and an additional function in one (or more) of them, I would use an interface.
public interface IInterface
{
void Func2();
}
public class A : IInterface
{
public void Func2()
{
}
}
public class B : IInterface
{
public void Func2()
{
}
}
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)
|
|
|
|
|
I think he wants class B to make its inherited Func1 non-accessable.
|
|
|
|
|
The best I can come up with is the code below. So long as the classes are in a seperate assembly to the code accessing them, then it will work, although it only hides it from intellisense and creates a compile error if there is an attempt to use the method. If they are in the same assembly as the accessing code then the method will be visible, though unuseable.
I'm not keen on it as it's not very OOP - if B derives from A then it should have everything that A has, but MS do it all the time, so who am I to question this method?
public class A
{
public void Func1()
{
}
public virtual void Func2()
{
}
}
public class B : A
{
[EditorBrowsable(EditorBrowsableState.Never),
Obsolete("This method is not useable in this class", true)]
public new void Func1()
{
throw new InvalidOperationException("This method is not useable in this class");
}
public override void Func2()
{
}
}
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)
|
|
|
|
|
You want to override the method and make it non-public? That's not allowed. You could mark it Obsolete or have it throw an Exception.
P.S. Most likely you want class B to wrap class A, not derive from it. And maybe use an interface.
modified on Monday, July 20, 2009 10:48 AM
|
|
|
|
|
hi I have this code that convert an picture box image in bytes
MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
byte[] data = ms.ToArray();
ms.Close();
MessageBox.Show("image Converted in bytes");
now i want to compress these bytes too according to this code
plz help me
|
|
|
|
|
|
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.
|
|
|
|
|