|
OK, read the article I provided a link to. Then whenever the grid has to move (by user action or timer), change your relevant data values and call Invalidate to get everything repainted.
If everything is linked to a grid, and only part of that is visible, have a Location variable (i.e. a Point with X and Y) that holds the distance from your grid's top left corner to your visible area's top left corner, and offset everything inside your Paint handler by that distance. Graphics.TranslateTransform() could do all that for you.
BTW: if you haven't already, I suggest you make your painting area double-buffered to reduce or avoid flicker.
|
|
|
|
|
|
Please don't delete your questions. Now it's impossible to follow the context of this question, and it could have been something useful to others. You've been a poster long enough to know that you shouldn't be doing this.
|
|
|
|
|
Yes, there already is another guy asking basically the same thing, it is a bit harder now to convince him the subject got handled here.
|
|
|
|
|
how we can make an windows forms with own codes?
tanks!
|
|
|
|
|
Hi,
A bit of a broad answer, but I'm having trouble trying to figure out what you're trying to do, and how.
nasis1 wrote: how we can make an windows forms with own codes?
Using Visual Studio? Start a new project of the type "Windows Application". That should open a new template for a Windows-Application, including a single form that you can edit to your liking.
If you're on a different system, or don't have Visual Studio, you'd create a new project, add the reference to "System.Windows.Forms.dll", add the "using System.Windows.Forms" on top of your file, and then you can declare new forms;
class MyForm: System.Windows.Forms.Form
{
}
static class Program
{
static void Main (String args[])
{
System.Windows.Forms.Application.Run (new MyForm);
}
}
There's a lot of information to be found on MSDN[^], if you scoll halfway the page you'll find some common walkthroughs.
Hope this helps a bit
I are Troll
|
|
|
|
|
The same way you get to Carnegie Hall.
|
|
|
|
|
Take a left at Central Park
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Or was it 3 rights... I can never remembers...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
Ba-doom ching! IThankyaw!
|
|
|
|
|
Write your own API and/or framework -- but I don't recommend it, I suggest you use .net instead.
|
|
|
|
|
How we can make a component ?
I want to make a component whit a classlibrary not with usercontorols?
|
|
|
|
|
Simply write something and call it a component.
|
|
|
|
|
|
No, there's no reason to do that; I can create whatever I like and call it a component. I can have an enum that's a component of my Widget facility.
|
|
|
|
|
|
hi. i can't find the index of items in CheckListBox in my program.
mean's that i write the code like this and i have access to the vales but i can not find their index.
string[] arr;
for (int i = 0; i < CheckedListbox1.Items.Count-1; i++)
{
arr[i] = serviceExtenderList.CheckedItems.ToString();
}
may i ask a little guide for that?
|
|
|
|
|
To get a list of selected items in a CheckedListBox , try something like
foreach(object itemChecked in checkedListBox1.CheckedItems .
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
not sure what it is you are trying, however here are some ideas:
1.
you can't insert elements in an array when the array hasn't been created yet. Maybe you are missing a statement along the lines of: arr=new string[CheckedListbox1.Items.Count];
2.
I wonder why you would store a range of numbers in a string array in the first place. Strings are often abused; the general recommendation is to use actual types, not strings, where ever possible.
3.
A CheckedListbox has some properties that directly identify the checked items; see CheckedItems and CheckedIndices.
4.
Most often a generic list is a handy substitute for an array, as you don't need to set a size at the start, you can just add to it at will.
5.
If you aren't familiar with it yet, make sure you read up on the foreach statement. It works well with arrays and lists alike.
|
|
|
|
|
hi,
everybody,
I would like to get source code for datagridview events.
I have already implemented with datagridview in windows application.
When user enter in datagridview's cell 2 eg, dgvSale["ItemCode"] , I want to set cursor in cell 4(4,CurrentRowIndex).
and then user entry the qty and type enter in cell(4,CurrentRowIndex). Again, I want to set cursor in cell 5(5,CurrentRowIndex)
Please let me know which event is suitable for me.
with regards,
ToeToeAung
|
|
|
|
|
toetoeag wrote: Please let me know which event is suitable for me.
Not an event, but a method that you need. A few, actually;
dataGridView1.CurrentCell.Selected = false;
dataGridView1.Rows[CurrentRowIndex].Cells[4].Selected = true;
dataGridView1.CurrentCell = dataGridView1.SelectedCells[0];
dataGridView1.BeginEdit(false);
Enjoy
I are Troll
|
|
|
|
|
I cannot get my environment variables to return a value in the message box in this example, but it works fine with things like "ipconfig" ... any idea as to why?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string testSession = ExecuteCommandSync("sessionname");
MessageBox.Show(testSession);
}
public string ExecuteCommandSync(object command)
{
try
{
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = false;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
return (result);
}
catch (Exception objException)
{
return("failure");
}
}
}
}
modified on Friday, December 3, 2010 4:50 PM
|
|
|
|
|
Strangely enough when I do this through a console app it works and when the environment variable changes I cannot see the change until I close the program and reopen another instance of it? Then it displays the change in the environment variable. Why is that?
|
|
|
|
|
Where in your code sample are you reading an environement variable? When asking why something is broken, show us the broken thing that is applicable, not some other thing that works fine.
You do understand that each cmd process has its own environment right?
|
|
|
|