|
Tried searching for any Win32 API's?
|
|
|
|
|
Hi,
I'm overriding the RichTextBox class to add syntax-highlighting functionality (HTML, XML, PHP, C).
So far, I've been very successful. I have a working version with just a few bugs.
The only problem that I've run in to is that when the user opens a file, the process is very
slow. This is because to change the color of the text, I am using the RichTextBox's Select method
to select a range of text, and then setting the field SelectionColor. If I open a file with many lines,
this process takes a few seconds to complete. I notice that when I open a similar file in Visual Studio,
the syntax-highlighting is instantaneous.
So, I was wondering if there's a faster way to change the color of many portions of text in the RichTextBox (without selecting it first).
Is this possible using Windows Messages or Win32 Functions?
Thanks in advance.
DigitalKing
|
|
|
|
|
There are no Win32 or Message functions you can use to speed this up. The problem is that you're using the worst control you can to do this. The RichTextBox does not lend itself well to syntax highlighting. Unfortunately, it's also the easiest to use without writing your own TextBox class to support this.
You may want to do some research by chekcing out these[^] articles to see if you can pick up a faster technique.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have a WSE 3.0 Web service client running inside a Windows Service.
How do I get a X509TokenProvider since SystemAccount doesn't have a CurrentUser
nor LocalMachine certificate store?
Thanks in advance.
Eugenio
|
|
|
|
|
if iam behind firewall and only 80 port connection is allowed for me to access to the outside world in LAN.
How can i get my proxy server ip address programmatically if i don't know what is the ip address or port of my proxy server of the pc iam working on .
Thanks.
Everybody
Human Knowledge belongs to the world.
|
|
|
|
|
|
Can someone recommend a good resource on resolving thread timing issues?
I'm having an issue with a value that doesn't get set "quickly enough" in the debug version, but the release version works nicely.
--
I've killed again, haven't I?
|
|
|
|
|
You have to make sure that the value really is set before you try to use it. To be more specific is hard without knowing anything about what you are trying to do. The problem has nothing to do with timing, though, but the sharing of data between threads. The code shouldn't rely on one thread being ahead of the other, as that is very unpredictable.
Be most grateful that you found this bug already, though. You say that the release version works nicely, but I'm not so sure of that. Perhaps that also fails, only not so often.
---
b { font-weight: normal; }
|
|
|
|
|
I think I can speak for all of us when I say "Huh?"
What do you "timing issue"?
If you're trying to keep two threads in sync, you'll have to use some kind of synchronization mechinism. You absolutely cannot trust that two threads are going to run at exactly the same speed on every machine, let alone run after run on the same machine, or even under slightly differing conditions, like you've already discovered.
Off the top of my head, I'm guessing you'll have to implement some kind of "checkpoint" system, depending on what these threads are doing, where each checkpoint will only release when both threads make it to the same point. The down side of this is a lock condition where a thread waits forever for the other thread to get to the checkpoint, but the other thread has failed and aborted for some reason.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote: What do you "timing issue"?
I speak for myself when I say, "Huh?"
Never mind the unanswered question; I've solved the issue.
--
I've killed again, haven't I?
|
|
|
|
|
Dave Kreskowiak wrote: I think I can speak for all of us when I say "Huh?"
Hits the spot exactly...
You know where this originates from? To my knowledge it's actually a quote from a Buffy the vampire slayer episode...
mav
|
|
|
|
|
Yeah, I realized that after I posted it. A commerical for Buffy reruns came on about a half-hour later!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a form which is "heavy" , it have some pics and rich texts and stuff.
when i run the code "this.Show()" to display it starts drawing the form and the user can see the parts of the form being built.
i try to created it long time before showing it it still dont work.
the form is Borderless and it have a big picture on him with transperent color.
any ideas how to show it quick?
Ran.
R.Z
|
|
|
|
|
There's usually no way to speed things up. Most people who have "heavy" forms are using 100's++ of controls and don't realize that creating a control is an expensive operation. Drawing all of them is also not cheap. The form is not compiled into an .EXE prebuilt with all the controls in place, ready to go. They are created added to the form's Controls collection when the instance of the form is created (calling the its constructor) and the constructor calls the form's InitializeComponents method.
I think the next most common problem is using images that are FAR bigger than they need to be for displaying at a normal resolution. For example, loading a 2,000x2,000 pixel image at 32bbp into a PictureBox that is only sized to 200x200. That's 10 times the image detail being put in a box that will never show it. Reduce the image size, if at all possible, to what is actually going to be shown.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi
well that aint the case.
i do not have over resolution at all. i am using 3 smallpics and 1 piger one and another picture which is all over the form.
but the resolution is normal and i create it long time before showing it.
isnt there some way to tell him to praper the form as picture or something and show it all together..?
Ran.
R.Z
|
|
|
|
|
Nope. You'd be going through the same problem just to get a snapshot of the form. You'd also have to wait until the thing draw the REAL form to get usable controls.
If you're only using a few controls and pics, then what's taking so long? Perhaps a code profile would be in order.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to access a field of a strongly typed dataset (i.e. .xsd)
When I compile, it says: FirstNameColumn inaccessible due to it's protection level.
Where do I check this access level please?
Thanks
|
|
|
|
|
Hello,
I have managed to create an n-tier application which is structured as follows:
1) The database holds the data and contains the stored procedures
2) The datalayer calls the database and retrieves the data as DataSets
3) The WebService calls the datalayer and retrieves the data as DataSets
4) The Business layer calls the web service
5) The user interface which is a windows form, gets the data as datasets from the business and presents it in a DataGrid.
My intention is now to use strongly Typed DataSets i.e. .XSD files in the DataLayer and then use that dataset in the front end eventually.
My question is:
Is it possible to have a strongly typed DataSet in this datalayer or do I have to reference the datalayer from the client using add references. Hope you follow what I mean.
Thanks
|
|
|
|
|
What I'm trying to do is set up a system that can read records from a database and build a form according to the information contained in those records.
I've largely succeeded, but I'm having difficulty setting up a way to set sub-properties.
For demonstration purposes, I will use a concrete example. Let's say I'm trying to set up a label. I want to use database records to set the label's properties. One of the properties I want to set is Font. In the case of Font, there are subproperties, i.e. Bold, Italic, Name, Size, etc. In my example, I want the font to be bold, which means I need to set the Font.Bold subproperty to True.
I've pulled the applicable data from the database into a dataset called dsMyDataSet, set up as follows:
tblTemplateControls
ControlID | ControlType
1 | System.Web.UI.WebControls.Label
tblControlProperties
PropertyID | ControlID | PropertyName | PropertyValue | ParentPropertyID
1 | 1 | Font | NULL | 0
2 | 1 | Bold | True | 1
3 | 1 | Text | Hi, Mom! | 0
Here's the code I'm using:
<br />
for (int n = 0; n < this.dsMyDataSet.Tables["tblTemplateControls"].Rows.Count; n++)<br />
{<br />
dr = this.MyDataSet.Tables["tblTemplateControls"].Rows[n];<br />
<br />
Type myControlType = typeof(Control).Assembly.GetType((string)dr["ControlType"]);<br />
<br />
ConstructorInfo myControlContructor = myControlType.GetConstructor(System.Type.EmptyTypes);<br />
Control myControl = (Control)myControlContructor.Invoke(null);<br />
myControl.ID = Convert.ToString((int)dr["ControlID"]);<br />
<br />
DataRow[] Properties = this.dsMyDataSet.Tables["tblControlProperties"].Select("ControlID = " + myControl.ID);<br />
<br />
for (int j = 0; j < Properties.Length; j++)<br />
{<br />
DataRow Property = Properties[j];<br />
if ((int)Property["ParentPropertyID"] == 0)
{<br />
foreach (PropertyInfo pi in myControlType.GetProperties())<br />
{<br />
if (pi.Name == Property["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi = pi.GetSetMethod();<br />
<br />
string str = Property["PropertyValue"] is DBNull ? "" : Property["PropertyValue"].ToString().Trim();<br />
if (str != "")<br />
{<br />
mi.Invoke(myControl, new object[1] { Convert.ChangeType(str, pi.PropertyType) });<br />
}<br />
<br />
break;<br />
}<br />
}<br />
}<br />
<br />
else <br />
{<br />
DataRow[] ParentProperty = this.dsMyDataSet.Tables["tblControlProperties"].Select("ControlID = " + myControl.ID + " AND PropertyID = " + Property["ParentPropertyID"].ToString());<br />
foreach (PropertyInfo pi in myControlType.GetProperties())<br />
{<br />
if (pi.Name == ParentProperty[0]["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi = pi.GetSetMethod();<br />
<br />
Type myPropertyType = typeof(Control).Assembly.GetType(pi.PropertyType.FullName);<br />
foreach (PropertyInfo pi2 in myPropertyType.GetProperties())<br />
{<br />
if (pi2.Name == Property["PropertyName"].ToString().Trim())<br />
{<br />
MethodInfo mi2 = pi2.GetSetMethod();<br />
string str = Property["PropertyValue"] is DBNull ? "" : Property["PropertyValue"].ToString().Trim();<br />
if (str != "")<br />
{<br />
}<br />
break;<br />
}<br />
}<br />
}<br />
}<br />
}<br />
}<br />
Frankly, I've just started playing with Reflection and Assembly, so there are some gaps in my understanding. Am I even pointing to the right spot? If not, how do I do so?
I am not above changing the structure of my database if that will provide a solution.
Thanks for your help!
|
|
|
|
|
Hi, where can i foud how to implement databinding for new Lisview control windows forms 2.0.
I need to use it in virtual mode?
Thank you!!!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
|
thank you!!!!
Downloading...
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I'd like to aquire the published version number and display it (say, in a label).
How do I go about getting that information?
I've seen a few articles about the AssemblyInfo file however I still don't understand how to get the version values out of that either.
Thanks for the help!
|
|
|
|
|
I've got a small form that takes rankings from a user and submits it into a database. Nothing fantastic or difficult or anything. Anyway, I THEN find out after everything's just about set up that they now want rankings from 1-30 input via text box. They want the data validated so not to any number used more than once.
My question is this: What is the quickest/easiest/most painless way to go about validating all that. Does anyone know where I can find an example? Thanks for any input!
Ken
<---signature--->
Your kid gets into Duke.
You pay the tuition.
That tuition goes into my checking account.
My money in my checking account goes into beer, porn, and other such fun. Thank you
|
|
|
|
|
Hi Ken
Im new to .NET, but not new to coding...
My suggestion:
1. Charge the customer more money for the new feature.
2. Collect all input up front before populating your DB or DataTable Object. Create a collection and use the rankings as keys to populated the collection. If the user tries to reuse a rank, an error will pop, which you can propagate up to the User Interface prompting for a unique unused rank. After everything is filled in, populate the DB from the collection.
- or -
You could just make the rankings part of the DB a unique field or primary key. I think this would also throw a catchable error that you can use to prompt the user to use a new rank.
Not sure how much this helps, I've done something similar in VB6 putting everything in XML, but you didn't leave a lot of details
gl hf,
Pualee
|
|
|
|