|
So does .NET have any high resolution/accuracy timers for this purpose that I can use?
Using a manual stopwatch is out of the question because that will be waaay to prone for human error.
|
|
|
|
|
This Stopwatch[^]
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Sweet. That was exactly what I was looking for!
|
|
|
|
|
Hi,
i am developing Windows Custom Control. For a property, I am developing a rich Windows GUI property builder. My question is, WILL THE DESIGN TIME GUI CAUSE MORE LOADING TIME FOR THE RUN MODE ?
|
|
|
|
|
HI Guy
may be possbile, becuase of your pc may be slow, and you had add many control in your custom controls. so that's not most issue man in for controls. bescailly u can see this is behaviour in windows GridView control also.
so dont worry do more.
Thanks
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
Hi all,
I want to put some info into a RichTextBox (or whichever other control might serve the purpose better) consisting of different sections. I was hoping to put a horizontal seperator between sections but I'm not sure how to do that. I'm probably missing something very simple here.
I'm thinking of something similar to the tag of HTML. Any ideas?
Thanks in advance
Dewald
|
|
|
|
|
Use SplitContainer then put 2 RichTextBox in each panel.
|
|
|
|
|
Thanks, that would be an idea but I will be adding text (in various sections) at runtime and will not know beforehand how many sections (and horizontal seperators) there will evetually be. So it is important that I am able to add seperators at runtime.
|
|
|
|
|
No, a richtextbox (as it is) cannot be split. But you may have a control, which consists of two richtextboxes and a seperator between them. You may program different interactions between these two controls to give the user the feel that they are one split richtextbox (if you need such thing).
|
|
|
|
|
Thanks, but just to be clear, I'm not looking for a split-line (or whatever you call it) with which the sections can be resized etc. I want to simly draw a horizontal black line across the width of the control and continue with more text under that.
The easiest way would be to add a bunch of underscores or minusses to the textbox but I was hoping for something more elegant.
|
|
|
|
|
Hi,
I have not done this myself, but it sounds like you want a ListBox (great at holding
a number of items of any kind), where each item could be a RichTextBox.
Make it UserDrawn and you can add RTB's as much as you want, they will be layed ou
one below the other, and scrolling will be automatic.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hey, I think you may be on to something. I'll try this out and report back. Thanks.
|
|
|
|
|
Good idea Luc - interesting concept. I can imagine this being extremely usefull in lots of situations.
Dewald - post back if you get it to work (maybe with a little code snippet?). This is going on my todo list for when I get a little time
Dave
|
|
|
|
|
OK, I'm making progress but it's painfully slow. Was hoping someone could give me a nudge in the right direction.
I'm at the point now where I'm trying to paint the RichTextBox in the ListBox (in the DrawItem event of course).
The nearest I've come so far is to use the e.Graphics.DrawImage() method but obtaining an Image of the RichTextBox is proving tricky. I'm sure there has to be a better way than importing the gdi32.dll and bit blasting the control onto an image (as explained here[^]) which is then drawn into the ListBox.
Any ideas?
|
|
|
|
|
Why not use the Web Browser component in edit mode?
|
|
|
|
|
Hi all,
I wish to add line numbers next to a Listview control.
I don't want this line numbers to be the first Listview column, but a different control next to it.
I thought of using a simple Textbox, but I can't find convenient way to synchronize between the Listview lines and the Textbox lines (Height and location).
Does anyone have an idea? Maybe a different control?
Thanks a lot,
Eyal.
|
|
|
|
|
eyalbi007 wrote: I don't want this line numbers to be the first Listview column, but a different control next to it.
This is the efficient way to do this. If you use a separate control, it will be tough to maintain the correct position when list view scrolls.
Create a new control and inherit that from ListView class. Provide option for adding serial number. This allows you to re-use the control.
|
|
|
|
|
Quick question- can I programtically set the value of a custom attribute?
--Here is an example of what I am currently doing and it works--
<br />
[IcVPNPlugin]<br />
public class myVPN : IVPN<br />
{<br />
<br />
<br />
private VPNState _state;<br />
private List<string> _profiles;<br />
private string[] _stringArr;<br />
private string _username;<br />
private string _password;<br />
private string _profile;<br />
private string _profileTest;<br />
<br />
<br />
<br />
public myVPN()<br />
{<br />
_profiles = new List<string>();<br />
GetProfiles();<br />
<br />
<br />
_stringArr = new string[this.Profiles.Count];<br />
for (int i=0; i<=this.Profiles.Count; i++)<br />
{<br />
_stringArr[i] = this.Profiles[i];<br />
}<br />
}<br />
<br />
<br />
<br />
[BrowsableAttribute(true), TypeConverter(typeof(DropdownConverter)), RequiredParameter(false, ParameterType = typeof(String)), DropdownValues(new string[] { "profile list 2-0", "profile list 2-1", "profile list 2-2" }, Name = "ProfileTest")]<br />
public string ProfileTest<br />
{<br />
get { return _profileTest; }<br />
set { _profileTest = value; }<br />
}<br />
...But I would like to programatically set the values of the DropdownValues attribute as such:
<br />
[IcVPNPlugin]<br />
public class myVPN : IVPN<br />
{<br />
<br />
<br />
private VPNState _state;<br />
private List<string> _profiles;<br />
private string[] _stringArr;<br />
private string _username;<br />
private string _password;<br />
private string _profile;<br />
private string _profileTest;<br />
<br />
<br />
<br />
public myVPN()<br />
{<br />
_profiles = new List<string>();<br />
GetProfiles();<br />
<br />
<br />
_stringArr = new string[this.Profiles.Count];<br />
for (int i=0; i<=this.Profiles.Count; i++)<br />
{<br />
_stringArr[i] = this.Profiles[i];<br />
}<br />
}<br />
<br />
<br />
<br />
[BrowsableAttribute(true), TypeConverter(typeof(DropdownConverter)), RequiredParameter(false, ParameterType = typeof(String)), DropdownValues(_stringArr, Name = "ProfileTest")]<br />
public string ProfileTest<br />
{<br />
get { return _profileTest; }<br />
set { _profileTest = value; }<br />
}<br />
Of course this doesn't work- which is why I am posing the question here. Is there any way at all to be able to accomplish this? I am pretty sure that properties are instantiated by the CLR before the contructor. So if that is true, then any work I did in the contructor that would be passed to the attribute would just be too late- which, I think, is why this isn't working. But perhaps a static property could work? Now I am just guessing... Thanks much!
|
|
|
|
|
Yes they are readonly.
You can only set attributes through reflection.emit.
So you can set attribs on classes that you build or inherit by using emit, but thats it.
|
|
|
|
|
In System.Reflection, attributes are read-only.
But System.ComponentModel (which is used by the property grid) allows for filtering and modifying attributes when they are requested, take a look at the ICustomTypeDescriptor interface.
|
|
|
|
|
I need to create code that goes through the array, and for each empty slot, allocate a Student object. You should assign the new object a Student ID number that is the same as the slot in the array (i.e., if slot #7 is blank, create a Student object with ID # 7). You should NOT destroy any existing Student objects
How should I start this assignment.
|
|
|
|
|
Well you could start by reading about arrays.
After reading through that article I would think your assignment would be a breeze.
Mark.
|
|
|
|
|
Honestly, if the material your teacher gave you doesn't give you a starting point, I'd approach some other students to work out if the problem is with you, or with the teacher. If the other students also don't know how to start, approach the teacher. If they do, then follow the advice given before, read your course materials, use google and then take a shot at it.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I know definition of volatile keyword [^] but still couldnt use it anywhere in my application. Not sure if I know where exactly to use it?
What are we trying to achieve indicating a variable as volatile?? How CLR will treat it differently??
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
geekfromindia wrote: What are we trying to achieve indicating a variable as volatile?? How CLR will treat it differently??
When you modify a variable there is often a version of it cached in the processor. Applying the volitile keyword indicates that this optimization should not be used and it must be updated in memory as multiple threads are accessing it. If you update the variable in the processor cache and another thread requests it from memory the the value will be wrong.
|
|
|
|