|
Use a filtered UI Type Editor:
...
using System.Drawing.Design;
using System.Windows.Forms.Design;
...
internal class MyFileNameEditor : FileNameEditor
{
protected override void InitializeDialog(OpenFileDialog openFileDialog)
{
base.InitializeDialog (openFileDialog);
openFileDialog.Filter = "JPEG Files (*.jpg)|*.jpg|All Files (*.*)|*.*";
}
}
...
[EditorAttribute(typeof(MyFileNameEditor), typeof(UITypeEditor))]
public string PictureBoxBackgroundImage
{
get { return m_bgImagePath; }
set
{
m_bgImagePath = value;
Image bgImage = Image.FromFile(m_bgImagePath);
this.thePictureBox.BackgroundImage = bgImage;
}
}
--
I've killed again, haven't I?
|
|
|
|
|
very very tnx! sorry if i've not answer you before.
|
|
|
|
|
Hi..
I want to use the CmdLoadFromResource() method of ths speech SDK 5.1 to make the xml file that includes the Grammar embeded but i dont know how to use this method in C#.
This code shows how i used this method:
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern long LoadLibrary(string lpLibFileName);
private void button2_Click(object sender, System.EventArgs e)
{
this.objRecoContext = new SpSharedRecoContext();
this.objRecoContext.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(RecoContext_Recognition);
this.objRecoContext.State=SpeechRecoContextState.SRCS_Enabled;
grammar = objRecoContext.CreateGrammar(0);
int hModule=Convert.ToInt32(LoadLibrary("ReviewWinApp.dll"));
int langID=409;
grammar.CmdLoadFromResource(hModule,"tryRecog.xml","CFGGRAMMAR",langID,SpeechLoadOption.SLODynamic);
grammar.State=SpeechGrammarState.SGSEnabled;
grammar.CmdSetRuleIdState(1,SpeechRuleState.SGDSActive);
}
When i click this button i got the error:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in ReviewWinApp.exe
Additional information: The specified resource type cannot be found in the image file.
Could any one give me a C# code sample for using this method?
For along time no one answered my question in several forums in several websites !
I thought that a lot of people have used Speech sdk5.1 ?!
|
|
|
|
|
I'm going to do a very very small painting program where I will load a picture on some kind of panel (I already managed that with a PictureBox). Then I will also let the user do a very trivial lines on the pictures. I have also managed that with:
Graphics g = pictureBox1.CreateGraphics();
My problem comes when I want to save the picture with the users paintings…
I manage to save the picture like this:
Image image = pictureBox1.Image;<br />
image.Save("C:\\bitmap.bmp", Imaging.ImageFormat.Bmp);
But I do not get the users painting saved…?
All tips are welcomed!!
_____________________________
...and justice for all
APe
|
|
|
|
|
Drawing onto a control via a Graphics object does not affect the image object displayed by that control. You will need to get a Graphics object for the Bitmap (via the Graphics.FromImage method) and draw whatever lines the user creates onto the in-memory image. Then, and only then, will the actual bitmap object be modified.
Josh
|
|
|
|
|
Can anybody tell what are the important and frequently used design patterns in C# solutions (projects or products)
santosh
|
|
|
|
|
|
sorry the message heading should be "Important design partterns in C# solutions". I just want to know, what are the regularly used Design patterns in C#, so that i can upgrade knowledge related to those patterns
santosh
|
|
|
|
|
kumar.bs wrote: sorry the message heading should be "Important design partterns in C# solutions"
Microsoft patterns & practices are Microsoft's recommendations for how to
design, develop, deploy, and operate architecturally sound applications for
the Microsoft application platform.
Sounds pretty important to me, but what do i know right?
Getting Started[^]
I know for me two of the most important patterns are:
1) Using Web Search Technology
2) Reading
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
mike, thanks for you replies. Thing is that, i don't know for what type of classes or situation what type pattern need to be implemented. So, when you ask me "what classes are you using?" for this i don't have right answer, i mean, i am not doing any hi-fi coding. But trying to explore what type of class needs what type of pattern.
santosh
|
|
|
|
|
That is why I sent you there. It seemed like you could use some bootstrapping on the subject. Sometimes the answers one is looking for cannot be supplied as simply as Do (A) then do (B). Rather they require a contextual understanding before focusing in on a detailed level.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
The textbox controll doesn't get Paint event, so how can i draw over it?
|
|
|
|
|
Add this string to TextBox constructor:
<br />
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);<br />
Best regards, Alexey.
|
|
|
|
|
yes but where is the textbox Paint event?
|
|
|
|
|
In TextBoxBase class.
Best regards, Alexey.
|
|
|
|
|
I have a listview control on a windows form, that is populated with data from the database. How do I ensure that the scrollbars of the listview are always visible, even when the contents are smaller than the control size. If any code could be provided, this would be appreciated.
Thanks in advanced.
listview scrollbar
|
|
|
|
|
I want to use a .vb file in my c# project. Is that allowed? I added one and it does compile, but I don't know how to access the methods in the .vb file.
Can someone tell me if what I'm trying to do is even possible?
Thanks
Joe
|
|
|
|
|
Put the vb files in a seperate project in your solution and compile them as a seperate dll. Add a reference in your c# project to the vb project and you should be able to use all the classes in the vb project.
|
|
|
|
|
Wjousts option is a good one, but another option is to convert the VB file to C#. Google on VB to C# converters and find one you like (we have one also).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
Thanks for the input. I went with the option to compile the vb code as a DLL. The reason I chose this option is that the code is used to generate a unique hash and I don't trust a code converter to produce the exact data structures used in the vb code. I'm probably just being paranoid though
|
|
|
|
|
My program reads ID3v1.1 tags from an mp3 file. It works fine except that the 'whitespace' padding between tags is also saved, and I can't figure out an easy way to get rid of them. I was using the .Trim method, but it is not working. I loaded up the mp3 file in a hex editor and found that the whitespace is saved as '00', while a 'space' character (like you get from the spacebar) is saved as '20' and this is probably what the .Trim method is trying to get rid of. Is there an easy way to remove all '00' characters from a string? If I display the string in, for example, a label, they are not shown, however, they are definitely stored there as looking at it in a propertygrid shows.
Thanks for the help.
|
|
|
|
|
Have you tried this?
String delimiters = " \0";
tag = tag.Trim(delimiters.ToCharArray());
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Just tried it and it works perfectly. Thanks a lot!
|
|
|
|
|
Or simply:
tag = tag.Trim(' ','\0');
---
b { font-weight: normal; }
|
|
|
|
|
Hi everybody,
I'm trying to make the bindingnavigator work but I could not find documentation or examples. I want to bind the bindingnavigator to the rows of my datagridview. If this might not be possible via databinding an example of another way would be more than welcome.
Loads of thanks for your assistance,
Elvia
|
|
|
|