|
I'm looking for an idea how to draw image to looks like semi-transparent. The image will be generated with code, so I can't make it directly semi transparent. I need this to be fast, can't make it pixel by pixel.
Thanks in advance
|
|
|
|
|
alexiev_nikolay wrote: The image will be generated with code, so I can't make it directly semi transparent.
Why is that?
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I've done that in one of my articles. The following code applies an alpha value to a bitmap:
private unsafe void ApplyAlphaToImage(Bitmap image)
{
if (image == null || _alpha == 255)
return;
int imageWidth = image.Width;
int imageHeight = image.Height;
BitmapData data = null;
try
{
data = image.LockBits(new Rectangle(0, 0, imageWidth, imageHeight),
ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
int scan0 = data.Scan0.ToInt32();
int stride = data.Stride;
byte * colPixel;
byte invertedAlpha = (byte)(255 - _alpha);
byte * rowPixel = (byte *)scan0;
for (int y = 0; y < imageHeight; y++)
{
colPixel = rowPixel + 3;
for (int x = 0; x < imageWidth; x++)
{
if (*(colPixel) < invertedAlpha)
*(colPixel) = 0;
else
*(colPixel) = (byte)(*(colPixel) - invertedAlpha);
colPixel += 4;
}
rowPixel += stride;
}
}
finally
{
if (data != null)
image.UnlockBits(data);
}
}
This is still pixel by pixel but not using the regular Get/SetPixel functions but LockBits unsafe code. It is relatively fast - fast enough at least so I could use it in animations. Look here[^] to see the results.
|
|
|
|
|
i have a question which was asked before on this site, but apparently has never been answered propperly:
What if i want to scan the memory of a process to find some variables ? For instance i want to create a game trainer like ArtMoney. I introduce a value, and the program finds all the locations in the process' memory which mach my value.
My question is simple: where do i start the search, and where do i stop. I already tried the dummest thing, which was to scan from 0x00000000 and until i find my value... Obviously it got blocked at some point, before finding my value...
I was thinking that most likely, every process has to have a unique address where it memorizes the variables... But i don't know and i can't seem to find anything about that on the net...
Please help. Or at least guide me to an article solving my problem.
Thanks
bunny EATING rabbit
|
|
|
|
|
WinDbg will show u the memory addresses.
|
|
|
|
|
how to drag and drop a file to my form? and how to get the property of selected file(files)?
thanks for help.
erfan
|
|
|
|
|
Set the AllowDrop property to true and handle the DragEnter and DragDrop events.
In the DragEnter event, you'll have to set the Effect property of the DragEventArgs to something else but None , otherwise the DragDrop event will not be called.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
|
I'm makign a web browser, how do you make the status bar load in sync with the website?I've even downlaoded source codes for other browser tutorials but they never work.
-- modified at 14:30 Saturday 8th July, 2006
|
|
|
|
|
Use the navigating and documentcompleted events if you want to know when the browser starts and finishes navigating.
Alternatively, if you want to know how much has been downloaded and how much needs to be downloaded of the webpage, use the e.CurrentProgress and e.MaximumProgress properties of the progresschanged event of the webbrowser.
|
|
|
|
|
Hi All,
I am using combobox i filled combobox and noe I want to access combobox values.
my code is
comboBox1.DataSource =_orderBO.FillCombo("select CustomerId from Customers");
comboBox1.DisplayMember="CustomerId";
comboBox1.ValueMember="CustomerId";
MessageBox.Show ("Item is"+ comboBox1.Items[1].ToString());
Gives value "system.data.datarowview" as messagebox
Please help me....
-- modified at 9:29 Saturday 8th July, 2006
|
|
|
|
|
That is what you get when you use the ToString method on a DataRowView object.
Cast the item to DataRowView, then you can get the data you want from it.
---
b { font-weight: normal; }
|
|
|
|
|
SqlConnection conn= new SqlConnection("urconnectionstrng");<br />
DataSet dst = new DataSet();<br />
SqlDatAdapter dap = new SqlDataAdapter("select CustomerId from Customers",conn);<br />
comboBox1.DataSource =dst.Tables[0];<br />
comboBox1.DisplayMember="CustomerId"; <br />
comboBox1.ValueMember="CustomerId"; <br />
<br />
MessageBox.Show ("Item is"+ comboBox1.Items[1].ToString());
|
|
|
|
|
Thanks Friends,
Thanks for suggestions.
Regards,
Nagraj.
|
|
|
|
|
hi,
i had tried a few of the directx video capture projects here, and that i find the captured video's size is huge. i had tried capturing in different formats, eg. avi,mpg,3gp but the size did not reduce. Is there anyway where i can capture short videos with smaller size?
thanks
|
|
|
|
|
Hi,
Im working in DotNet 2003 in Windows Applications using C#, and i require a control that has the functionality of a Label and a RichTextBox.
In RichTextBox, i can select a specific text and can apply different font styles (Bold, Italic) to it, but there is not function available to change the background IMAGE of the RichTextBox...only BackColor can be changed.
For Example: Sample Text (you can see, in "Sample", "am" is both Bold and Italic and this can only be done in a RichTextBox)
In Label, BackGroundImage can be applied, but specific Text cannot be Selected programmitacally, and the Font Styles (Bold, Italic) are applied to the entire Text in the Label.
I need a control in Windows Applications (using c#) that can have the functionality of applying BackGroundImage to it and Text with different styles can also be added to it. Just like Microsoft PowerPoint, when we run the Slide Show, Text appears with styles applied and BackGround also appears.
RichTextBox has Transparent Color, but it is not that much Transparent and the BackGround of Parent Control hides behind the RichTextBox.
so , i need some help
Thanx in Advance.
Regards,
Kamran.
-- modified at 6:06 Saturday 8th July, 2006
|
|
|
|
|
Hi!
Try searching the articles here, I know there's one around that gives you a RichTextBox with a background image.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Can anyone tell me how can i get information of current CPU usage of machines? so that i get to know about the cycles avaialable.
Thanks in advances
|
|
|
|
|
There is already an article about your question.
CPU & RAM
Eran Aharonovich (eran.aharonovich@gmail.com )
Noviway
|
|
|
|
|
try using System.Diagnostics.PerformanceCounter class, with the Processor category.
there are no facts, only interpretations
|
|
|
|
|
hi,
I have got an issue at hand related to security of the data stored in the data store... just wanted to ask if there is any EFFICIENT way to save your data file (encrypted or not) so that the user could not read or change the information stored in it, if the file is encrypted then every querry to data store will need a decrypting cycle and this will cause more and more delay when the size of data store will increase, cache is another option but it does not suits the requirements of the software that I am developing... is there any other means through which the security could be implemented...
Thanks,
Regards,
Waqas.
|
|
|
|
|
I've tried to sign my assemblies (http://www.codeproject.com/useritems/SecUtilexe.asp?df=100&forumid=256869&exp=0&select=1337472)but it is not working. I can use assemblies from any application. Is there another solution or things in 2.0 are different?
|
|
|
|
|
There's a reason why that article is rated so low. The technique doesn't work. It won't prevent anyone from reusing an assembly.
There are a few ways of doing it, but nothing documented.
The easiest would be to write your assembly so that it requires some kind of authentication before any of its members will work. Each classes constructor should check for proper authentication before it's code executes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
http://www.engineeringproject.net
|
|
|
|
|