|
Thank you!
The problem was my ConvertTo method returned true to string, MyStruct types. So The designer didn't ask me for conversion to "InstanceDescriptor" type.
|
|
|
|
|
I have an image and I'd like to automatically save a particular section of the image that's I've predefined. E.G. 100 pixels right, 200 pixels, 100 pixels width, 200 pixels height.
I'd like to be able to open a tiff file and then auto create a tiff of the particular area of the image.
|
|
|
|
|
Hi,
something like the following should work:
//given: newWidth, newHeight, offsetRight, offsetTop
Bitmap originalBitmap = new Bitmap("C:\\MyTiff.tif");
Bitmap newBitmap = new Bitmap(newWidth, newHeight);
using (Graphics g = Graphics.FromImage(newBitmap) {
Rectangle destRect = new Rectangle(0, 0, newWidth, newHeight);
Rectangle sourceRct = new Rectangle(offsetRight, offsetTop, newWidth, newHeight);
g.DrawImage(originalBitmap, destRect, sourceRect);
}
newBitmap.Save("C:\\MyNewTiff.tif");
Coded from memory without testing so there might be little mistakes in it . But the idea should be clear I hope.
|
|
|
|
|
Thanks. That works great.
|
|
|
|
|
I have a list box control on a web form that displays some data from a database. Each time a different item is selected in this list box I want to display some data in another list box, so I am handeling the SelectedIndexChanged event. My problem is that the event doesn't seem to be firing. This is what I am using:
protected void GroupList_SelectedIndexChanged(object sender, EventArgs e)
{
int index = GroupList.SelectedIndex;
DataRow[] rows = dSet.Tables["Mounts"].Select("Group_Number =" + GroupList.Items[index].Text);
foreach (ListItem item in MountList.Items)
{
MountList.Items.Remove(item);
}
foreach (DataRow row in rows)
{
MountList.Items.Add(row[0].ToString());
}
}
When I run this and select different items in the list box, nothing happens. Any ideas why?
Thanks for any responses
|
|
|
|
|
Possible clauses.
- How you handle the initliazation.
- If its running it on the server this function.
- If this method isnt being added on the specific control.
|
|
|
|
|
What initialization is there to be done?
Sean
|
|
|
|
|
Well, more of the case of Web Forms how you need to check if your reloading those Listboxes again, and if so that whenever you reload the page again, it might reload those items again and reset whatever changes you want in the first place.
Another issue becomes if its stateless or not (meaning does it retain the data when you press on buttons, that go back to the server to process things and spit back out the result on the WebForm that you asked for).
Web Forms are really difficult to determine where your problem is. You need to check how the flow of the web form works, but from hazarding a guess of why nothing is happening is most possibly that you are resetting those listboxes to that nothing is happening.
But this is just guessing, it'd be better with a full code rather than a specific method, but thats your call.
Kuira
|
|
|
|
|
Hi,
How do u stop a button that has been pressed from firing again when the enter/return key is pressed?
(and the answer does NOT seem to be: Put "none" in the form1 "AcceptButton" property ... cuz once the button has been pressed with the mouse, it seems to automatically become the default button that is fired when the enter key is pressed the next time)
Thanks for your time.
IceWater42
|
|
|
|
|
The main problem you encounter is that while focused the control processes key messages and hadles them (ie - you press space or enter the button is pressed).
In order to bypass this you have to inherit the Button class and override it's ProcessCmdKey method. This will allow you to skip some keys you don't want to be processed.
Here's an example :
namespace MyCustomControls
{
public class SpecialButton : Button
{
ArrayList skipTheseKeys;
public SpecialButton()
{
skipTheseKeys = new ArrayList();
skipTheseKeys.Add(Keys.Space);
skipTheseKeys.Add(Keys.Tab);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (skipTheseKeys.Contains(keyData))
return true;
else
return base.ProcessCmdKey(ref msg, keyData);
}
}
}
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
AHA .. i get the idea ... thank you
I added the code in front of my existing namespace but i do not know how to get the compiler to cause the override to be activated. I put a break on the IF statement but it never gets executed, so the problem still exists
|
|
|
|
|
In order to use the custom control I have described earlier you have to Copy/Paste the code I supplied you (ie - the class) and actualy use the control: when you create a button edit the source code and instead of System.Windows.Forms.Button put the Namespace.CustomControlName (int the declaration and initialization of the variables).
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
i assume what u say is right ... but it is like mud to me.
the only place i can find "System.Windows.Forms.Button" is in the generated code ... surely you are NOT suggesting i go into the GENERATED code and change that.
Overrides are VERY confusing to me
|
|
|
|
|
I don't think that there is a law preventing the user from modifing the "generated code".
If you have Visual Studio 2003 the custom control you have made will not apear into the tool box so easy. The simplest thing is to modify what I told you.
On the other hand, if you have Visual Studio 2005 the custom control will apear (or if not, just drag it there) into the tool box. In this case just add the control to your form.
If you still don't understand then search CodeProject for articles about custom controls and read about how to use them.
By the way, overriding has nothing to do with your problem. You override a procedure, a class is inherited.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
thank you, vlad ... it works just as i had hoped
i also found out i was wrong about how the code generator works ... i was under the misbelief that the generated code was regenerated every time that the project was "build"ed ... therefore one should NEVER modify the generated code as that action would have to be remembered and redone every time the program was "build"ed ... apparently, that is not true as i have "rebuild"ed the project several times and the modified code remains as i changed it (as you had advised)
thanks again, vlad ... i have learned a lot
|
|
|
|
|
how to open a word document in web browser in asp.net and c#.net.
Deepak Anish
Computer Programmer
Maxumise Fiji Ltd
Suva, Fiji
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I am a beginner in C#. I wanted to know if there is a simple way of displaying some hyperlinks (clickable) using the MessageBox.Show method?
Thanks in advance for your help.
Manusse
|
|
|
|
|
Usually you would use a LinkLabel instance to create the hyperlink, but the problem lies in the architecture of the MessageBox.Show method. Now if this was a Java forum then I would say you would have no problem displaying a control in the MessageBox, but in .NET only strings can be displayed.
You may be able to get around the problem by using P/Invoke and of the native MessageBox routines. One of them I am sure allows controls to be embedded inside the MessageBox (akin to the Java way). The other route, is to create a message box by extending Form and adding a LinkLabel yourself.
-- modified at 16:41 Sunday 30th April, 2006
|
|
|
|
|
You just create your own form to show your message with hyperlinks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi^^
^^
I want installed product by Window installer.
But I want all installed product in window system.
I refer to System.Management
see below plz^^;;
Vendor
MicrosoftMicrosoft CorporationMicrosoft CorporationMicrosoft CorporationMicrosoftDAEMON'S HOME////DAEMON Tools////3.47.0
Haansoft////한글 2005////6.5.0.824
Microsoft Corporation////WebFldrs XP////9.50.7523
NetSarang Computer, Inc.////Xmanager Enterprise////2.0.0203
Microsoft////Visual J# .NET Redistributable 1.1- Korean Language Pack////1.1.4322
Adobe Systems Incorporated////Adobe Reader 7.0.7 - Korean////7.0.7
Sony Corporation////OpenMG Secure Module////4.4.00.11241
Microsoft////Visual Studio.NET Baseline - Korean////7.1.3091
Microsoft////Microsoft FrontPage Client - Korean////7.00.9209
Microsoft////Microsoft .NET Framework 1.1////1.1.4322
Green Eclipse////StickyPad////2.2.48
Microsoft////Microsoft .NET Framework 1.1 한국어 언어 팩////1.1.4322
Microsoft////MSDN Library for Visual Studio .NET 2003 - Korean////7.38.3095
Press any key to continue
It's not all installed product in window system.
It's installed product by window installer.
( MSDN : Win32_Product - Represents a product as it is installed by Windows Installer. )
help me^^
Have a good time^^
Nothing!! But gonzo!!
-- modified at 14:06 Sunday 30th April, 2006
|
|
|
|
|
I have no clue what you are talking about. You post says nothing about what you are trying to do, what the problem is, or what you need help with.
---
b { font-weight: normal; }
|
|
|
|
|
Looks like I guess what do you want. If you need the list of all applications, officially installed in the system, you'll need to parse system registry key
HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall.
If you need all applications installed and used in the system - it's impossible.
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
thank you for reply^^
I did that you informed.
and I got a information about installed application in system.
void ShowWqlObjectQuery( string winInfo )<br />
{<br />
WqlObjectQuery objectQuery = new WqlObjectQuery("select * from " + winInfo );<br />
ManagementObjectSearcher searcher = new ManagementObjectSearcher( objectQuery );<br />
<br />
foreach( ManagementObject info in searcher.Get() )<br />
{<br />
Console.Write( info["Vendor"] );<br />
Console.Write( "////" + info["Name"]);<br />
Console.WriteLine( "////" + info["Version"] ); <br />
}<br />
}
Nothing!! But gonzo!!
|
|
|
|
|
Hi
I need a code example or an known Object that can count the number of word in a text
eyalso
|
|
|
|