|
Hi Nick,
Thanks for the info.
Donal
|
|
|
|
|
How can I disable focus on few buttons?
|
|
|
|
|
Select your button in the form designer.
Switch "Properties" to the "Events"-Mode.
Then scroll to the "Focus"-Section and give some method name for "Enter".
I used "button1_FocusEnter".
This will create an empty method in which you put one line:
someOtherControl.Focus;
You can also prevent users from "tabbing" through your control by setting "TabStop" to false.
With the "coded" solution, the button will never keep focus, the someOtherControl will receive Focus instead.
That will not prevent anyone from pressing that button, though.
If you want users NOT to press a button, disable it.
If you set TabStop to false, the control still gets focused if someone presses it.
If you combine both ways, the button will never KEEP focus, but users can still press it and trigger it and stuff.
Cheers
Sebs
|
|
|
|
|
Great, thank you for beeing patient and explaning me in this way.. thanks 
|
|
|
|
|
Another, perhaps easier way is to create a button that's not selectable per-se.
Create a new class InertButton that inherits Button .
In the c'tor you just add the following line:
SetStyle(ControlStyles.Selectable, false); That's it.
Use this InertButton exactly the same way you would use a regular button.
Regards,
mav
|
|
|
|
|
Thanx mav 
|
|
|
|
|
I would like to set another collor of my buttons if they were disabled.. How can I do it?
Thank You
|
|
|
|
|
Somthing like this:
if(mybutton.Disable)
mybutton.BackColor = Color.Blue;
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
thanks 
|
|
|
|
|
Im trying to support labeledit in my ListView control but
i am stuck on getting the ListViewItem object edited.
In the EventArg to EndLabelEdit there is an Item member
telling which index was edited but how do i get the ListViewItem
from the index?
listView1.Items returns the ListViewItemCollection and according
to the help there should be an Item property there but it
is not there...
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
|
Surely there must be some way of getting the ListViewItem by index without using SendMessage() ?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
If I understand your problem correctly then a simple
ListViewItem theItem = listView1.Items[e.Item]; would be the answer (with e being the LabelEditEventArgs ).
Can it be so simple?
mav
|
|
|
|
|
Hmmm..i was so sure that was the first thing i did try, it is that simple....i better start sleeping at nights.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
i have bound a dataset to a datagrid ...
now ..
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
temp = e.Start.Date;
DateTime dt;
dataGridView1.Update();
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
dt = System.Convert.ToDateTime(dr.Cells[2].Value);
// textBox3.Text = dr.Cells[2].FormattedValue.ToString();
if (dr.Cells[2].Value != null && dt.Date.Month != temp.Month)
// dataGridView1.Rows.Remove(dr);
DataTable1DataConnector.RemoveCurrent();
}
}
what im trying to do here is ... i have a monthcalender object on the form .. and when i change the month ..i want to re-populate the datagridview such that it displays only entries of that month ...
how do i do this ?
here it does del the entries whihc are not of that month .. but doest repopulate again !
|
|
|
|
|
Bind against a DataView instead. You can set the RowFilter which may or may not update the DataSet automatically. If it doesn't, one way is to assign null to the DataGrid and then assign the DataView back. You could also get the CurrencyManager from the BindingContext and call CurrencyManager.Refresh . That would be the preferred method.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello..
Plz can anyone help me how to prevent adding new line to the dataGrid??
Thanks..
Baraa
|
|
|
|
|
You mean setting ReadOnly property.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
No, the user can modify an existing line but he cant add new line..
This is what I mean..
Thanks..
bhshs
|
|
|
|
|
Bind against a DataView instead of a DataSet or DataTable . You can easily create a DataView from a DataTable (just pass the DataTable to the DataView constructor) and then set DataView.AllowNew to false . Set the DataView as the DataGrid.DataSource .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I am doing an application in c# where i have 2 picture boxes.
In the first picture box i open a bitmap.
Then ,when i select a rectangle in this bitmap,the part of the image within the boundaries of the rectangle opens in the second picture box.
I cant actually open the part of the image (within the rectangle) as a separate image in the second picture box.
I used :
g=pictureBox2.CreateGraphics();
ImageAttributes remapAttributes;
ColorMap redToBlue;
redToBlue.oldColor = Color(255, 255, 0, 0);
redToBlue.newColor = Color(255, 0, 0, 255);
remapAttributes.SetRemapTable(1,&redToBlue);
g. DrawImage (globalImage,rect,zoomStart.X,zoomStart.Y,width,height,UnitPixel,remapAttributes,null,null);
but this code is giving many errors although its a copy from the one in the msdn.
please help
|
|
|
|
|
It seems as if you've copied the code from a C++ article, so this cannot work.
Graphics g=pictureBox2.CreateGraphics();
ImageAttributes remapAttributes = new ImageAttributes();
ColorMap redToBlue = new ColorMap();
redToBlue.OldColor = Color.FromArgb(255, 255, 0, 0);
redToBlue.NewColor = Color.FromArgb(255, 0, 0, 255);
remapAttributes.SetRemapTable(new ColorMap[] { redToBlue });
g.DrawImage(pictureBox1.Image,
pictureBox1.ClientRectangle,
0,
0,
pictureBox1.Width,
pictureBox1.Height,
GraphicsUnit.Pixel,
remapAttributes);
This is at least compilable if you have a pictureBox1 and pictureBox2 (and use using System.Drawing.Imaging; at the beginning of your code).
mav
|
|
|
|
|
Hey,
has anybody tried using global hooks with WH_JOURNALRECORD or WH_JOURNALPLAYBACK in c#?
I used the class found at http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/ and it works fine with WH_MOUSE or WH_KEYBOARD (i have modified the code to make system-wide and it works fine).
However, once i set the hook to WH_JOURNALRECORD or WH_JOURNALPLAYBACK the system stops responding (but the mouse still works) and the system only un-freezes when i pres CTRL+ALT+DEL...i also noticed that the journal callback procedure is never called in WH_JOURNALRECORD but it IS called after WH_JOURNALPLAYBACK but ONLY when i press CTRL+ALT+DEL...anybody knows anything about this?
Thanks
|
|
|
|
|
hello guys i have a critical problem.what i want to do
"I have a webform and which has a help button.when i press the help button
the web form must divide in to 2 piece.like 3/4 space for previous content
and 1/4 space for help content.this should exactly look like the help features
in microsoft word. "
so how can i do this and what are the methods that i can use.
|
|
|
|
|
try this:
your web page(test.htm):
<html>
<head>
<title>WebForm1</title>
<script>
function ShowHelp()
{
var height = window.screen.height;
var width = window.screen.width;
var aWidth = width * 3 / 4;
var bWidth = width / 4;
window.moveTo(0,0);
window.resizeTo(aWidth,height);
window.open("Help.htm","Help","top=0,left=" + aWidth + ",height=" + height + ",width=" + bWidth + ",status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
}
</script>
</head>
<body>
<a href="javascript:ShowHelp();">Help</a>
</body>
</html>
your help page(help.htm):
<HTML>
<HEAD>
<title>Help</title>
<script>
function CloseHelp()
{
var height = window.screen.height;
var width = window.screen.width;
window.opener.moveTo(0,0);
window.opener.resizeTo(width,height);
}
</script>
</HEAD>
<body onunload="javascript:CloseHelp();">
</body>
</HTML>
|
|
|
|