|
I need to put toolbar item to my windows application to make the selected text subscript or when it pressed , typed letters or numbers will be subscript.
I searched more about this topic on the net but I can only find some this:
myRichTextBox.ToolbarLayout = "bold,superscript,subscript";
but doesnt work there is no option in the Richtextbox class like "ToolbarLayout"...
any help..I would be glad...thanks
|
|
|
|
|
Unfortunately, MS didn't expose all the functions of the RichText control for .NET.
You can do something like richTextBox1.SelectionBold = true but there's no such thing as richTextBox1.SelectionSubScript = true
But since the .NET RichTextBox in fact just wraps the Win32 RichEdit control you can use the structs and messages for this control to achieve subscript, superscript, various underline styles and so on.
Take a look at this article here, I've added something similar to the RichTextBoxEx class already (look towards the end of the article).
This can be easily modified to add subscript/superscript formatting for a selected range od text.
Regards,
mav
|
|
|
|
|
first of all , thanks mav , this is the second time you saved my life
I've read the article...I know I ll take a look at this article in the future a lot...it will help me the modify RTB's class properties...
I found something like that after I've read the article you prefered.
richTextBox1.SelectedText = "10";
// Set the CharOffset to display superscript text.
richTextBox1.SelectionCharOffset = 10;
// Set the superscripted text.
richTextBox1.SelectedText = "2";
// Reset the CharOffset to display text at the baseline.
richTextBox1.SelectionCharOffset = 0;
This is the article
And another article I've found , it's here
I'll check them and try , if they doesnt work...I 'll try modifying the class.
Thanks for your help again...
Regards,
Brown Jacket
|
|
|
|
|
I've downloaded an ActiveX component and attempted to create an object of a type contained in the component. However, in using the following line of code
/cm11a.controlcmClass x10 = new cm11a.controlcmClass();
I receive the error:
'cm11a.controlcmClass.controlcmClass()' is inaccessible due to its protection level
The class is declared as public and no alternative constructors are available.
I've also tried:
<br />
Type type=Type.GetType("cm11a.controlcmClass",false,true);<br />
object x10= Activator.CreateInstance(type);<br />
((cm11a.controlcmClass)(x10)).Init();<br />
but get an exception on the 2nd line as type is null (ie the "GetType" call failed).
Any ideas or suggestions on getting either method to work would be greatly appreciated.
Thanks
Ashley
PS If anyone knows of a library which can be used to control a CM12 interface I'd love to hear of it
|
|
|
|
|
please tell me how to do dictionary in C# (in Console Application and Windows Application.
thank you.
|
|
|
|
|
ala`a ali wrote:
please tell me how to do dictionary
What does this mean?
Do you mean to ask how to use one of the following classes: System.Collections.DictionaryBase , System.Collections.Specialized.ListDictionary , System.Collections.SpecializedHybridDictionary or System.Collections.Specialized.StringDictionary .
Or do you mean to ask how to implement a natural language dictionary, like the Oxford English Dictionary?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
i wanna to use the following code to get
hte system imagelist ,but it doesn't works well,the iconCount always equal 5,and so
i can't get the correct imagelist;
[DllImport("comctl32.dll")]
private static extern int ImageList_GetImageCount( IntPtr himl );
public static ImageList GetSystemImagelist(bool isSmall , bool isSelected )
{
SHFILEINFO info = new SHFILEINFO(true);
int cbInfo = Marshal.SizeOf(info);
SHGFI flags = SHGFI.SHGFI_SYSICONINDEX;
SHIL size ;
if(isSmall == true)
flags |= SHGFI.SHGFI_SMALLICON;
else
flags |= SHGFI.SHGFI_ICON;
if(isSelected == true)
flags |= SHGFI.SHGFI_OPENICON;
ImageList imageList = new ImageList();
IntPtr imageHandle = SHGetFileInfo("C:\\",0,out info, (uint)cbInfo,flags);
IntPtr iconHandle = IntPtr.Zero;
int iconCount = ImageList_GetImageCount(imageHandle);
for (int i = 0; i < iconCount; i++)
{
iconHandle = ImageList_GetIcon(imageHandle, i, 0);
imageList.Images.Add (Icon.FromHandle(iconHandle));
}
return imageList;
}
|
|
|
|
|
in visual c++ ,we can do it by the following
code:
void GetSystemImageList(CImageList * pSmallList, CImageList * pLargeList)
{
SHFILEINFO ssfi, lsfi;
HIMAGELIST hSystemSmallImageList = (HIMAGELIST)
::SHGetFileInfo((LPCTSTR)_T("C:\\"), 0, &ssfi,sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
pSmallList->Attach(hSystemSmallImageList);
HIMAGELIST hSystemLargeImageList = (HIMAGELIST)::SHGetFileInfo((LPCTSTR)_T("C:\\"), 0,&lsfi,sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_ICON);
pLargeList->Attach(hSystemLargeImageList);
}
but i dont'know how to get it in c#.
|
|
|
|
|
|
Hi everyone
i am trying to code a program that should be able to play videos besides other features.
I thought it would be easiest to accomplish the task by just integrating the Windows Media Player-COM-Object, but i couldn't get the controls to disappear (i want my own user-interface..). I read about mediaplayer-integration in a book called 'Advanced C# Programming' by Paul Kimmel. But he seemed to use a different com-object and the demo-app to that chapter doesn't compile (can't find the reference to AxMediaPlayer). The only COM-object i found, that looks like it has really something to do with the mediaplayer is this: AxWMPLib.AxWindowsMediaPlayer. But with this one i get these nasty mediaplayer-controls that i can't get rid of.
Can anybody help me with this, or does somebody know a better solution?
thanks in advance
|
|
|
|
|
i just downloaded the media player 9 SDK and tried to compile the c#-sample (named tune-clipper). As written i registered the wmppia.dll with regasm.exe and installed it with gacutil.exe (Global Assembly Cache Utility). This seemed to be successful. But as i tried to compile the tuneclipper i stumbled accross compile-errors (actually 18 of the same kind):
D:\dev\SDKs\WMSDK\WMPSDK9\samples\dotNet\csharp\Form1.cs(689): 'AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer' does not contain a definition for 'controls'
I get this one when a call to Player.controls.xxx is made. Player is defined as 'private AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer'. Player.controls seems to be undefined.. very strange.. (i guess Microsoft-code is supposed to run..)
Does anybody know a way out?
|
|
|
|
|
I'm not sure but I think the you may use the property 'uiMode'. Valid values are "none", "mini", and "full"... eg...
wmp1.uiMode = "none";
Also.. If you don't want the context menu for the Windows Media Control , use
wmp1.enableContextMenu = false; // true to turn it back on
Hope that helps..
Yippee Kai Yai
Signed Polomint.......
|
|
|
|
|
Yup, thanks.
does your mediaplayer have the 'controls'-property?
As i wrote, mine somehow doesn't. Without it i can't really control media-files. All the play-, stop- and pause-methods are in there.
|
|
|
|
|
I've just checked for the controls property and I do have it.
wmp.Controls( int index );
I assume that the index is the index of the play/pause controls etc.
Are you using Visual Studio? I use VS2003, and all I do is add the Windows Media Player COM component to the toolbox, then use it.
HTH
John
|
|
|
|
|
Damn, my post was hijacked by Anonymous !!!!
I've just checked for the controls property and I do have it.
wmp.Controls( int index );
I assume that the index is the index of the play/pause controls etc.
Are you using Visual Studio? I use VS2003, and all I do is add the Windows Media Player COM component to the toolbox, then use it.
HTH
John
Yippee Kai Yai
Signed Polomint.......
|
|
|
|
|
damn hijackers
I use VS2003, too. At first i just integrated the mediaplayer in my toolbox like you. But as i found out i didn't have that controls-interface in my mediaplayer (but the microsoft-one has) i downloaded the SDK. I still can't compile their sample-app.
Btw: I have a Controls-interface.. but not the one that microsoft in the sample uses . But i can't type wmp.Controls(myindex); because in my VS2003 it's not a method.. In the microsoft-sample it's also written lowercase ('controls') and it has functions like play, stop and pause.
This friggin thing is starting to go on my nerves.. why can't it just work as it's supposed to be.. or at least as the help tells me it works..
|
|
|
|
|
Does anyone have a class for manipulating the windows volume controls from within a c# program? Thanks to other articles posted in the site I've been able to integrate CD playing in my applicatoin and now I want to control the volume as well.
Thanks in advance.
|
|
|
|
|
You could use a TrackBar derived control for this.
Try this code, it works yet leaves room for you to play with:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class VolumeControl : TrackBar
{
[DllImport("winmm.dll")]
private static extern int waveOutSetVolume(IntPtr device, UInt32 vol);
public VolumeControl()
{
base.Minimum = 0;
base.Maximum = 0xffff;
base.TickFrequency = 4096;
base.SmallChange = 4096;
base.LargeChange = 8192;
this.ValueChanged += new EventHandler(VolumeControl_ValueChanged);
}
private void VolumeControl_ValueChanged(object sender, EventArgs e)
{
waveOutSetVolume(IntPtr.Zero, (uint)(Value|Value<<16));
}
}
Regards,
mav
|
|
|
|
|
Works for setting the wave/mp3 volume but not for accessing the CD volume.
Other ideas?
|
|
|
|
|
You're right, if you want to specifically target the CD volume only, then you'll have to use the Win32 mixer* functions.
But beware, the whole process will become a bit complex and correct declaration of the functions for P/Invoke is crucial.
This link should get you started, though:
Audio Mixer Reference
Regards,
mav
|
|
|
|
|
I designed a dataDrid (with C#) with ColumnStyles --> DataGridBoolColumn
and i want this column to respond to only one click
can any one help me ?
|
|
|
|
|
Hi,
Please Check @ http://www.syncfusion.com/faq/winforms/
Happy Coding
|
|
|
|
|
I've been doing a lot of GDI programing while making custom controls and the thing that frustrates me the most is not knowing if you made a mistake.
Does any know of any helpful tools for GDI programming. GDI programming is almost like drawing with your left hand in a paper bag. It would be nice if there was some sort of testing framework / tool that would make it easier to see what you are doing.
|
|
|
|
|
Nothing against writing in a paper bag with the left hand....it's quite easy....especially if you are a left-handed person like me
|
|
|
|
|
Hey guys,
I'm working on sort of a "proof of concept" program (using .NET and C#) that will generate random reply's to forum posts. My program takes a URL, which would be the URL of the page I am replying to, and submits a reply that is pulled from a word list. I'm trying to figure out the best way to open a connection to the page, and then put my mouse-pointer in the "message" box. I can't pass the message as a URL parameter or anything of the sort, because the forums are php/asp. So, does anyone have any ideas as to the best way to open a connection to the page, or on how to get "into" the reply box? To give you an idea, use my test board @ http://s6.invisionfree.com/Justin, and try replying to a post in the Concept forum - this is the process I want to automate. I just need some ideas on the best way to accomplish this...any suggestions are welcome.
Thanks,
Justin
|
|
|
|