|
I saw that code... but I didn't understand it at all and I don't know how to convert it to C#. There are a lot of abilities in that thing that I don't need, and figuring out which line does what to extract the stuff I want requires VB knowledge that I just don't have.
Not to mention the fact that I don't even know if that stuff even -has- a C# counterpart.
-M.
|
|
|
|
|
|
I have tried that, yeah, without success
-M.
|
|
|
|
|
Hi,
Have you thought of creating another Form hosting your Panel ?
Regards
|
|
|
|
|
I don't understand... why should I create an entire form just to have a customized panel? I'm just looking for a a piece of code to stick in the OnPaint method of a custom panel that'll make it's background have opacity... I've seen it done in VB, but was unable to translate it to C#.
-M.
|
|
|
|
|
Something like this?
public partial class CustomPanel : Panel
{
Color color;
public CustomPanel()
{
InitializeComponent();
color = Color.FromArgb(100, Color.Blue);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs e){}
protected override void OnPaint(PaintEventArgs e)
{
using (Brush brush = new SolidBrush(color))
{
e.Graphics.Clear(Color.Transparent);
e.Graphics.FillRectangle(brush, this.ClientRectangle);
}
}
}
|
|
|
|
|
Yes!
I've no idea why it works, but it does.
Many thanks!
-M.
|
|
|
|
|
Hi,
can any know how to create a horizantal in WINFROMS.NET?
Thanks in advance.
Thanks in avance
Narendra
|
|
|
|
|
What ??
Regards,
Bhupi Bhai
|
|
|
|
|
That's a lot of spelling checker work for such a small text!!
There is no line control available if you're looking for that, either create your own, or user a groupbox.
|
|
|
|
|
hi all
i need to know how to upgrade from SPS2003 to SPS2007 then apply this upgrade on my SPS2007 that i have ?
if any one have any info. or sites or pdf files .
i will be so greatfull for.
Regards,
abdallah zaid
|
|
|
|
|
Hi, Dear Respected Programmers
kindly let me know, how may I count specified character from any strin value?
for example => "ABC.ABC.ABC" <= I want to count only dots
Thank you in advance
|
|
|
|
|
hi,
i have 2 methods to do this in my head right now.
**FIRST METHOD:
<br />
string input = "ABC.ABC.ABC";<br />
Char c = '.';<br />
Regex regex = new Regex( c );<br />
int count = regex.Matches( input ).Count;<br />
**SECOND METHOD:
<br />
string input = "ABC.ABC.ABC";<br />
int result = input.Split('.').Length - 1;<br />
best regards,
Jamil abou khalil
|
|
|
|
|
Thank you Mr. Jamil abou khalil
|
|
|
|
|
You can use this
char MyChar = '.';
int TheCount = MyString.Split(new Char[] {MyChar}).GetUpperBound();
Points:
1- The split function returns the strings between the delimiter -in our case is the dot-. So these string segments will be more than the dots by one. ie. In your example: 3 segments, 2 dots. I used GetUpperBound() method to overcome this small glitch. Did you figure out how?
2- There are much more effecient ways of doing this in larger strings as paragraphs or long text. This was only a very simple way.
Regards
|
|
|
|
|
Thank you Mr. Nader Elshehabi
|
|
|
|
|
The most efficient way is to loop through the characters in the string and check each character.
There are methods that use less code, like using a Replace, a Split, a RegEx.Replace or a RegEx.Matches, but they all use more resources as they create objects that you are not going to use anyway.
---
b { font-weight: normal; }
|
|
|
|
|
you can use collections to reduce loops
like hashtable
|
|
|
|
|
Rohit Pandhi wrote: you can use collections to reduce loops
like hashtable
Yes, that would work if you would be doing a large number of searches in the same string. It's not efficient for a single search, though.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
Guffa wrote: but they all use more resources as they create objects
This means Memory, or not?
Do you know if it's also faster? (performance profiling)
Thanks for youre time.
Martin
|
|
|
|
|
Martin# wrote: This means Memory, or not?
Yes. It also means objects that needs to be garbage collected. Not very expensive, as short lived objects are handled rather efficiently, but still.
Martin# wrote: Do you know if it's also faster? (performance profiling)
Yes. Looping through the characters is the fastest and most efficient way of doing it. Any other method will also be looping through all the characters, and additionally create objects from what they find.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot!
It always make sense after reading youre posts.
Martin
|
|
|
|
|
hi
You can try this
string str="ABC.ABC.ABC";
string[] strSplited=str.split('.');
If you don't have dot in end of string then
int NoOfDots=strSplited.length-1;
otherwise
int NoOfDots=strSplited.length;
|
|
|
|
|
I have created c# desktop application and created its installation.
I want the program to run immediately after the installation of the program finishes.
Is there any way to do this?
Thanks
tandukar
|
|
|
|
|
Yeah you can do it ...
Override the function "OnAfterInstall" in installer class and get the current working folder
then type this command
System.Diagnostics.Process.Start("");
Cheers
|
|
|
|