Пример #1
0
//---------------------------------------------------------------------------
void __fastcall TRichEdit20::SetFormat(UnicodeString FontName, int FontSize,
  TFontCharset FontCharset, TFontStyles FontStyles, unsigned int TabSize,
  bool AWordWrap)
{

  if (!FInitialized)
  {
    // for efficiency we should be creating handle here
    assert(!HandleAllocated());
  }

  // setting DefAttributes is noop if we do not have a handle
  // (btw code below would create one anyway)
  HandleNeeded();

  LockWindowUpdate(Handle);

  // setting DefAttributes may take quite time, even if the font attributes
  // do not change, so avoid that if not necessary
  if (!FInitialized ||
      (Font->Name != FontName) ||
      (Font->Size != FontSize) ||
      (Font->Charset != FontCharset) ||
      (Font->Style != FontStyles))
  {
    Font->Name = FontName;
    Font->Size = FontSize;
    Font->Charset = FontCharset;
    Font->Style = FontStyles;
    DefAttributes->Assign(Font);
  }

  if (!FInitialized ||
      (FTabSize != TabSize))
  {
    SetTabSize(TabSize);
    FTabSize = TabSize;
  }

  if (!FInitialized ||
      (FWordWrap != AWordWrap))
  {
    assert(HandleAllocated());
    // Undocumented usage of EM_SETTARGETDEVICE.
    // But note that it is used by MFC in CRichEditView::WrapChanged()
    SendMessage(Handle, EM_SETTARGETDEVICE, 0, (AWordWrap ? 0 : 1));
    FWordWrap = AWordWrap;
  }

  LockWindowUpdate(NULL);

  FInitialized = true;

}
Пример #2
0
wxTextPrintout::wxTextPrintout(char *title, char *text,
			       float border,
			       int pointsize, int family, 
			       int style, int weight,
			       float tab,
			       float header,float headerrule,
			       float footer,float footerrule
			       )
  :wxPrintout(title),TextToPrint(text),
   FontSize(10),FontFamily(family),
   FontStyle(style),FontWeight(weight),
   BorderSize(50.f),
   TabSize(80.f)
{
  // set the Default number of pages
  Pages=32000;
  // if a NULL-pointer, give it an empty one...
  if (!TextToPrint) 
    {
      TextToPrint="(NULL)\n";
    }
  // set the defaults
  SetFontSize(pointsize);
  SetHeaderSize(0.f);
  SetHeaderRuleOff(0.f);
  // acomedate for footer-message by default... 
  SetFooterSize((float)GetFontSize());
  SetFooterRuleOff((float)GetFontSize());
  // Now set the other stuff
  SetBorderSize(border);
  SetHeaderSize(header);
  SetHeaderRuleOff(headerrule);
  SetFooterSize(footer);
  SetFooterRuleOff(footerrule);
  SetTabSize(tab);
}
Пример #3
0
//---------------------------------------------------------------------------
void __fastcall TRichEdit20::ResetFormat()
{
  // tabs are paragraph attributes, which default values cannot be set,
  // so we need to reapply them after loading file
  SetTabSize(FTabSize);
}