|
Serialization also uses Reflection internally to get the property information of a class, so you can just go the Reflection+Recursion route and everything will be fine.
This way you also don't have the limitations[^] of the standard .NET serialization classes.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The problem I am having with reflection and recursion is I only need the string or primitive type's value. Now if its a B type object or a Collections.Generic.List then the the process gets really complicated.
I am right now trying to use
if(type is System.String) // not working
,,,,,,,,,,,,,,,,
else if(type is Userdefineobject) //how to get User define object?
So basically I need to differentiate betten the ones which are string, int (isPrimitive works but how can find which one are sting or list?)etc and the ones that are user define objects(B or C type in runtime) so that I can do some recursion.
|
|
|
|
|
hi again friends,
how can i change my image opacity?
|
|
|
|
|
One way would be to change the pixel format of the image to ARGB and then save it as PNG or TIFF file, like that:
public static Image SetImgOpacity(Image imgPic, float imgOpac)
{
Bitmap bmpPic = new Bitmap(imgPic.Width, imgPic.Height);
Graphics gfxPic = Graphics.FromImage(bmpPic);
ColorMatrix cmxPic = new ColorMatrix();
cmxPic.Matrix33 = imgOpac;
ImageAttributes iaPic = new ImageAttributes();
iaPic.SetColorMatrix(cmxPic, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
gfxPic.DrawImage(imgPic, new Rectangle(0, 0, bmpPic.Width, bmpPic.Height), 0, 0, imgPic.Width, imgPic.Height, GraphicsUnit.Pixel, iaPic);
gfxPic.Dispose();
return bmpPic;
}
using (Image img = Image.FromFile(filename))
{
Image img2 = ((Bitmap)img).Clone(new Rectangle(0, 0, img.Width, img.Height), PixelFormat.Format32bppArgb);
img2 = SetImgOpacity(img2, 0.5f);
img2.Save(filename2, ImageFormat.Png);
img2.Dispose();
}
I got the SetImgOpacity method from here[^]. I just tested this code and it works fine.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
you're really great, merci
|
|
|
|
|
What I just tried out which works, you can also convert the image to grayscale with the ColorMatrix class used above, just set the matrix to
cmxPic.Matrix00 = 0.299f;
cmxPic.Matrix01 = 0.299f;
cmxPic.Matrix02 = 0.299f;
cmxPic.Matrix10 = 0.587f;
cmxPic.Matrix11 = 0.587f;
cmxPic.Matrix12 = 0.587f;
cmxPic.Matrix20 = 0.114f;
cmxPic.Matrix21 = 0.114f;
cmxPic.Matrix22 = 0.114f;
This will produce a grayscale image with a different approach as presented in the aricles.
Hope this helps
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi again friends,
i have an image and i want to make it white and black. how can i do that?
thanks
|
|
|
|
|
Sajjad Izadi wrote: i have an image and i want to make it white and black. how can i do that?
Do you mean programmatically?
If not, then this is the wrong forum, but you could use Photoshop or similiar to do that.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Yes , what is the probloem?
|
|
|
|
|
Here you go[^]
If you want to get in touch with image processing, then I also recommend the parts 2-5 from the series, they're really interesting and helpful.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
your suggested project was great but what is the parts 2-5 from the series? please give some more explanation about them
|
|
|
|
|
|
that was again great, thank you
|
|
|
|
|
hi friends,
How can i descover that what is the current screen resolution (1027*768 or 1152*864 or etc)?
|
|
|
|
|
Screens.PrimaryScreen, from memory
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
that worked, thanks a lot
|
|
|
|
|
im using the following code snippet to find mispelled words and highlight them...
PhoenixText.Forms.MdiWindow win = (PhoenixText.Forms.MdiWindow)this.ActiveMdiChild;
Char[] characters = win.TextBox.Text.ToCharArray();
bool stop = false;
foreach (string word in win.KeyWords)
{
for (int p = 0; p <= win.TextBox.Text.Length;p = p)
{
int endIndex = p;
foreach (char lett in characters)
{
if (stop == false)
{
if (lett.ToString() != " ")
{
endIndex++;
}
else
{
stop = true;
}
}
}
win.TextBox.Select(p, endIndex);
win.TextBox.SelectionColor = Color.Red;
win.TextBox.ForeColor = Color.Black;
p = endIndex + 1;
}
}
The problems are...
1. It wont just highlight 1 word
2. The RichTextBox's forecolor gets changed to red so that when you type oiut more text, its all red.
If anyone know how to fix these problems, thanks in advance.
|
|
|
|
|
use the string's split method to break your text into words, instead of chars.
I'm not sure how to fix issue b.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Fixed it!!!
SpellCheck checker = new SpellCheck();
PhoenixText.Forms.MdiWindow win = (PhoenixText.Forms.MdiWindow)this.ActiveMdiChild;
Char[] characters = win.TextBox.Text.ToCharArray();
foreach (string word in win.KeyWords)
{
int firstIndex = win.TextBox.Text.IndexOf(word);
int lastindex = word.Length;
if (checker.CheckSpelling(word) == false)
{
win.TextBox.Select(firstIndex, lastindex);
win.TextBox.SelectionFont = new Font(win.TextBox.Font, FontStyle.Underline);
win.TextBox.DeselectAll();
win.TextBox.Refresh();
}
}
|
|
|
|
|
|
to get text from a textbox you just call textbox.text. But i'm not understanding, you have this code in the "Page.Load" event, how can anyone type in a contact in the textbox if this code executes when you first visit the page?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
1 - ask ASP.NET questions in the ASP.NET forum
2 - just use the text property, obviously
3 - have you considered using better variable names than gridview1 ?
4 - have you considered not putting database code in your presentation layer ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How can I update the contents of my PAD file automatically.
I need to update the following
+ Program Version from Assembly Version of the main exe
+ Release Date based on the current system date
+ Size of the Zip file containing my project exe and data files
I understand this would require some parsing of PAD files. What I'm looking for is a tool which can help me do that. If there is none I may write my own utility.
Thanks
Sukhjinder...
Mods, please move this post to the correct forum
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
i think for your first and second question you should expand the 'properties' folder from solution explorer and double click on 'AssemblyInfo.cs'. you can change what you want there.
|
|
|
|