当前位置: 首页>>代码示例>>C#>>正文


C# IVwEnv.AddPicture方法代码示例

本文整理汇总了C#中IVwEnv.AddPicture方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.AddPicture方法的具体用法?C# IVwEnv.AddPicture怎么用?C# IVwEnv.AddPicture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVwEnv的用法示例。


在下文中一共展示了IVwEnv.AddPicture方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayAnnotation

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays an annotation expanded or contracted
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="ann"></param>
		/// <param name="expanded"></param>
		/// ------------------------------------------------------------------------------------
		private void DisplayAnnotation(IVwEnv vwenv, IScrScriptureNote ann, bool expanded)
		{
			#region First row has status, ref, category, & quote
			SetBackgroundColorForNote(ann, vwenv);

			OpenTableRow(vwenv, ann);

			// Display expand box (+/-) in the first cell
			//InsertNoteSeparator(vwenv);
			vwenv.OpenTableCell(1, 1);
			vwenv.AddObj(ann.Hvo, this, (int)NotesFrags.kfrExpansion);
			vwenv.CloseTableCell();

			// Display status in the second cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);

			if (ann.AnnotationType == NoteType.CheckingError)
			{
				// When the annotation is a checking error, we don't want clicking on the status
				// to change the status. Therefore, make the min and max the same.
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, 0, 0);
			}
			else
			{
				vwenv.AddIntPropPic((int)ScrScriptureNoteTags.kflidResolutionStatus,
					this, (int)NotesFrags.kfrStatus, (int)NoteStatus.Open, (int)NoteStatus.Closed);
			}
			vwenv.CloseTableCell();

			// Display reference in the third cell and make it readonly.
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvDefault, 0);
			vwenv.OpenParagraph();
			vwenv.AddProp((int)CmBaseAnnotationTags.kflidBeginRef, this, (int)NotesFrags.kfrScrRef);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category in the fourth (and possibly fifth and sixth) cell(s)
			vwenv.OpenTableCell(1, expanded ? 3 : 1);
			IStTxtPara quotePara = ann.QuoteOA[0];
			bool fQuoteParaRtoL = IsParaRightToLeft(quotePara);

			// Conc paragraphs don't work well for R-to-L: If the text doesn't fit, it will
			// show the trailing text rather than the leading text.
			if (fQuoteParaRtoL || expanded)
				vwenv.OpenParagraph();
			else
				vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddObjVec((int)ScrScriptureNoteTags.kflidCategories, this,
				(int)NotesFrags.kfrConnotCategory);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display CONNOT category chooser button in the penultimate or last cell
			vwenv.OpenTableCell(1, 1);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint, 1000);
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
				(int)FwTextPropVar.ktpvMilliPoint, 2000);

			vwenv.AddPicture(m_picChooser, -(int)NotesFrags.kfrConnotCategory, 0, 0);
			vwenv.CloseTableCell();

			// If not expanded, display the quote in the last cell
			if (!expanded)
			{
				vwenv.OpenTableCell(1, 1);
				SetupWsAndDirectionForPara(vwenv, quotePara.Hvo);
				if (fQuoteParaRtoL)
					vwenv.OpenParagraph(); // Conc paragraphs don't work well for R-to-L
				else
					vwenv.OpenConcPara(0, 0, 0, 0);
				vwenv.AddString(quotePara.Contents);
				vwenv.CloseParagraph();
				vwenv.CloseTableCell();
			}

			CloseTableRow(vwenv, ann);
			#endregion

			if (!expanded)
				return;

			#region Second through fifth rows
			bool fRegularAnnotation = ann.AnnotationType != NoteType.CheckingError;
			//Second row has quote
			DisplayExpandableAnnotation(vwenv, ann,
				(int)ScrScriptureNoteTags.kflidQuote,
				ann.QuoteOA.Hvo, ann.QuoteOA,
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:101,代码来源:TeNotesVc.cs

示例2: Display


//.........这里部分代码省略.........
					{
						// We are displaying a back translation or Scripture in draftview in a table
						// Open a table to display the BT para in column 1, and the icon in column 2.
						VwLength vlTable; // we use this to specify that the table takes 100% of the width.
						vlTable.nVal = 10000;
						vlTable.unit = VwUnit.kunPercent100;

						VwLength vlColumn; // and this one to specify 90% for the text
						vlColumn.nVal = DisplayTranslation ? 9000 : 10000;
						vlColumn.unit = VwUnit.kunPercent100;

						int nColumns = DisplayTranslation ? 2 : 1;

						vwenv.OpenTable(nColumns, // One or two columns.
							vlTable, // Table uses 100% of available width.
							0, // Border thickness.
							VwAlignment.kvaLeft, // Default alignment.
							VwFramePosition.kvfpVoid, // No border.
							//VwFramePosition.kvfpBox,
							//VwRule.kvrlAll, // rule lines between cells
							VwRule.kvrlNone,
							0, //No space between cells.
							0, //No padding inside cells.
							false);

						// Specify column widths. The first argument is the number of columns,
						// not a column index.
						vwenv.MakeColumns(nColumns, vlColumn);
						vwenv.OpenTableBody();
						vwenv.OpenTableRow();

						// Display paragraph in the first cell
						vwenv.OpenTableCell(1, 1);
						InsertParagraphBody(vwenv, hvo, frag, true, ContentType, this);
						vwenv.CloseTableCell();

						if (DisplayTranslation)
						{
							// Stylesheet should never be null for a VC that displays BTs, but to be safe...
							Debug.Assert (m_stylesheet != null);
							if (m_stylesheet != null)
							{
								IStPara para = m_cache.ServiceLocator.GetInstance<IStParaRepository>().GetObject(hvo);
								ITsTextProps styleRules = para.StyleRules;
								if (styleRules == null)
								{
									Debug.Fail("Style Rules should not be null");
									styleRules = NormalStyle;
								}
								string paraStyleName = styleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
								ITsTextProps ttp = m_stylesheet.GetStyleRgch(0, paraStyleName);
								Debug.Assert(ttp != null);
								if (ttp != null)
								{
									int var;
									int spaceBefore = ttp.GetIntPropValues((int)FwTextPropType.ktptSpaceBefore, out var);
									if (spaceBefore > 0)
										vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, var, spaceBefore);
								}
							}
							// BT status icon in the next cell, not editable
							vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
								(int)TptEditable.ktptNotEditable);
							vwenv.OpenTableCell(1, 1);
							vwenv.AddObjVec(StTxtParaTags.kflidTranslations, this, (int)ScrFrags.kfrBtTranslationStatus);
							vwenv.CloseTableCell();
						}

						// Close table
						vwenv.CloseTableRow();
						vwenv.CloseTableBody();
						vwenv.CloseTable();
					}
					break;
				case (int)ScrFrags.kfrBtTranslationStatus:
					{
						ICmTranslation trans = m_cache.ServiceLocator.GetInstance<ICmTranslationRepository>().GetObject(hvo);
						if (trans != null)
						{
							string status = trans.Status.get_String(m_wsDefault).Text;
							IPicture picture;
							if (status == BackTranslationStatus.Checked.ToString())
								picture = m_CheckedPic;
							else if (status == BackTranslationStatus.Finished.ToString())
								picture = m_FinishedPic;
							else
								picture = m_UnfinishedPic;

							vwenv.OpenDiv();
							vwenv.AddPicture(picture, -1, 0, 0);
							vwenv.NoteDependency(new [] {hvo}, new [] {CmTranslationTags.kflidStatus}, 1);
							vwenv.CloseDiv();
						}
					}
					break;
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:DraftViewVc.cs

