|
Yes, yes! That's very important! Never expose a field publically
unless it is a readonly or const. But you even can do it for them too.
The only case that I use public fields in, is when deriving from EventArgs.
I put some data as public readonly fields to reduce the code and to
speed up the handling a little bit.
And if you look up the FCL reference, there's almost no public fields exposed,
unless constants such as EventArgs.Empty, String.Empty and so on.
|
|
|
|
|
A property is like creating a whole method for manipulating a field.
/\ |_ E X E GG
|
|
|
|
|
i need to merge two PNG images (loaded in memory) into one without lose the transparence of both (if there are some transparent area inside the first one or the second one or of both that are not mask by the other let it ).
How can i do it?
Then i need to get the final PNG file in memory and put it on a picturebox.
It is really important, please help me if you.
Thanks.
|
|
|
|
|
Compare each pixel and make an OR operation.
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
Well, here's what you can do:
1) create a new Image object (with the appropriate size)
2) get a Graphics object for it (Graphics.FromImage static method)
3) draw the first image on the new image (using the Graphics object)
4) draw the secons image on the new image
5) now you have an Image object that meets the requirements
Or, if you don't need one of the images, draw the other one
over it.
Cheers
|
|
|
|
|
<br />
3) draw the first image on the new image (using the Graphics object)<br />
4) draw the secons image on the new image<br />
5) now you have an Image object that meets the requirements<br />
3) what method do i need to use?
4) what other now so to don't overwrite the whole first image?
|
|
|
|
|
3) use the DrawImage method of the Graphics class
4) you don't need to do anything else special. If the
image that you'll draw over the first one is transperant,
GDI+ will draw it correctly with alpha blending. Don't worry,
just try it. I have and it works just fine
|
|
|
|
|
ok really thanks now the last thing:
To create the right Image object to hanlde png 32 bit image how declaration syntax i have to use.
Stop, tnx!
|
|
|
|
|
hi I m new in c#. want to run unsafe block in managed code. can anybody tell me how to chane option to run code in unsafe execution mode?
|
|
|
|
|
Hello
You need to set Allow Unsafe Code Blocks in Configuration Properties of your project.
And of course use
unsafe
{
}
Andrew
|
|
|
|
|
hi
i have written a program before .but when i run that now this error was appeared:
An unhandled exception of type 'System.ArithmeticException' occurred in system.drawing.dll
Additional information: Overflow or underflow in the arithmetic operation.
please help
thanks
|
|
|
|
|
Without seeing your code and the line on which it breaks, it's impossible to tell you whats wrong. What is your code doing when it breaks?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello to everybody!
I've been programming in c# for a couple of months and got a problem in an application i'm creating for a little company.
my application lets you control a little transponder reader, linked to the pc by a serial cable. this application should also let you update the firmware, using an external executable thet was created by another software house.
this external program shows a little form with an "update!" button. users should click on this button to start firmware updating.
the problem is, my boss doesn't want this little form to appear and wants instead the firmware to be updated without users have to click on this external form.
i found the code of an old c++ program they used to do this. it used the function setTimer to give the little form a value corresponding to "enter" key, immediately starting the firmware update.
is there any way to do this in c#?
please understand i am relatively new to the world of programming. i studied a little java at the university and a little c# by myself.
i'd really appreciate any help on this, because i can't really cope with this.
oh and by the way sorry for my bad english.
thanks in advance, Rey9999
|
|
|
|
|
Hi,
1. Checkout if the external program allows to you to have command line options for updates. like /u etc, to find out use <appln.exe> /? or /help
2. Otherwise, use process ProcessInfo to call the application and use Process.Showwindow = false (dont remember the exact function name) and use Sendkeys "{SPACE}" if you still wish to do the old C++ way.
3. The otherway would be to use Win32API to execute commands and get hold of the window.
|
|
|
|
|
thanks for your fast reply!
i tried solution no. 1 but this application takes no parameters.
so i tried solution no. 2 but i noticed the "keystroke" is sent to my form, not to the external application; i think it's because my form is seen as the active application, not the external executable.
i'd like to try solution no. 3 but i don't really know how to do it.
i know i may sound annoying but can you give me a hint on using this Win32API stuff?
i wish i knew more about programming but you know italian universities...
thanks alot, Rey9999
|
|
|
|
|
Hi,
maybe somebody use CSTA in C#? where i can find some sample? etc.
Greetings
|
|
|
|
|
What do you mean with CSTA?
Canadian Sport Tourism Alliance?
California Science Teachers Association?
(These were among the first results from Google for CSTA)
Or Computer Supported Telecommunications Application?
Or something else?
With just a TLA or FLA it's hard to find what you want.
mav
(TLA: Three Letter Acronym, FLA: Four Letter Acronym)
|
|
|
|
|
Heh....
just Computer Supported Telecommunications Application
Greetings
|
|
|
|
|
I try to build a Form template in VB.Net so later on i can inherit the form template.
in VB.NET i can use
<br />
Public SearchForm As Object;<br />
<br />
'Without instance the real SearchForm Class object<br />
'The real SearchForm will be instance in the inherit form. <br />
'in the init. method<br />
<br />
SearchForm.Show();<br />
the base class sucessfully Compile.
But in C#
<br />
public object SearchForm<br />
'Without instance the real SearchForm Class object<br />
'The real SearchForm will be instance in the inherit form. <br />
'in the init. method<br />
<br />
SearchForm.Show()<br />
but in C# i can't compile it.. an error message come out :
'object' does not contain a definition for 'Show'
:(Please help ... urgent ...
|
|
|
|
|
That's obvious: "'object' does not contain a definition for 'Show'". The type object does not provide a method called Show. Your variable SearchForm must be of type Form, which provides this method.
|
|
|
|
|
Thanks. You are right, at the base class the 'object' don't have "Show" method. The "SearchFrom" only instance in the inheritted form but not in the class.
|
|
|
|
|
Now I want to merge column header of datagrid with C# but I don't know how to do this. Please help me. Thanks.
|
|
|
|
|
Hi,
I am new in C#,i want to scan pixels of spline curve from a bitmap image ,and want to store them in linked list.How Please Help me!!!!!!!!!!!!!!!!!.i will be very thankfull to you.
|
|
|
|
|
So you want to work out which pixels are on the curve ? The curve is on the image and you're trying to find it, or you're defining the curve yourself ?
The List class represents a linked list. You don't need random access then ? I'd have thought an array would be best, seeing as you're not likely to want to insert a pixel in the middle after you work it all out. ArrayList is an array.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I need a month year textbox or a monthyear selection control for an application in c# that displays only months and years and no date similiar to credit card expiry date style selection .Can anyone help from where can i get such a control or any alternative solution
|
|
|
|