CadImage Load Default Color and Print,Font

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
kyu5354
Posts: 1
Joined: 15 Nov 2006, 20:11

CadImage Load Default Color and Print,Font

Post by kyu5354 » 15 Nov 2006, 20:17

IÒ‘m testing your CadImage.dll example program that iÒ‘ve downloaded from your website. I would like to set the display to black and white color. Also, I like to know how to print directly to printer with customer fonts. Could anyone give me some hints. thank you! It is in C#...

Code: Select all

<font color="blue">private void</font id="blue"> button1_Click(<font color="blue">object</font id="blue"> sender, System.EventArgs e)
{	
  <font color="blue">if</font id="blue">(DLLWin32Import.CADFile != IntPtr.Zero)
  {
    DLLWin32Import.CloseCAD(DLLWin32Import.CADFile);
    DLLWin32Import.CADFile = IntPtr.Zero;
  }
<font color="green">//dlgOpenDXFFile.ShowDialog();</font id="green">
  dlgOpenDXFFile.FileName = @"d:\test.DWG";
  DLLWin32Import.CADFile = DLLWin32Import.CreateCAD(panel1.Handle,    dlgOpenDXFFile.FileName);
		
  <font color="blue">if</font id="blue">(DLLWin32Import.CADFile != IntPtr.Zero)
  {
    panel1.Visible = <font color="blue">true</font id="blue">;
    panel1.Invalidate();
  }
<font color="green">//Layers</font id="green">
  <font color="blue">int</font id="blue"> Cnt = DLLWin32Import.CADLayerCount(DLLWin32Import.CADFile);
  <font color="blue">int</font id="blue"> I;
  <font color="blue">int</font id="blue"> Layer;
  DXFData EData = new DXFData();
  EData.FontName = "myfont.shx";
  EData.Color = 0;
  layerForm.layerList.Items.Clear();
  EData.Text = "abc efg hij k";
  <font color="blue">for</font id="blue">(I = 0; I < Cnt; I++)
  {
    Layer = DLLWin32Import.CADLayer(DLLWin32Import.CADFile, I, <font color="blue">ref</font id="blue"> EData);
  layerForm.layers.Add(Layer);
  layerForm.layerList.Items.Add(EData.Text, <font color="blue">true</font id="blue">);
}

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 17 Nov 2006, 11:24

Hello!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I would like to set the display to black and white color.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
It is necessary to use function SetBlackWhite:

Code: Select all

BOOL SetBlackWhite(
  <font color="blue">HANDLE</font id="blue"> <b>hObject</b>,
  <font color="blue">int</font id="blue"> <b>CMode</b>
);
<b>Parameters</b>

<i>hObject</i>

Identifies a CADImage object handle

<i>CMode</i>

Specifies the drawing mode. If CMode is equal '1 then CAD drawing object specified by hObject is drawn in black/white mode. If CMode is equal '0' then CAD drawing object specified by hObject is drawn in colored mode.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Also, I like to know how to print directly to printer with customer fonts. <hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<b>CADImage.DLL</b> does not allow managing with fonts when printing. All fonts are used respectively to their names in the CAD file (this rule is true for all True Type or SHX fonts).

We would like you to pay attention to <b>CADImport .NET</b>: http://www.cadsofttools.com/download/cadimportnet.zip This product is much more powerful.

In your code above you have mentioned DXFDATA structure. We must say that this structure is used only for getting info about layers in CAD files.

Sergey.

please post questions to the forum or write to support@cadsofttools.com

Post Reply