|
What i have to use instead of picturebox if i want to show it in a form?
|
|
|
|
|
Just use any inherited Control and override OnPaint of it.
|
|
|
|
|
Where Photoshop or other graphic program draw the image got by all the levels?
It seems a PictureBox.
Anyway i've not idea what i have to do in the OnPaint function?
Could you be more detailed, if you can with a bit of code?
Thanks
|
|
|
|
|
In OnPaint method ,draw the background image ,that is not hard,and then raise a flag to draw the second or first rect :
private bool isFirst = true;
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage(Image.FromFile("img.jpg"));
if (isFirst)
e.Graphics.DrawRectangle();
e.Graphics.DrawRectangle();
}
And you can call OnPaint by Calling Invalidate() ,or Refresh() .
|
|
|
|
|
Do you think is fastly to draw using OnPaint then draw through a Image?
|
|
|
|
|
OK - every paint program surely draws it's images directly onto the Window. This is the fastest way to do it, without a doubt. Handle the OnPaint method, and draw the image onto the Graphics object that is passed in. Your question makes no sense, OnPaint will be faster than a picture box, both require you to have an image you need to draw.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
HI there,
I'm in urgent need to find out the long awaited solution of one small but critical problem. I'm Trying to detect the event when a user any how locks the workstation. i.e. either by Ctrl+Alt+Del or by winkey+L. I need to check the time when user locks the workstation and also when he unlocks the same. Pls. reply ASAP. U can also mail solution to my email address. pathak.tapan@gmail.com
Thanx 4 all your help and consideration to my query.
|
|
|
|
|
How many times are you going to ask the same question in the same day? If you want an answer immediately, your best bet is to do your own research. I spent all of 2 minutes on MSDN finding the function you need to call to register for these notifications, WTSRegisterSessionNotification[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, im trying to allow paging to my datagrid. this is my main function
private void Load() {
datagrid.datasource = Dataset
datagrid.DataBind();
}
AND i add this:
private void datagrid_PageIndexChanged(object source,
DataGridPageChangedEventArgs e)
{
datagrid.CurrentPageIndex = e.NewPageIndex;
Load();
}
BUT ITS NOT WORKING, WHAT AM I MISSING? SHOULD I ADD A HANDLER IN THE INITIALIZE COMPONENT?? THANKS FOR THE HELP
|
|
|
|
|
Your page index is not changing. Try this it should work.
private void Load()
{
if (!Page.IsPostBack) {
Datagrid1.datasource = Dataset;
Datagrid1.DataBind();
}
}
bool isEditing = false;
void DataGrid_Page(object sender, DataGridPageChangedEventArgs e) {
if (!isEditing) {
DataGrid1.EditItemIndex = -1;
DataGrid1.CurrentPageIndex = e.NewPageIndex;
load();
}
}
leo
Kathmandu, Nepal
|
|
|
|
|
I wish to make a button that is shaped prefrabaly to the image i have for the button. The image is a cresent shape and so isnt very easy to draw, ive looked at using paths and regiosn but i dont know anyway of driving one from the image has anyone any surgesions on the direction to take.
Aulternativly their is the posibility of using some direct X but i dont know how easy it would be to use or if it can do what i would like.
Any help would be ace thx
ME.
|
|
|
|
|
Hi,
I am definitely new to .NET and I have purchased Visual C# .NET some time ago. I was wondering if it is possible to build plugin applications, such as Cloudmark or Plaxo for Outlook entirely with Visual C# .NET, as opposed to building COM plugin with MFC and Visual Studio C++ 6.0.
Is there a loss of features doing so? Basically is everything that is possible with Visual Studio C++ 6.0 possible with .NET or are there some limitations.
I am trying to determine if I have to forget about trying to use C# for the purpose of a plugin app and use C++ as before or if it worth using C# and .NET. I would like to avoid trying .NET and realizing that I am better off doing it as before in mid course, but then again, that might be wishfull thinking.
Thanks in advance
YorgZero
|
|
|
|
|
|
Hi everyone,
Could u please help me to code one simple(may be for you) but critical
portion of my project!!. I need to know how do I trace, say detect when
a windows system is being locked?? I need to trap the time and date
when the system is being locked and also when it resumes from the
locked state. This is Urgent. Please reply ASAP.
Thanx a lot 4 taking pain to share this problem with me.
|
|
|
|
|
Hi all
I have a table that contains four attributes (testVersion, qnum, answer, weight).
Now I want to display this table in a datagrid using C#. The user then should be able to change the value of the weight attribute of any record and then that value should be updated in the table. I am using MS Access database.
How can I code it easily?
I hope that u understand my question.
please help me I should finish the project very soooooooooooooooon.
thanks
|
|
|
|
|
I think you have 2 ways to do waht you want :
1) make a button in the corner of the window whitch has the dataGrid that updates the database with the contnets of the grid
or
2) catch every changed row in the dataGrid and update it in the database after the complete change
I would recommand option 1 because when a mistake is made it can be undo.
I hope you know something about asp.net in order to do what I wrote...
ps: when a value is changed in a dataGrid, the dataTable that is the source is modified too.
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
would u provide me the code here. I visited the site but did not find any thing related.
it is better if someone provide me the C# code with the MS Access.
|
|
|
|
|
This is my code to display the table into the datagrid.
private void btnShow_Click(object sender, System.EventArgs e)
{
try
{
//set SQL query
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM KeyAnswers";
//clear dataset
dataSet1.Clear();
//Fill dataset with information
oleDbDataAdapter1.Fill(dataSet1,"KeyAnswers");
//bind datagrid
dataGrid1.SetDataBinding(dataSet1,"KeyAnswers");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally {
}
}
This is when I click the show button.
Now I want to create a "Update" button . what should be the code?
Should I update the whole table wheras only one record has been changed?!!
waitting.....
thanks
|
|
|
|
|
pleasehelp me
|
|
|
|
|
I think that when you click the show button the call of SetDataBindingis is not necesarry.
And at the update you code should look like this :
<br />
private void btnShow_Click(object sender, System.EventArgs e)<br />
{<br />
...<br />
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM KeyAnswers";<br />
<br />
OleDbCommandBuilder cb = new OleDbCommandBuilder(oleDbDataAdapter1);<br />
...<br />
}<br />
<br />
private void btnShow_Click(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
oleDbDataAdapter1.Update(dataSet1,"KeyAnswers");<br />
MessageBox.Show("Changes saved successfully!");<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("There was an error while saving the changes : ex.ToString());<br />
}<br />
<br />
finally {<br />
}<br />
}<br />
PS: my code is not 100% correc in the way i haven't got an .net compiler right now, but that is the algorith you shoul use.
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
I have a C# Class Library Project in VS 2003. How do I import and make use of a .tlb file to that project?
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi every body , from day i have a problem that i can't solve , how i can pass a STRING variable by using a matlab program dll .
The document 1,2,3 ways offer just a double variable
Plz i need it ,
thx
|
|
|
|
|
Not sure at all what you are asking, but if you just need to convert a string to a double try:
double myDbl = double.parse("123.45");
|
|
|
|
|
Hi all,
I'm resizing an image in C# and when I use InterpolationMode.HighQualityBicubic and SmoothingMode.AntiAlias (and many other combinations) I get a 1px wide border all around the image. This is ok for the project I'm working on expect for the bottom border. I have tried to overcome this by drawing the pixel above the bottom border over it, like this:
<br />
for ( int i = 1; i < width; i++ )<br />
{<br />
bitmap.SetPixel( i, height, bitmap.GetPixel( i, height - 1) );<br />
}<br />
where width and height are bitmap.Width and bitmap.Height, respectively.
But I'm obviously missing something since this isn't working. Any ideas?
|
|
|
|
|
Bicubic interpolation uses the values of the surrounding pixels, it's possible the GDI+ implimentation uses the values of the pixels on the other side of the image to interpolate the edges.
You should never use GetPixel/SetPixel unless time is not critical.
Christian Graus - Microsoft MVP - C++
|
|
|
|