|
create simple window application with form, button, label and timer. In button click and timer tick add following code.
private void button1_Click(object sender, System.EventArgs e)
{
this.timer1.Tick += new EventHandler(timer1_Tick);
this.timer1.Interval = 1000;
this.timer1.Start();
}
private int currentSecond = 0;
private void timer1_Tick(object sender, EventArgs e)
{
this.label1.Text = currentSecond++.ToString();
}
Hope this help
Regards
Shajeel
|
|
|
|
|
Yes it helped! Thank you! Now I will have to get the idea!
Christian Graus also helped me to understand something, namely "A timer will never tick until the method that called it ends". I didn't know that! Probably I will have to call a new method inside the while loop to change the Text property of the Label. Thank you both!
|
|
|
|
|
A timer will never tick until the method that called it ends, the tick is another function call that gets added to the list of pending events. It's not a direct function call, even if the time interval is 0. Timers are not that precise.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Really depends on what timer you are using. A UI timer obviously won't fire until the current queue of messages is empty, but System.Threading.Timer and System.Timers.Timer can both potentially fire even before the method that started them ends.
|
|
|
|
|
I want to develop a ActiveX control in c#.Net, that can handle mouse events, like mouse down, enter, leave, drag and drop events. plz guide me, I will be thank you..
|
|
|
|
|
Why do you want to use ActiveX ?
What info did you find on the web ? What further info do you need ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for u r reply, actually I want to draw almost 1 to 2 million rectangles (nodes) on the screen, for this purpose I have checked many controls but they don’t support such ability. Now I have decided to use C# drawing library. For this purpose I need a light weight object that can be drawn to the screen and manage mouse handling as well. I think ActiveX can help me in this regards. Plz guide me or if u knows any batter solution plz let me know. Thanks a lot.
|
|
|
|
|
ActiveX is a worthless layer of complexity. 1-2 million nodes is a lot, you will have to be careful to handle it correctly. How do you expect to display that many nodes ? Will your control be scrollable ?
Just writing a C# control will give you as much power as C# is going to give you, without the hassle of a ( potentially useless ) ActiveX layer.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Actually I want to give a full picture of entire business at one quick look. So I have to draw the entire nodes. And yea, my control will be scrollable. If you have any batter idea to perform such a scenario plz let me know. In my point of view I should go towards the c# library and handle all the mouse events by myself. What you suggest.
Thank you.
|
|
|
|
|
faheem424 wrote: In my point of view I should go towards the c# library and handle all the mouse events by myself. What you suggest.
Thank you.
Yes, that seems reasonable. The only thing that you don't need, is ActiveX.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
code for creating toolbox
|
|
|
|
|
IS this a question ? What do you mean by a toolbox ? What have you done already ? Where are you stuck ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi!
i m developing EMail client in C# asp.net web application using kerio mail server.
I have sent and received emails using SMTP and POP3 dlls.But i dont know how to add new user of particular domain on my server using c#.
Plz reply soon
thanx
|
|
|
|
|
Please stop cross posting.
---
single minded; short sighted; long gone;
|
|
|
|
|
Is it possible to create new Visualization for Windows Media Player (or winamp) using C#?
Do you know of any article or tutorials? Thanks a lot in advance.
|
|
|
|
|
Hi, I'm wondering how I can ensure a cursor(I'm referring to the IBeam cursor) doesn't appear in a textbox. What I want to do is use a textbox to display some message but I dont want any cursors showing up in it.
Thanks
|
|
|
|
|
if the requirement is such that the user need not enter any data in the textbox, then make the enable property of the textbox to false.
Gautham
|
|
|
|
|
The other reply is on track, but better make the control read only (the ReadOnly property). The user will be able to scroll and the text will appear black (instead of gray), but it will not be editable.
|
|
|
|
|
Setting the textbox enable property to false leave is a faded colour making text hard mopre difficult to read. I've used the Read-Only property however I don't want the user to be able to select the text if that's possible.
Thanks
|
|
|
|
|
Hi !
I'm using Visual Studio 2005 Professional Edition and C#.
I have a simple question:
I want to add to my form, which is a scrollable control, a menustrip and
statusstrip.
The problem is that the menustrip is not fixed at top if i scroll down.
A similar problem exists also for the statusstrip. If i open the program it
is only visible if i scroll down.
The program thinks that the menustrip and the statusstrip are in the Client
region, to which i want to draw something.
So, how can I fix them, so that they are not get lost if i scroll the main
form up or down ?
--
Schwammkopf
PS: The AutoScrollMinSize is set to (ClientSize.Width + 50,
ClientSize.Height + 50). Of course, on each OnPaint i update it.
|
|
|
|
|
In your form you should put a ToolStripContainer, with your MenuStrip at the top and your StatusStrip at the bottom. Then you add your scrollable control in the middle/center of this ToolStripContainer.
Internet - the worlds biggest dictionary
|
|
|
|
|
well, the problem is that my main form is a scrollable control. and i can put it in the container.
besides, how is possible to let the container take the size of the main form if someone resize the mainform ?
|
|
|
|
|
I suppose you have to change it then? Instead of creating a scrollable form, you create a scrollable UserControl, which you can put in any container.
Internet - the worlds biggest dictionary
|
|
|
|
|
Hi All,I'm working on a control derived from UserControl class.
By Default UserControl Class have 6 glyphs for Resizing around the canvas rectangle.
X-----X-----X
| |
X X
| |
X-----X-----X
I marked them with an "X" for an immediate reference.
I need to override them for changing the color of the extreme four:
X-----------X
| |
| |
| |
X-----------X
when a selection rectangle include one of them,two,three or all four,It should become red.
(For sure,if someone knows how override color,will be easy to override the shape(a GraphicPath instead of little rectangles maybe....))
But I cannot Find litterally ANYONE who knows how I can access to adorners and behaviorservice
properties of the Adorners/Glyphs of UserControl Class in .NET 2.0.
Please,it's a week I dig around,Help me!
Thanks So Much!
Frank Drebin
|
|
|
|
|
I have XML file embedded in my C# Winforms application.
I need to add data to <pre><ConnectString></ConnectString></pre>
element so it looks like
<pre><ConnectString>database=mydb;server=localhost;user=myuser</ConnectString></pre>
and return it as string. I created the following method.
Which XmlDocument function I should use to add data to ConnectString node ?
<pre>string GetDefaultReport(string connectionString) {
Stream stream = GetType().Assembly.GetManifestResourceStream
("mynamespace.DefaultReport.xml");
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(stream);
// todo: replace <ConnectString></ConnectString>
// with <ConnectString> connectionString value </ConnectString>
return xmlDocument.InnerXml;
}<pre>
xml file looks as follows:
<pre><?xml version='1.0' encoding='utf-8'?>
<Report xmlns='http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition'
xmlns:rd='http://schemas.microsoft.com/SQLServer/reporting/reportdesigner'>
<DataElementStyle>ElementNormal</DataElementStyle>
<RightMargin>0.25in</RightMargin>
<Body>
<ReportItems>
<List Name='list1'>
<DataInstanceName>Row</DataInstanceName>
<NoRows>Selliseid andmeid pole</NoRows>
<Style />
<DataSetName>Data</DataSetName>
<ReportItems>
<Textbox Name='Algus'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>1</ZIndex>
<CanGrow>false</CanGrow>
<Value>=Fields!akuupaev</Value>
<Width>1in</Width>
<Height>14pt</Height>
</Textbox>
<Textbox Name='Lõpp'>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<Left>1.5in</Left>
<Width>1.5in</Width>
<Height>14pt</Height>
<CanGrow>false</CanGrow>
<Value>=Fields!lkuupaev</Value>
</Textbox>
</ReportItems>
</List>
</ReportItems>
<Style />
<Height>0.25in</Height>
<ColumnSpacing>0.25in</ColumnSpacing>
<Columns>1</Columns>
</Body>
<TopMargin>0.5in</TopMargin><DataSources>
<DataSource Name='DS1'>
<ConnectionProperties>
<DataProvider>PostgreSQL</DataProvider>
<ConnectString></ConnectString>
</ConnectionProperties>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name='Data'>
<Query> <DataSourceName>DS1</DataSourceName>
<CommandText>SELECT akuupaev,lkuupaev FROM {1}.kontekst</CommandText>
</Query>
<Fields>
<Field Name='akuupaev'>
<DataField>akuupaev</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name='lkuupaev'>
<DataField>lkuupaev</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
</Fields>
</DataSet>
</DataSets>
<LeftMargin>0.25in</LeftMargin>
<BottomMargin>0.5in</BottomMargin>
<Width>2.5in</Width>
<PageHeader>
<Height>22.8pt</Height>
<ReportItems>
<Textbox Name='lehepealkiri'>
<Height>12pt</Height>
<Width>5in</Width>
<Value>{2}</Value>
<Left>30.9pt</Left>
<Top>5.8pt</Top>
</Textbox>
</ReportItems>
<PrintOnFirstPage >true</PrintOnFirstPage>
<PrintOnLastPage >true</PrintOnLastPage>
</PageHeader>
<PageFooter>
<Height>0pt</Height>
</PageFooter>
</Report>
</pre>
-- modified at 18:56 Monday 12th February, 2007
Andrus
|
|
|
|