示例3: Display

		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case kfragRoot:
					// draw a paragraph box but don't add a picture
					using (new VwConstructorServices.ParagraphBoxHelper(vwenv,
							null))
					{
						vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
						(int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin);
						vwenv.set_IntProperty((int)FwTextPropType.ktptOffset,
							(int)FwTextPropVar.ktpvMilliPoint, -2500);
						vwenv.AddPicture(m_picture.Picture, ktagPicture, 0, 0);

						AddParagraphBoxContents(vwenv,
							() => vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
																				   (int)FwTextPropVar.ktpvEnum,
																				   (int)TptEditable.ktptIsEditable),
							() => vwenv.AddStringProp(SimpleRootSiteDataProviderView.kflidSimpleTsString, null));
					}
					break;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:24,代码来源:RootSiteDataProviderView.cs

示例4: Display

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			switch (frag)
			{
				case (int)ScrFrags.kfrScripture:
				{
					vwenv.AddLazyVecItems(ScriptureTags.kflidBookAnnotations, this,
						(int)ScrFrags.kfrBook);
					break;
				}
				case (int)ScrFrags.kfrBook:
				{
					vwenv.AddLazyVecItems(ScrBookAnnotationsTags.kflidNotes, this,
						(int)NotesFrags.kfrAnnotation);
					break;
				}
				case (int)NotesFrags.kfrAnnotation:
				{
					DisplayAnnotationFragment(vwenv, hvo);
					break;
				}
				case (int)NotesFrags.kfrResponse:
				{
					DisplayResponseFragment(vwenv, hvo);
					break;
				}
				case (int)NotesFrags.kfrExpansion:
				{
					vwenv.OpenParagraph();

					//if (m_expanderPadding == -1)
					//    m_expanderPadding = GetImagePadding(vwenv, m_picMinus);

					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
						(int)FwTextPropVar.ktpvMilliPoint, 2500);

					ICmObject obj = m_cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
					vwenv.AddPicture((m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]) ?
						m_picMinus : m_picPlus,	(int)obj.OwningFlid, 0, 0);

					vwenv.CloseParagraph();
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:58,代码来源:TeNotesVc.cs

