|
Hi,
It is a Windows form control
Web design and hosting
http://www.kayess.com.au
|
|
|
|
|
|
In your form class after you added the grid to the form add:
DataGridColoredRowColumn aTextColumn;<br />
for (int i = 1; i < numColumns; i++) {<br />
aTextColumn = new DataGridColoredRowBoxColumn ();}<br />
<br />
this.datagridStyle.GridColumnStyles.Add(aTextColumn);<br />
<br />
Add a new class DataGridColoredRowBoxColumn, in which you will override the paint method.
<br />
public class DataGridColoredRowBoxColumn : DataGridTextBoxColumn <br />
{<br />
<br />
protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight) <br />
{ <br />
try { <br />
object o = this.GetColumnValueAtRow(source, rowNum);<br />
if( o!= null) { <br />
string str = (string)o;<br />
if (str == "WHATEVER YOU COMPARE TOO") {<br />
backBrush = new SolidBrush(Color.Pink); <br />
} <br />
} <br />
catch (Exception) {}<br />
finally {<br />
base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); }<br />
<br />
} <br />
<br />
<br />
}<br />
|
|
|
|
|
I'm not sure if this is the forum to post this question, but I would be very appreciative if someone could point me in the right direction.
I'm using Managed DirectX (August 2005 update) to draw 3d graphics using C# as the base language. I'm learning as I go (as usual -- hehe ) and I can't figure out how to do something.
I need to be able to copy the contents of a directX window to the clipboard. When I was using OpenGL, I would get the data into a .NET Bitmap object (by copying pixels over into the BitmapData) and then copy that bitmap object to the clipboard. I can't seem to be able to wrap my head around this concept in DirectX, though...if it's even possible. I've discovered how to save a screenshot to a .bmp file (using the Surface object), but haven't been able to find anything about the clipboard.
Is there a way to get the screenshot into a .NET Bitmap object from DirectX? Has anyone ever done this before?
Thanks for your help.
Erica
|
|
|
|
|
Is there a way to enable auto-increment version on build? I'm talking about the visual c# 2005 express edition beta 2
IM PROUD TO BE A GMAIL;
|
|
|
|
|
I don't believe so, I store the version number in the app settings and run a post build step to increment it for my app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes, in your AssemblyInfo.cs file, include the following:
[assembly: AssemblyVersion("1.0.*")]
|
|
|
|
|
I want my program to read in an HTML file on the internet into a string, how do i go about doing this?
Thanks in advance,
RWSTF.
|
|
|
|
|
1.Download the file. Look up for this HttpWebRequest, or WebClient in MSDN (WebClient is somewhat easier to use for the first time). If you dont know, also look up HTTP communication
2.Save the the downloaded string into a text file, look up IO e.g.: StreamWriter
Peter Molnar
|
|
|
|
|
Hello gurus,
I'd like to know how to avoid an application closing when calculations are being performed?
I tried to trap the Closing event and set the e.Cancel to false , but it quits anyway
<br />
private void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)<br />
{<br />
if (_permuting)<br />
e.Cancel=!_permuting;<br />
}<br />
Thanks for the help.
There is no spoon.
|
|
|
|
|
What is "closing" your app? How do you know your catching the right method? What about Application.Exit()????
/\ |_ E X E GG
|
|
|
|
|
This is a multithreading issue.
1.Spawn a worker thread with the the long calculation
Thread m_Thread;
...
m_Thread = new Thread(new ThreadStart(MyLongCalculationFunction));
m_Thread.Start();
2.In your Form_Closing handler check the thread state
if (m_Thread.ThreadState == ThreadState.Running) ...
If running, dont let the dialog close by giving
e.Cancel = true;
Peter Molnar
|
|
|
|
|
private DateTimePicker dtp1;
private DateTimePicker dtp2;
//Assumptions:
// both these instance of DateTimePicker showing time in Custom format that is hh:mm tt
//dtp2 is always greater or equal to dtp1
//when i calculate timeSpan(Difference) between these tow instances' values the the expected(requird) and actual result is as follows;
dtp1============dtp2============dtp2-dtp1(Actual)=======Dtp2-dtp1(Required)
07:15PM=========07:15PM=========00:00:00===============00:00
07:15PM=========11:05PM=========03:50:00===============03:50
07:15PM=========12:05AM========-19:10:00(-ve)===========04:50
08:00PM=========08:00AM========-12:00:00(-ve)===========12:00
Please help me how to solve this problem to get the required output
|
|
|
|
|
if ((dtp2-dtp1) <0)
return (dtp2-dtp1);
else return (dtp1-dtp2)
-- modified at 15:02 Wednesday 21st September, 2005
The reason for the negatives is that since you're not including a day, 12:05am is regarded as the begining of day1, not the start of day2.
|
|
|
|
|
My app will be placed on a touch panel LCD. I need to be able to fire the ContextMenu from a simple button control placed on the form. Traditionally, the user would right click to pull this menu up. however, I need it to do that as well as from a button. Thanks.
|
|
|
|
|
|
I've got a file with windows-1256 encoding. Would you tell me how I can read such file character by character? I don't want to read whole the file at once, it's important to read it character by character. But I don't know how to read a file with such encoding?!
Thank in advance!
|
|
|
|
|
Something like this should work:
string myFile = "";
System.Text.Encoding enc = System.Text.Encoding.GetEncoding(1256);
System.IO.Stream stream = System.IO.File.OpenRead(myFile);
System.IO.BinaryReader reader = new System.IO.BinaryReader(stream);
byte myByte; char myChar;
while(reader.PeekChar() != -1)
{
myByte = reader.ReadByte();
myChar = enc.GetChars(new byte[] {myByte})[0];
}
So basically, you're getting an Encoding object, passing in 1256 as the codepage. Then, reading each byte in from the stream one at a time, you're using the GetChars method to convert each byte and then grab a char from it. Hope that helps.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
Thank you David! It helped!
|
|
|
|
|
Hi,
I'm a little confused about the datatable/dataview thing. I have a datatable (tCat) in a datagrid. I have a column (the primary key column) called file and a column called Customer (among other columns). Each record has it's own unique file number (in the file column), so that when the user clicks on a customer, the entire row is highlighted and the file number is recorded. My problem arises when a column other than File is sorted. I do the sort programatically, then try to re-select the file that was highlighted previous to the sort. But I can't figure out how to find the row index containing the integer (xFile) in the File column while the Customer column is sorted. Is it possible to have the tCat.DefaultView.Sort or DataView Sort set in one column while searching another?
Here, the table is first in Customer ascending order. After the sort to Customer DESC occurs I say:
tCat.DefaultView.Sort = "Customer DESC";
DataView dv = new DataView(tCat);
dv.Sort = "File";
row = dv.Find(xFile);
dg.Select(row);
Here, instead of finding the row that contains xFile, the xFileth row is highlighted.
I've also tried things like:
tCat.DefaultView.Sort = "File";
int xRow = tCat.DefaultView.Find("xFile");
dg.Select(xRow);
which results in what's on the screen being sorted by file order and the xFileth file highlighted.
This:
tCat.DefaultView.Sort = "Customer ASC";
int xRow = tCat.DefaultView.Find(xFile);
dg.Select(xRow);
results in an error (index = -1) since it searches the Customer column.
After days of trying to get this to work, I'm completely exhausted. Can anyone explain what I need to do to get this working?
Thanks so much!!!!!!!
Mel
|
|
|
|
|
It is frustrating that there isn't an easier way to do this, but what I've been doing is storing the last selected row (a reference to the actual DataRow object, not the row number) in the CurrentCellChanged event:
<br />
private void MyDataGrid_CurrentCellChanged(object sender, EventArgs e)<br />
{<br />
currentRow = MyDataView[MyDataGrid.CurrentCell.RowNumber].Row;<br />
}<br />
And then in the ListChanged event I search the newly sorted list and find the same row again:
<br />
private void MyDataView_ListChanged(object sender, ListChangedEventArgs e)<br />
{<br />
if (currentRow != null)<br />
{<br />
for (int i=0; i<MyDataView.Count; i++)<br />
{<br />
if (currentRow == MyDataView[i].Row)<br />
{<br />
MyDataGrid.CurrentRowIndex = i;<br />
break;<br />
}<br />
}<br />
}<br />
}<br />
Seems rather inefficient, but it does work for me.
|
|
|
|
|
You're wonderful! Thanks so much!!!
Mel
|
|
|
|
|
Hello im very new here and thought this was a great website/forum to help me with my very fustrating question. I have 3 drop down boxes (example,stage1,stage2 ID's) a Add button(btnadd) and a label(lbldesc). The drop down box are arrays with multiple selections.. example...
The dropdown boxes and selection:
[example] [stage1] [stage2]
1st selection [nike] [$100]
[shoe] [shoe 2] [$200] [Add]
[shoe 3] [300]
so on and so forth..
let say I choose Shoe Nike that cost 100.00
I have the Add button(btnadd) to post to the label on a form on the SAME page.
Form below the dropdownbox
description | Price
---------------------------------------------------
Shoe Nike | 100.00
(cmbostate + stage 2) | (stage 3)
---------------------------------------------------
Total |100.00
what is the easiest way to do this?
here is some snippets of code that i took off my source.
the event:
public void Page_Load(Object sender, EventArgs E) {
}
void btnAdd_Click(object sender, EventArgs e) {
lbldesc.Text = cmbostate.Text; (Ill put the rest of the code was just trying to see if it worked with the first dropdownbox)
}
my "add button":
<asp:button id="btnAdd" text="Add" runat="server" onclick="btnadd_Click">
my "label":
<asp:label id="lbldesc" runat="server">
my combo box:
cmbostate, stage 2, stage 3
i get a strange error telling me that:
error CS0246: The type or namespace name 'cmbostate' could not be found.
Anyone who can help me is greatly appreciated. Thanks!
|
|
|
|
|
Hello,
Is there a way of changing the font property for a specific Column in my DataGrid?
Thank you.
|
|
|
|
|
if u have given colulmnstyles, then u could jus give the font as wotever u want
like,
textColumnStyle.TextBox.Font = new Font("times New Roman",12,FontStyle.Italic);
|
|
|
|