C# WinForms appication full integration with HTMLHelp ( .chm ) - Help topics, Context sensitive help, and Tooltips
Introduction
This article will explain how to fully integrate HTMLHelp (.chm) with C# WinForm application. The standard .NET HelpProvider can only show topics out of .chm file or show static context help. Here we will show how to display context sensitive help and tooltips out of the .chm as well.
Background
Originally HTMLHelp was designed to ship with C++ applications so a standart C++ appication can make a full use of a .chm file. Through HtmlHelp API it displays topics and can automatically assign controls to stringIds allowing context sensitive help to be shown when requested. All was working on C++ controlIds mapped to HTMLHelp stringIds and shared .h files used from both HTMLHelp compiler and C++ application to help the mapping. The C# use of .chm file in that respect is very limited. Through HelpProvider one can assign only topics or static text to be show when help is requested for the control. The controls don't have the C++ IDs any more that can be mapped to a HTMLHelp stringIds for automatic context help display. To solve the lack of context sensitive help we can still use HtmlHelp Api through InteropServices and hhctrl.ocx. We can use this function with HH_DISPLAY_TEXT_POPUP
and passing the marshaled HH_POPUP
structure from C# filled with the necessary information. The only problem is that it needs idString which is the numeric id of the string for the context help text in the HTMLHelp file. In C++ this numeric IDs were coming from the shared .h file but here we dont have it ...... well then add it to the project as a resource and parse it ourselves. We can "Add as Link" this .h file which originally should be in the HTMLHelp project and set its build action as "Embedded Resource". The .h file consists of defines like:
#define ButtonHelp 1001
#define ButtonHelp.TT 1002
#define MainForm.tbKW 1003
#define MainForm.tbKW.TT 1004
#define MainForm 1005
#define MainForm.TT 1006
#define MainForm.cbHC 1007
#define MainForm.tvHF 1008
so we can read the resource at runtime:
Assembly.GetExecutingAssembly().GetManifestResourceStream("WinHelpTest.XPHelpMap.h"))
and create a dictionary mapping strings to numbers. But then still how to map this numbers to the controls in the C# application. Well we can come up with some automatic recursive naming convention which constructs the HTMLHelp name from gluing the names of the control and its parent back in the hierarchy.
String GetControlName(Control ctrl)
{
if (ctrl.Parent == null)
{
return ctrl.Name;
}
return GetControlName(ctrl.Parent) + "." + ctrl.Name;
}
For example if we have Form named MainForm and control on it named tbKW we can automatically workout that the stringId matching this control is in the dictionary under key "MainForm.tbKW" . So if we construct the .h file defines with that in mind everything will hook up when we use it with C#. The HtmlHelp API is called on the control's HelpRequested
event, automatically filling up HH_POPUP
with the right stringId taken from the .h dictionary with key the "recursive naming convention control name" - GetControlName(control)
.
To get the tooltips from the .chm file is another matter. It was not available even with C++ application so we have to use some trick to do it. The idea came from another Code Project article Decompiling CHM (help) files with C# which is explaining how to browse through a content of a .chm file. Basically all the files that are included in the HMLHelp project are compiled as IStreams in the .chm file which is kind of Compound Document File but not one you can open with Ole32.dll StgOpenStorage
, but for which have to use undocumented interface ITStorage (itss.dll) and it's StgOpenStorage
. So basically, we can create a .txt file with the same syntax as the .txt file for the context sensitive help ( even use the same one ) and add the tooltips text there. Then name the stringIds with the same naming convention as the context sensitive help but adding ".TT" at the end to separate them as tooltips. So when the application runs we can read this stream from the .chm storage and parse it and create dictionary of stringId and tooltip text. Then we can set C# ToolTip object to be associated with each control and automatically assign the text for the control name.
Using the code
The code that comes with the article is a C# WinForms project and a Library file which implements the .chm help interactions.
There is HTMLHelp Workshop project as well which works with the C# app
It demonstrates the described ideas and can give you a good start
The WinForms application makes use of the .chm help file through the class library WinHtmlLib through class WinHelpEx
. So first of all create an object of this class
WinHelpEx s_help = new WinHelpEx();
This object can be static and used throughout the whole application or per form depends on the needs and the structure of the .chm file. If you define separate context sensitive .txt file and tooltip .txt file and .h map file for every form in the .chm file have to have object per form . If all the context sensitive help is in one file and tooltip text is in one file and map .h is only one file you can use only one WinHelpEx static object for the whole project.
WinHelpEx has two main functions:
public void Load(
string sChmPath,//path to the .chm file
Stream sAliasIDH,//this is a stream object to the .h resource
// used for the mapping
// (Assembly.GetExecutingAssembly().GetManifestResourceStream(
//"WinHelpTest.XPHelpMap.h"))
string sCSStreamName,//name of the IStream in .chm
// holding the context sensitive help
string sTTStreamName//name of the IStream in .chm holding the tooltip text
);
//loads the two dictionaries from the .chm file
and
public void AttachForm(
Control ctrlBase,//( can be null - the base control is frm )control
//for the bottom of the hierarchy when constructing HTMLHelp string key
Form frm,//the form for which we want to apply the .chm help
bool putHelpButton,//should we show the Help Button in the window Title bar
IsControlUsedDlgt IsCtrlUsed, //( can be null - control is used
//for help ) supplied by the form - callback that
//can specify if control has help associated in .chm ( can exclude controls )
GetControlNameDlgt GetCtrlName,//( can be null - control is assigned
//the automaticly generated HTMLHelp stringId ) supplied
//by the form - callback that can specify if control
//have HTMLHelp string name different than the automaticly
//generated for the context sensitive string name
IsCSHelpDlgt IsCSHelp,//(can be null - if form default help action
//is show topic , if control default help action is context
//sensitive help ) supplied by the form - callback that can
//specify if control have context sensitive help or show topic
IsControlUsedDlgt IsCtrlTTUsed,//( can be null - control
//is used for tooltip ) supplied by the form - callback
//that can specify if control has tooltip
//associated in .chm ( can exclude controls )
GetControlNameDlgt GetCtrlTTName //( can be null - control is assigned
//the automaticly generated HTMLHelp stringId for tooltip )
//supplied by the form - callback that can specify
//if control have HTMLHelp string name different
//than the automaticly generated for the tooltip string name
);
//goes through all the suncontrols of the form recursively and tries
//to associate context sensitive help and tooltip with them according
//to that if control is used and what is the HTMLHelp string name of the control
Please take a look at the attached example for more details or just ask.
Thanks.
发表评论
iGAyo1 Thank you for your post.Thanks Again. Awesome.
GmUPjd Just my opinion, it might make your posts a little bit more interesting.
Hi! My name is Adalin and I very want sex! m
wA1Pv5 Awesome blog post.Thanks Again. Awesome.
thellagem712
nonude models
no nude models
young models
child models
nonude modelling
no nude pictures
no nude girls
young nonude
school models
schoolgirls modelling
modelling forum
dolls models
young dollsRival legal teams, well-financed and highly motivated, are girding for court battles over the coming months on laws enacted in Arkansas and North Dakota that would impose the nation's toughest bans on abortion.
For all their differences, attorneys for the two states and the abortion-rights supporters opposing them agree on this: The laws represent an unprecedented frontal assault on the Supreme Court's 1973 Roe v. Wade decision that established a nationwide right to abortion.
The Arkansas law, approved March 6 when legislators overrode a veto by Democratic Gov. Mike Beebe, would ban most abortions from the 12th week of pregnancy onward. On March 26, North Dakota went further, with Republican Gov. Jack Dalrymple signing a measure that would ban abortions as early as six weeks into a pregnancy, when a fetal heartbeat can first be detected and before some women even know they're pregnant.
Abortion-rights advocates plan to challenge both measures, contending they are unconstitutional violations of the Roe ruling that legalized abortion until a fetus could viably survive outside the womb. A fetus is generally considered viable at 22 to 24 weeks.
Read more...Rival legal teams, well-financed and highly motivated, are girding for court battles over the coming months on laws enacted in Arkansas and North Dakota that would impose the nation's toughest bans on abortion.
For all their differences, attorneys for the two states and the abortion-rights supporters opposing them agree on this: The laws represent an unprecedented frontal assault on the Supreme Court's 1973 Roe v. Wade decision that established a nationwide right to abortion.
The Arkansas law, approved March 6 when legislators overrode a veto by Democratic Gov. Mike Beebe, would ban most abortions from the 12th week of pregnancy onward. On March 26, North Dakota went further, with Republican Gov. Jack Dalrymple signing a measure that would ban abortions as early as six weeks into a pregnancy, when a fetal heartbeat can first be detected and before some women even know they're pregnant.
Abortion-rights advocates plan to challenge both measures, contending they are unconstitutional violations of the Roe ruling that legalized abortion until a fetus could viably survive outside the womb. A fetus is generally considered viable at 22 to 24 weeks.
Read more...Find your partner online with iafrica.com dating.
Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Begin by telling us the type of person you're looking for in your next relationship and start looking for love right from our homepage. It's free and it's easy. With millions of singles online, is so sure you'll find someone special within six months, we're willing to guarantee it with our Match.com Guarantee.
Looking for the love of your life? Like Dinner? Why not try our sister site, Dateland, this site has thousands of singles in your area looking for the love of their life and possibly a candle lit dinner or two!
is the best site to discover great numbers of Filipino girls seeking partner for Filipino dating, serious commitment, true love, and marriage. You can meet Filipina singles from different parts of the Philippines and anywhere from globe. If you want to find someone that really interests you the most, why not meet your Filipino women by browsing our Filipino Gallery, Featured Members, First Class Filipina, and New Member. Send Smiles, Messages, or Chat through Webcam Philippines chat. This is the perfect destination for online Philippines dating / Asian dating if you are sincere to meet Filipina Singles for Filipina dating and love!
If there is any aspect of dating which is common for both sexes, then perhaps the idea of being in love can be scary; one said "being really intimate with someone in a committed sense is kind of threatening" and described love as "the most terrifying thing."Some common example includes lactation, pregnancy, elder people, growing children, and thinner body shape. Often supplementary drinks or capsules are prescribed by physicians.
One of the most important features to the growth of online banking has been the development of protection barriers to safeguard users and their money. Personal Identification Numbers (PINs) and/or passwords have allowed users to authenticate and protect accounts and transactions.
How does all this online dating stuff work anyway? We have all of the necessary details for you to learn for free.
Keep your profile quiet with our privacy settings. Put your saucy photos under lock and key with Private Albums, restricting access to just the hot singles you're interested in. Requesting a key from local hot girls and guys with private pics is a snap.
Set your locationfull lenght porn
older lesbian porn straight guy porn pin up porn
homemade chubby porn emo porn vidsНарод, подскажите где нокиа 5800 игры бесплатно скачать ? Очень нужно, давно уже ищу и не могу найти.
As we were going up the stairs with the last of the groceries my husband was feeling my ass and we stopped on the porch to kiss. Meanwhile, I'd moved over to a position by the door, waiting to grab the girl when she came back in. You feel something drop on your stomach. How long did it last. She laid there quietly for a few minutes and then softly asked me to leave. As I was screwing her she would say to him " Joe is so big and good he's so musch better than you" The more she did this thee more John wanted her. I really learned a lot about life and sex between marriages although I suppose it would have been different if I knew then about aids. If you didn't have the papers you didn't do any filming. -- Basil Basil, That is fantastic information. Her hands, clasped tightly together behind the pillows behind Morgan's head, and arms, pulled Morgan's face tight against her luscious pussy as Morgan continued giving her long wet licks along the outer lips of her pussy.
Bird wonderfull
SORRy del topic please/ this just testmilf fem dom free full legth gay porn lesbian sex miniskirts lesbian nudist camps can fetal heart rate determine sex parts for homemade sex toys sex video damn girl with huge tits getting fucked job gay lesbian ariel and bell hentai im feeling myself masturbation song spiderman porn videos sex in stone age fantasy sex role playing games lesbian playing with their pussy knightly sex scene first double penetration video clips porn movies boots men cumshots free porno podcast
In most cases, the presence of appendicitis in elderly patients is also revealed late.
Chocolate candy, comparing with other types of candies, does not raise the bad cholesterol (LDL) as other saturated fats do.
How will I know that my Diabetes Treatment is working?
Regular exercise and healthy eating will go a long way towards lowering the risk of an obesity related disease such as diabetes.
This can result in the blood vessels which are close to the skin's surface showing through the skin as a bluish tint.cheap frogskin sunglasses
7490
noropook8 55Hello. And Bye.
meibi http://goo.gl/RJ8Qr