示例5: AddPullDownIcon

			private void AddPullDownIcon(IVwEnv vwenv, int tag)
			{
				if (m_fIconsForAnalysisChoices)
				{
					vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTrailing,
						(int)FwTextPropVar.ktpvMilliPoint, kmpIconMargin);
					vwenv.set_IntProperty((int)FwTextPropType.ktptOffset,
						(int)FwTextPropVar.ktpvMilliPoint, -2500);
					vwenv.AddPicture(m_PulldownArrowPic.Picture, tag, 0, 0);
				}
			}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:11,代码来源:SandboxBase.SandboxVc.cs

示例6: Display

		///// ------------------------------------------------------------------------------------
		///// <summary>
		///// Gets the image padding.
		///// </summary>
		///// ------------------------------------------------------------------------------------
		//private int GetImagePadding(IVwEnv vwenv, stdole.IPicture pic)
		//{
		//    ITsTextProps ttp = StyleUtils.CharStyleTextProps(ScrStyleNames.NotationTag,
		//        m_cache.DefaultUserWs);
		//    ITsStrBldr bldr = TsStrBldrClass.Create();

		//    bldr.Replace(0, 0, "X", ttp);
		//    int dmpX, lineHeight;
		//    vwenv.get_StringWidth(bldr.GetString(), ttp, out dmpX, out lineHeight);

		//    float pixelsY = ((float)m_pixelHeights[pic] - 1f); // *m_zoomPercent;
		//    float inchesY = pixelsY / (float)m_dpiY;
		//    float milliptY = 72000f * inchesY;
		//    return (int)(Math.Abs((float)lineHeight - milliptY) / 2f);
		//}

		#endregion

		#region Overridden methods
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This is the main interesting method of displaying objects and fragments of them.
		/// Scripture Footnotes are displayed by displaying each footnote's reference and text.
		/// The text is displayed using the standard view constructor for StText.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="hvo"></param>
		/// <param name="frag"></param>
		/// ------------------------------------------------------------------------------------
		public override void Display(IVwEnv vwenv, int hvo, int frag)
		{
			CheckDisposed();

			switch (frag)
			{
				case (int)ScrFrags.kfrScripture:
				{
					vwenv.AddObjVecItems((int)Scripture.ScriptureTags.kflidBookAnnotations,
						this, (int)ScrFrags.kfrBook);
					break;
				}
				case (int)ScrFrags.kfrBook:
				{
					// REVIEW: This dependency causes the relevent portions of the view to be
					// re-laid out when the underlying sequence property (kflidNotes) changes
					// because PropChanged never gets called for the virtual property, though
					// maybe it should.
					vwenv.NoteDependency(new int[] { hvo },
						new int[] { (int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes }, 1);
					vwenv.AddLazyVecItems(VirtualNotesTag, this, (int)NotesFrags.kfrAnnotation);
					break;
				}
				case (int)NotesFrags.kfrAnnotation:
				{
					DisplayAnnotationFragment(vwenv, hvo);
					break;
				}
				case (int)NotesFrags.kfrResponse:
				{
					DisplayResponseFragment(vwenv, hvo);
					break;
				}
				case (int)NotesFrags.kfrExpansion:
				{
					vwenv.OpenParagraph();

					//if (m_expanderPadding == -1)
					//    m_expanderPadding = GetImagePadding(vwenv, m_picMinus);

					vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
						(int)FwTextPropVar.ktpvMilliPoint, 2500);

					vwenv.AddPicture((m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]) ?
						m_picMinus : m_picPlus,	m_cache.GetOwningFlidOfObject(hvo), 0, 0);

					vwenv.CloseParagraph();
					break;
				}
				default:
					base.Display(vwenv, hvo, frag);
					break;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:88,代码来源:TeNotesVc.cs

示例7: AddSelectionCell

		private void AddSelectionCell(IVwEnv vwenv, int hvo)
		{
			vwenv.OpenTableCell(1, 1);

			// Put a pixel of light grey pad around the check box itself.
			vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
				(int)FwTextPropVar.ktpvDefault,
				(int)RGB(System.Drawing.Color.LightGray));
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadLeading,
				(int)FwTextPropVar.ktpvMilliPoint,
				(m_dxmpCheckBorderWidth));
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTrailing,
				(int)FwTextPropVar.ktpvMilliPoint,
				(m_dxmpCheckBorderWidth));
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop,
				(int)FwTextPropVar.ktpvMilliPoint,
				(m_dxmpCheckBorderWidth));
			vwenv.set_IntProperty((int)FwTextPropType.ktptPadBottom,
				(int)FwTextPropVar.ktpvMilliPoint,
				(m_dxmpCheckBorderWidth));
			if (ShowEnabled)
			{
				int enabled = vwenv.DataAccess.get_IntProp(hvo, ktagItemEnabled);
				vwenv.NoteDependency(new int[] { hvo }, new int[] { ktagItemEnabled }, 1);
				if (enabled != 0)
				{
					// Even if the view as a whole does not allow editing, presumably a check box
					// does!
					vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
						(int)FwTextPropVar.ktpvEnum,
						(int)TptEditable.ktptIsEditable);
					vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1);
				}
				else
				{
					vwenv.AddPicture(m_DisabledCheckPic, 0, 0, 0);
				}
			}
			else
			{
				// Unconditionally show the selected property.
				vwenv.set_IntProperty((int)FwTextPropType.ktptEditable,
					(int)FwTextPropVar.ktpvEnum,
					(int)TptEditable.ktptIsEditable);
				vwenv.AddIntPropPic(ktagItemSelected, this, kfragCheck, 0, 1);
			}

			vwenv.CloseTableCell();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:49,代码来源:XmlBrowseViewBaseVc.cs

示例8: AddPreviewArrow

		private void AddPreviewArrow(IVwEnv vwenv, XmlNode node)
		{
			vwenv.OpenParagraph();
			if (IsWritingSystemRTL(node))
				vwenv.AddPicture(m_PreviewRTLArrowPic, 0, 0, 0);
			else
				vwenv.AddPicture(m_PreviewArrowPic, 0, 0, 0);
			vwenv.CloseParagraph();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:9,代码来源:XmlBrowseViewBaseVc.cs


注:本文中的IVwEnv.AddPicture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。