hefei93 wrote: > > > Hi, I am us mitab.dll in VB to write the tab file, and I found the > set_pen function won't give me the correct color when using black. I > got the color from mapx style object: > > mcolor = map1.defaultstyle.linecolor (in BGR ) > then I use a function to convert it to RGB > > Private Function BGR2RGB(ByVal mColor As Long) As Long > Dim mRed As Integer > Dim mBlue As Integer > Dim mGreen As Integer > > mBlue = mColor And &HFF& > mGreen = (mColor \ &H100&) And &HFF& > mRed = mColor \ &H10000 > BGR2RGB = (mBlue * 65536) + (mGreen * 256) + mRed > End Function > > All the colors show correctly except black, which will show as white > or transparent. > > Call mitab_c_set_pen(feature, mLineWidth, mLineStyle, BGR2RGB > (mcolor)) >
I have made a quick test using mitab_c_set_pen() from a C program (I don't have VB), and passing a color value of 0 (black) does work properly for me. The pen color shows up as black if I dump the contents of the tab file, and I get Pen(.., .., 0) if I convert the tab file to MIF. Perhaps there is something else in your script or in your viewer causing a side-effect. If you use tab2tab.exe to convert the tab file to mif then does the pen color show up as 0? If not then what do you get? Also, try passing 0 directly as the argument to set_pen(), instead of using the call to BGR2RGB() and see if that changes anything. Daniel -- ------------------------------------------------------------ Daniel Morissette [EMAIL PROTECTED] DM Solutions Group http://www.dmsolutions.ca/ ------------------------------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/mitab/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
