|
ToolBarButton .
I was looking at the ToolBarButton docs, and I didn't find any property, public or protected that I could override. Any pointers?
Thanks,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
In a very large richTextBox I want to find all letters.
Is there something faster than :
char[] letters={ 'a','b','c','d','e','f','g','h','i', 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S',<br />
'T','U','V','W','X','Y','Z'} ;<br />
richTextBox1.Text.IndexOfAny(letters, i);
OR
richTextBox1.Text[i].IsLetter;
|
|
|
|
|
I'm not sure how much faster it'd be, but have you looked at System.Text.RegularExpressions?
Optionally, you could check the text each time a new character is entered to see if it's a letter, then just set some boolean flag indicating whether all characters are letters.
Tech, life, family, faith: Give me a visit.
Judah Himango
|
|
|
|
|
I doubt you could make it slower....
Use RegEx, or IsChar on each character as they are typed, as has been suggested.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I want to make blue color all words
int position=0;<br />
char[] KeywordsCanStartWith = {'_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',<br />
'r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I',<br />
'J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'} ;<br />
char[] KeywordsEndBeforeApears = {' ','\t','(',')',',','.',';','\n','[',']','{','}','+','-','*','/',':',<br />
'=','<','>','|','\\','&','%','?','$','!','"','#','\'','@','^'} ;<br />
bool LogVar;<br />
void giveColorToKeywordsInRTB(object sender, System.EventArgs e)<br />
{<br />
position=0;<br />
KeywordStartsHere=-1; caretPos=richTextBox1.SelectionStart; <br />
LogVar=true;<br />
LockWindowUpdate(richTextBox1.Handle);<br />
richTextBox1.Select(0, richTextBox1.Text.Length);<br />
richTextBox1.SelectionColor = Color.Black ;<br />
while(LogVar)<br />
{<br />
KeywordStartsHere = richTextBox1.Text.IndexOfAny(KeywordsCanStartWith , position);<br />
if(position<0)<br />
break ; <br />
if(position==KeywordStartsHere)<br />
{<br />
position = richTextBox1.Text.IndexOfAny(KeywordsEndBeforeApears, position) ;<br />
if(position==-1)<br />
position=richTextBox1.Text.Length-1 ;<br />
else<br />
position--;<br />
richTextBox1.Select(KeywordStartsHere, position-KeywordStartsHere+1);<br />
richTextBox1.SelectionColor = Color.Blue ;<br />
}<br />
}<br />
if(++position > richTextBox1.Text.Length-1)<br />
LogVar=false;<br />
}<br />
}
|
|
|
|
|
Judah Himango and Christian It is a source code editor that makes use of
/*, */, //, "" to make some pieces green etc. So I must jumb from point to point.
That's why I prefer to use .IndexOf instead of .IsLetter.
Could you give me an idea of how to use the solution you suggest(with a litle piece of code if it is possible?)
|
|
|
|
|
Just look up regular expressions in MSDN.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
The RichTextBox will choke badly once you have a few more lines (try 1000+). If you want fast (close to linear) ( ) look at the code of my editor (link below). Even if your detection routines are fast, the RichTextBox will choke on both its find methods and it drawing methods, and there is NOTHING you can do about that, except write your own editor from scratch like i did, and integrate a proper lexical analyser to do the work.
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Thank you very-very much leppie.
|
|
|
|
|
|
Hello
i want To use date format MMM,yy (month in a word and year in 2 digits )
but the month is in the language of the system (from the regional option)
i want the month to by in English without changing the language in the windows system
thanks allot
aviram
|
|
|
|
|
Try:
CultureInfo ci = new CultureInfo("en-US");
string strDate = myDate.ToString("MMM,yy", ci); That should work!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I have a C# solution consisting of a single project - in that project are 3 UserControls - every now and again the usercontrols i have placed on the forms just disappear and I have to start from scratch adding them to the forms again. It happens if the project build doesn't compile fully because I have mispelt something. Why does that happen? Is there a solution and if not what use are usercontrols?
|
|
|
|
|
I'm debugging a Web service with debugger stepping into the web service code from within debugging session of the web client. Problem is that exception is being thrown by system saying that call to the web service timeout while it takes me a while to step through the service code. Is there a way to make it wait infinitely?
Help!
Thanks a lot!
|
|
|
|
|
How do I apply an attribute to a return value of a method?
Thanks,
Yaakov
|
|
|
|
|
|
Hi
I don't know how to get really visible rectangle of my window, taking into account that it can be overlapped by other window(s). May be anybody had been faced this problem already?
|
|
|
|
|
Hi Gurus,
I have a business component which access data layer. All my aspx files uses this business component to access database activities.
I am creating few ViewState parameters in Business component and it turn trying to use from aspx files. I am unable reference ViewState parameters, it always return null value.
Is it possible to access ViewState parameter which are created in Business components to access in *.aspx files after postback events..?
Thanks for your time and suggestion
Yash
|
|
|
|
|
I would appreciate it if somebody could kindly provide the current settings for modern video cards with regard to screen resolution? The values that I currently have are as follows:
640 x 480
800 x 600
1024 x 768
1152 x 864
1280 x 1024
Would appreciate a listing for more modern video card settings. My video card was made circa 1997. To provide the requested assistance, please go to the Start menu, select Control Panel, select Display, select Settings, then look in the control group Screen Area, and then drag the slider control from left to right. The values for the screen areas of the video card should be displayed in the control group area for each setting of the video card at each place that the slider control stops. At least, that is my understanding of how it is done on my computer given my O/S of Windows 2000 Professional. Would appreciate knowledgeable feedback regarding current screen resolutions of modern video cards.
New_Phoenix
|
|
|
|
|
Mine is capable of about 45 different resolutions all the way up to 1920 x 1440. No, i'm not listing them here.
A better bet woul;d be to use DirectX and interrogate the driver that the user has installed to see what it supports, instead of taking a Poll...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The reason that I need them in a hard-coded fashion is that the application requires them to be hard coded for calculation purposes. While the application in development does not require direct interpretation of the user's video card settings at this point, it may be a useful technique as the application evolves. I would really appreciate somebody to provide me with the current video card settings for modern computers, even if there are 45 settings.
While I understand that makes sense for some applications to do as you suggest and to use DirectX and to thereby interrogate the driver that the user has installed to see what it supports, this approach tends to introduce a whole host of uncontrollable variables into the equasion upon which the application depends. In developing an application, it makes sense to try to control as many variables as possible so that the application behaves in an expected manner. That is not an unreasonable request, is it? I would rather prefer to have all of the resolution settings up front to perform the calculations so that the application could behave in an expected manner rather than taking my chances with the results of an interrogation of a user's installed drivers for this application's purpose. This better ensures the development of an application that has a successful outcome, wouldn't it?
However, since I personally do not understand how to use DirectX, and since you do have that understanding, would really appreciate it if you would kindly provide a more detailed explanation as to how to implement the technique of utilizing DirectX to interrogate the driver that the user has installed? At some point, I do indeed believe that this information would be very valuable in the development of applications, and others on the board might be interested in hearing about the method as well.
Another alternative to my request would be to provide a listing that might just include the more common settings that video cards could have, that is, settings that most video cards support. To keep the list smaller, I would request that weeds out the video card resolution settings in which the drivers don't support the higher resolutions with a higher color depth. It should only take a few minutes when you are not busy. Thanks
|
|
|
|
|
And, somehow, values obtained from the video card driver are not usable in your calculations???
This doesn't make any sense...
On top of that, some drivers don't support higher resolutions with a higher color depth.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The reason that I need the video card's resolution settings in a "hard-coded" format is that the application requires them to be hard coded for calculation purposes. While the application in development does not require direct interpretation of the user's video card settings at this point, it may be a useful technique as the application evolves. I would really appreciate somebody to provide me with the current video card settings for modern computers, even if there are 45 settings, preferably the resolution settings that are most common to all video cards and not those that are specific to individual video card manufacturers.
While I understand that makes sense for some applications to do as you suggest and to use DirectX and to thereby interrogate the driver that the user has installed to see what it supports, this approach tends to introduce a whole host of uncontrollable variables into the equasion upon which the application depends. In developing an application, it makes sense to try to control as many variables as possible so that the application behaves in an expected manner. That is not an unreasonable request, is it?
You could see what I mean, that if the variables were left to chance interpretation by a driver DirectX interrogation, that it could potentially compromise the integrity and even the viability of the application itself?
I would rather prefer to have all of the resolution settings up front to perform the calculations so that the application could behave in an expected manner rather than taking my chances with the results of an interrogation of a user's installed drivers for this application's purpose. This better ensures the development of an application that has a successful outcome, wouldn't it?
However, since I personally do not understand how to use DirectX, and since you do have that understanding, would really appreciate it if you would kindly provide a more detailed explanation as to how to implement the technique of utilizing DirectX to interrogate the driver that the user has installed? At some point, I do indeed believe that this information would be very valuable in the development of applications, and others on the board might be interested in hearing about the method as well.
Another alternative to my request would be to provide a listing that might just include the more common settings that video cards could have, that is, settings that most video cards support. To keep the list smaller, I would request that weeds out the video card resolution settings in which the drivers don't support the higher resolutions with a higher color depth. It should only take a few minutes when you are not busy. If you prefer, kindly send me the video card resolution settings to me by clicking on the email link at the bottom. Thanks
|
|
|
|
|
U could use managed directx to get the available modes.
I'm no DirectX guru so maybe there's a much easier way to do this, but using DirectDraw its pretty straightforward and didnt take too long to figure out a way:
using Dd=Microsoft.DirectX.DirectDraw;
public void GetModes()
{
Dd.DisplayModesCollection modes=new Dd.DisplayModesCollection(Dd.GetDisplayModeFlags.StandardVgaModes |
Dd.GetDisplayModeFlags.RefreshRates,null,new Dd.Device(Dd.CreateFlags.Default));
modes.MoveNext();
for (int i=0;i!=modes.Count;i++)
{
Dd.SurfaceDescription desc=(Dd.SurfaceDescription)modes.Current;
Console.WriteLine(desc.Width.ToString() + " * " + desc.Height.ToString() + " "
+ desc.RefreshRate.ToString() + " " + (desc.PixelFormatStructure.AlphaBitDepth).ToString()
+ "bpp");
modes.MoveNext();
}
Console.ReadLine();
}
|
|
|
|
|
Skynyrd:
With regard to the DirectX video card driver interrogation approach, it appears that the aforementioned code provides ALL of the resolutions provided by the end user's video card driver. Would you also kindly write the above code using windows/object code rather than the command console? I would also appreciate it if you would also write the code so that the code provides the "current" screen resolution that was "chosen" by the end user? Both could be very useful for addition to a code library at some point.
Also, what variable would I use to utilize the above code, would I use the variable "modes" and does the variable "modes" contain an array of the screen resolutions, and in what format, since the screen resolution contains the width and the height?
New_Phoenix
|
|
|
|
|